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

exporting data collector table in between batch processing folders of images

Hello,

I have a batch processing macro set up that can quickly count particles on thousands of images and collect all the measurements into the data collector. Currently, when I am done doing the batch, another macro exports the data into a text file using the run after feature of batch processing. I have several folders that I need to work through for one experiment and right now, I am setting up each folder individually in the batch processing.

I would like to update my workflow so that I am able to expand my image processing runs to include several folders where each folder corresponds to a different sample and has a different folder name. I need to analyze/compare the data between the different samples but I don't want to manually select each folder anymore.  Is there a way to export or group the data in the data collector before moving on to a new folder? 

Thanks!

Answers

  • Options
    Hi misbrit2128,
    The batch processing can handle multiple folders, if they are sub-folders of the main folder, when you activate "Include subfolders" option. Then you just need to compare the folder of the active image and collected folder (that can be set to a global variable) before collecting the data and save the data into a text file and clear data collector when folder is about to change. You can get the file name of the active documant using FineName property:

        Private gCollectedFolder As String="" 'global variable, clean it up in RunBefore sub
        Public Sub CheckImageFolder
            Dim DocFileName As String=ThisApplication.ActiveDocument.FileName
            Debug.Print $"File name of the image = {DocFileName}"
            Dim DocFolder As String=System.IO.Path.GetDirectoryName(DocFileName)
            Debug.Print $"Folder name of the image = {DocFolder}"
            If DocFolder<>gCollectedFolder Then
                If gCollectedFolder<>"" Then
                    Dim subFolderName As String=DocFolder.Replace(System.IO.Directory.GetParent(gCollectedFolder).FullName,"").Replace("\","")
                    'todo:
                    '1. Save Data Collector data to a file with subFolderName name
    '2. Clear Data Collector Debug.Print $"Data Saved to file {subFolderName}" End If gCollectedFolder=DocFolder End If 'collect data End Sub

    Yuri
Sign In or Register to comment.