Suspend and Resume Measurement Extraction . . .
2019-03-13-171720
All --
I am working on an APP that generates many (100s) of RECTANGULAR MEASUREMENT OBJECTS on an image.
It seems that the APP slows down as more MEASUREMENT OBJECTS are created.
I thought there was CODE to SUSPEND and then RESUME the extraction of MEASUREMENTS from MEASUREMENT OBJECTS.
I have looked for this code in my PROJECTS and here on the FORUM but I cannot find it.
I would like to:
- SUSPEND MEASUREMENT UPDATES
- CREATE THE MEASUREMENT OBJECTS
- RESUME MEASUREMENT UPDATES
Thank you in advance.
-- Matt
0
Best Answers
-
Matt,
If you create objects one by one, then after adding of every object the data windows are updated, and that will slow down when you reach large number of objects. The best way would be to add all measurement objects at once.
There are several ways to to that:
1. Create all rectangular objects with the Grid Overlay Tool (Process tab), then add the grid to Features Manager and put it on the image as Measurements. You can also create rectangles using other tools (ROIs, Annotation,... and then add them as Measurements).
2. Use low level functions to add Box objects to McRegions and then add these McRegions using McMMData.AddFeaturesAsManualMeasurements function. (search Automation Help by: IMcRegions.SetBox and AddFeaturesAsManualMeasurements for details).
Yuri0 -
Hi Matt,
Here is the example that adds 100 rectangle measurement objects to the active image:Imports MediaCy.Addins.Measurements Imports MediaCy.IQL.Features Public Module Module1 Public Sub AddManyRctMeasures Dim im As McImage=ThisApplication.ActiveImage If im Is Nothing Then Exit Sub'no image Dim rgns As McRegions=im.RegionFeatures.Duplicate'create new regions Dim nRows As Integer=10 Dim nCols As Integer=10 Dim rw As Integer=im.Width/nCols Dim rh As Integer=im.Height/nRows Dim ind As Integer=0 For i As Integer=0 To nRows-1 For j As Integer=0 To nCols-1 rgns.SetBox(ind,j*rw,i*rh,(j+1)*rw-1,(i+1)*rh-1) ind+=1 Next Next Dim md As McMMData=im.MeasurementsData md.AddFeaturesAsManualMeasurements(rgns) End Sub End Module
I've also attached IPX file.
Yuri0
Answers