Home Image-Pro Automation (Macros, Apps, Reports)

batch processing in a folder

Hi
is there something special to do when applying a batch process to an entire folder?
Apparently there is something wrong with my reference system used in my macro :

sorry its in french

Error in Image-Pro Premier 64-bit

La référence d'objet n'est pas définie à une instance d'un objet.=bug-an-object-reference-not-set-to-an-instance-of-an-object-error

Message: La référence d'objet n'est pas définie à une instance d'un objet.
Data: System.Collections.ListDictionaryInternal
InnerException: Nothing
TargetSite: Void Schedule(MediaCy.IQL.Application.ThreadAffinity, MediaCy.IQL.Application.TaskPriority)
StackTrace:    à MediaCy.Addins.Scripting.PlayMacro.Schedule(ThreadAffinity taskBehavior, TaskPriority taskPriority)
   à MediaCy.IQL.Application.McCommand.Schedule()
   à MediaCy.Addins.Scripting.PlayMacro.Run(Object input1)
   à MediaCy.Addins.Scripting.BatchMacro.OnExecuted(ICommandSource commandSource, EventArgs e)
   à MediaCy.IQL.Application.McCommand.Execute(ICommandSource commandSource)
HelpLink: Nothing
Source: MediaCy.Addins.Scripting
HResult: -2147467261
Call Stack:
Void Schedule(MediaCy.IQL.Application.ThreadAffinity, MediaCy.IQL.Application.TaskPriority):
Void Schedule():
Void Run(System.Object):
Void OnExecuted(DevComponents.DotNetBar.ICommandSource, System.EventArgs):
Void Execute(DevComponents.DotNetBar.ICommandSource):

Thanks
Alban

Best Answers

  • Answer ✓
    Can you please also send me the files used in the macro: Segm finale.isg and data colector setting.adoxsd?
  • Answer ✓
    Alban,

    I checked your image and a macro, the image is good, but the macro was a mess! ;-)

    It looks like you recorded it, but then manually modified changing all variables to image1, which messed up all inputs and outputs.

    Next time if you modify macro manually, always check how it works running it with active image and if it works properly, only then try a batch.

    I've fixed your macro and it runs properly now, including the batch. I used my own versions of ISG and ADOXSD files, which you can find in the Configuration Files folder (that is the proper location for additional files). You should replace these files by your version.

    The modified project is attached.

    Yuri

Answers

  • Ok I identified the problem:
    I have a line in my macro with : MyWidth =ThisApplication.ActiveImage.Width
    and as there is no active image when, I try to launch the batch process it freezes.
    What can I do for that?


    I found a workaround by opening a false first image, then its seems to work but if finally chokes with the folowing message:
    Error in Image-Pro Premier 64-bitFailed to open file P5.zvi.The set file header is corrupt.
    ErrorCode: -2076128472
    Message: The set file header is corrupt.Data: System.Collections.ListDictionaryInternalInnerException: NothingTargetSite: Void Open(System.String, MediaCy.IQL.Sets.McImageSets ByRef)StackTrace:    à MediaCy.IQL.Sets.IO.IMcImageSetFiles.Open(String filename, McImageSets& SetsCollection)   à MediaCy.Viewers.Set.SetDocument..ctor(McApplication application, String filename)HelpLink: IQL.chm#34904Source: McImageSetFilesLib.McImageSetFilesHResult: -2076128472Call Stack: Void Open(System.String, MediaCy.IQL.Sets.McImageSets ByRef): Void .ctor(MediaCy.IQL.Application.McApplication, System.String):
    Thanks
    Alban
  • Hi Alban,

    If your macro type is SimpleScript, you have to put your own code inside CodeCommand (search the forum for examples).  You can also check if the active image exists, something like that:

    If ThisApplication.ActiveImage Is Nothing Then Exit Sub

    Yuri

  • Thanks,
    and do you know why i have the following message when launching the batch process in a folder : The set file header is corrupt.
  • I don't know why you get the error opening this file. Can you open the file in Premier just by using File - Open dialog? What is the structure of this image set (how many channels, resolutions, z-positions, time points ...) does it have?

    Yuri
     
  • Yes i can open the file normally but not with the batch process dialog.
    Here are the metadata of the images :smile:

    Name   A1

    DisplayName:   A1

    InitialSignature:              

    Title:     

    Owner:               

    Description:       Image for set 'A1'

    Copyright:         

    Modified:           No

    Date / Time:      26/01/2017 09:18:37

    Size:      12064 x 1959

       Width (px):     12 064

          DPI X:             300

          Width (in):    40,213

       Height (px):    1 959

          DPI Y:              300

          Height (in):   6,53

       Frame:              135,231 MB

          Bytes:             141 800 256

       Image:              135,231 MB

          Bytes:             141 800 256

    Active / Frames Count: 1 / 1

       Active Frame:                1

          Date / Time:                26/01/2017 09:18:37.421

          X,Y Position:                0, 0

          Z Position:    0

          Time Point:  00:00:00

       Frames Count:              1

    Interpretation: RGB (48bpp)

       Number Of Channels:                3

       Pixel Data Type:            Integer

       Bits/Channel: 16

       Bits/Pixel:        48

       Bytes/Channel:             2

       Bytes/Pixel:    6

       Range Minimum:         0

       Range Maximum:        65 535

    CurrentSignature:           Not Computed

    File:      

       File:   

          1:     

       Full Name:      

          1:     

       Date / Time:  

          1:     

       Title:  

          1:     

       Owner:            

          1:     

       Comments:    

          1:     

       Software:       

          1:     

       Format:           

          1:     

       Compression:                8

          1:      8

       Lossy:                Yes

          1:      Yes

    Transform:        

    FileName:           C:\Users\XXX\A1.zvi

    Dye / Tint:         

       Channel Name:            

    Spatial Calibration:          A1 (mm)

       Name:               A1

       Unit Type:       mcsuMillimeter

       Unit Name:     Millimeter

       Unit Abbreviation:       mm

       Units / Pixel:   0,917 x 0,917 mm

          by X:               0,917

          by Y:                0,917

       Pixels / Unit:   1,091 x 1,091 pixels

          by X:               1,091

          by Y:                1,091

    McDlgLUTAdjustment::McFreeForm:   

     Thanks again for your support!!

    Alban

  • Hi Alban,

    Then we have to look at the image and your macro to check the problem. Can you please drop these files to this link?:

    Click here to upload files.


    Thanks,

    Yuri

  • Thanks to take some time on my issue and sorry for the poor quality of the code, I am really a beginner...

  • edited January 2017
    The maco works much better now, thanks and sorry for the mess.
    However i have still some trouble to load the zvi file.
    Always the same error : The set file header is corrupt.

    Alban
  • Alban,

    Do you have problems with any ZVI file or some specific? It worked correctly for me with the file you sent (IP-ConvertImage-04.zvi). What version of Premier do you use? If it's not 9.3, please update to the latest version at http://www.mediacy.com/support/productupdates 

    Yuri

Sign In or Register to comment.