Home Image-Pro Plus Automation with Macros

How to append data with Image Name Tag?

How to copy the image name from the active window to a data files?


Example,  I need to process set of jpeg images in folder 438

In folder 438 contain many jpeg images.

step 2 processing the image.

I have to manually select the AOI. This step can not be automated.

I also have to manually Mask the area of interested this step can not be automated.

I click on bright object and click on view statistic and click on append data to file then manually save with image folder name on it.
then I repeat the step for dark object click on view statistic then click on append data to file.

But, I can not append the name of the image to each data set of bright and dark object?  Can anyone answer this?

Currently, I am using these statements. for part of step2  and step 3

ret =IpBlbSetAttr(BLOB_AUTORANGE,1)
ret =IpBlbSetAttr(BLOB_BRIGHTOBJ,1)
ret = IpBlbCount( )
ret = IpBlbUpdate (0)
ret = IpBlbShowStatistics(1)

ret = IpBlbSaveData("I:\GFAP_red Channel \438_folder_data.cnt", S_APPEND+S_STATS+S_HEADER+S_X_AXIS+S_Y_AXIS)

ret =IpBlbSetAttr(BLOB_AUTORANGE,1)
ret =IpBlbSetAttr(BLOB_BRIGHTOBJ,0)
ret = IpBlbCount( )
ret = IpBlbUpdate (0)
ret = IpBlbShowStatistics(1)

ret = IpBlbSaveData("I:\GFAP_red Channel \438_folder_data.cnt", S_APPEND+S_STATS+S_HEADER+S_X_AXIS+S_Y_AXIS)

Then, I have to manually save the image data.

My question is How to Automatically append the active window image name to each set of the data because as I keep on appending the data set of bright object and dark object data set gets longer.   But, as list get longer, it become very difficulty to tell which image name is corresponding to which data set

Can anyone answer this?



  • edited August 2013
    Hi Bill,

    You cannot insert image name into the table that is saved by IpBlbSaveData. You can use one of the following methods to link data with image name:

    1. Save data for every image to a different file. Use image file name as a part of the data file. Something like this: ret = IpBlbSaveData(imageFileName + ".cnt", ...)

    2. Use Data Collector collecting the data from multiple images. In Data Collector you can add Image Name and all Count/Size statistical fields you want to collect. Then instead of saving data for every image you just collect it to Data Collector and save results only in the end.

    I've attached screenshots of Data Collector layout and Data List pages as example.

  • Hi Yuri,

    I have used your suggestion #1.   It works very well.

    Now each data file will have its own image name.  You can cross check for which image is for which data.

    How to parse out the sum bright object and sum of dark object?  Ignore rest of statistical data  from each 

     FileName.cnt. because each image FileName  will contain both sum of bright and sum of dark object.
    One sum  for a bright object     100
    One sum  for a dark object    10000

    These are data from view statistic on Image pro

    My question is how do I parse out the value corresponding to the sum on FileName.cnt
      each FileName.cnt will contain two sum? 

    And  Export  values 100 , 10000 only to Excel with FileName Tag on it. 


    How to import and append all these values into one long excel sheets with corresponding FileName?

    How to append all the FileName.cnt files into one long there columns list excel sheet after you parse out the sum?

    column A, column B, column C

    column A value of bright object
    column B value of dark object
    column C FileName


  • Bill, 

    You picked option 1, it looked easier and did what you want as step 1, but now you have other issues that deal with multiple files, which you cannot solve easily. 
    I would suggest using option 2 (Data Collector), then you won't have all these problems with parsing multiple data files, all your data will be in one table/file. Bright object statistics will be on odd lines, dark - on even.
    Try to use Data Collector.

  • Hi Yuri,

    Thanks you for your help!    

    The reason I did not use option 2 is I  am still learning how to to use the Data Collector.

    Using Option 1. Saving individual image name with individual cnt provided very little errors because each image name is automatically tagged with each statistical data.  

    Issues now is how to join all the cnt files into one long cnt files.

    I was able to solved the multiple .cnt files in one folder using MS Words -> Insert --> File or Object ( where you can select all the cnt files)

    MS Word allowed me to  select all desired cnt files and append all of them into one long word documents

    AFTER that I can copy and paste the data into excel do some data manipulation.


  • Hello

    Thanks for the help. Now I have a problem using the instruction ret = IpBlbSaveData (ImageFileName + ".csv", 0), no extension is added and the images are replaced by the results.

    Best regards ..
  • Hi Carlos,

    First: try to post comments inside your topic, not in other pages.

    Second: you may debug your code and check what result you get in the debugger, for example:

    Dim filename as String
    filename=ImageFileName + ".csv"
    Debug.Pring filename
    ret = IpBlbSaveData (filename)

    Also you may try to use & instead of +:
    filename=ImageFileName & ".csv"



Sign In or Register to comment.