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

Transfer or copy measured objects found within an image to another image (without feature manager)

There are two images loaded in Image Pro. In the first image a huge amount of objects found within (~1000000 objects). The measurements should now transfered to the second image to read out the intensity and so on. The feature manager does not show it when I try to add the measurements to the feature manager. I think because of the huge amount of objects. The only way I can do it now is to save it in a measurement results file and reload it to the second image.

Is there a way to solve this programmatically?

Thanks in advance.
fsup

Best Answer

  • edited August 2019 Answer ✓
    Hi fsub,

    Transferring measurements from one image to another using IQM file is an acceptable solution, it also can be automated (just activate macro recording to see the commands).

    Another option would be to use lower level code and transfer data between documents like in the macro below (Activate source image with measurements and run the macro, when prompted, click on destination image and  measurements will be transferred).

        Public Sub CopyMeasurementData
            Dim srcDoc As IMcDocument=ThisApplication.ActiveDocument
            Dim md As McMMData=srcDoc.Data.MeasurementsData
            If md.Count=0 Then
                MsgBox("ActiveImage doesn't have measurements")
                Exit Sub
            End If
            Dim dstDoc As IMcDocument
            With Automate.ScriptingCommands.ClickOnWorkspace(Nothing)
                .Prompt = "Please click on destination document."
                .SelectDocuments=True
                .Run(Nothing, dstDoc, Nothing)
            End With
            Dim md2 As McMMData=dstDoc.Data.MeasurementsData
            md2.AddFeaturesAsManualMeasurements(md.GetMcFeatures()(0))
        End Sub
    

    Yuri

Answers

  • 2019-08-26-091213

    FSUP --

    I do not know whether transferring that number of OBJECTS from one image to another in IMAGE-PRO is practical but . . .

    It may be easier to do the IMAGE ARITHMETIC to transfer the IMAGE DATA from the IMAGE you want to analyze into the IMAGE where the OBJECTS ARE.

    1. IMAGE AA = IMAGE WITH OBJECTS
    2. IMAGE BB = IMAGE FOR MEASUREMENT
    3. IMAGE AA * 0
    4. IMAGE AA + IMAGE BB
    5. MEASURE INTENSITIES in AA with OBJECTS from AA and PIXEL DATA from BB
    I hope this information is helpful.

    -- Matt


  • Hi Matt,

    thank you. I'll try your solution and give my feedback.
  • Hi Yuri,

    thats exactly what I am looking for.

    Thank you
    fsup
Sign In or Register to comment.