Graceful way to prompt user for a RECTANGULAR ROI
All --
I have a need for a user to create a RECTANGULAR ROI within IPP9.1.
I have some code which seems to work sometimes but fails to work other times.
When it works, PREMIER activates the RECTANGULAR ROI TOOL and then presents a PROMPT.
When it fails, PREMIER does not activate the RECTANGULAR TOOL but presents the PROMPT (and the user has to activate the TOOL manually).
My code is below.
Can someone point out what I've done wrong please?
Thanks.
-- Matt
I have a need for a user to create a RECTANGULAR ROI within IPP9.1.
I have some code which seems to work sometimes but fails to work other times.
When it works, PREMIER activates the RECTANGULAR ROI TOOL and then presents a PROMPT.
When it fails, PREMIER does not activate the RECTANGULAR TOOL but presents the PROMPT (and the user has to activate the TOOL manually).
My code is below.
Can someone point out what I've done wrong please?
Thanks.
-- Matt
Public Function Demo_Select_Sample_Area() 'Learn the docid for the current image Dim doc1 With Application.DocumentCommands.Active(Demo_Select_Sample_Area) .Run(doc1) End With 'Delete all existing rois With Select.RoiCommands.DeleteAll(Demo_Select_Sample_Area) .Run(doc1) End With With Select.RoiCommands.Add(Demo_Select_Sample_Area) .Features = Features.Features.ROIs .FeatureType = Features.FeatureTypes.Rectangle '.Points = New System.Collections.Generic.List(Of System.Drawing.PointF) '.Points.Add(New System.Drawing.PointF(rLeft, rTop)) '.Points.Add(New System.Drawing.PointF(rRight, rBottom)) '.Angle = 0R '.Roundness = New System.Drawing.PointF(0F,0F) .ROIType = Features.ROI.ROITypes.Rectangle .Prompt = "Please create a RECTANGULAR ROI around the SAMPLE AREA then press OK!" .Interactive = True .Run(doc1) End With End Function
0
Best Answer
-
Matt,You need an import of MediaCy.Commands and a reference to MediaCy.Commands.Overlays.Pierre0
Answers
I would also like a "graceful" way to make sure that the MULTIPLE ROI OPTION is OFF.
The only mechanism that I have gotten to seems to only be able to TOGGLE this OPTION but not set it to ON or OFF. That would be OK but I've not seen a mechanism to "see" whether it is ON or OFF (to know whether it needs to be TOGGLED).
Thanks.
-- Matt
Thank you for the assistance.
I've copied your code into the MODULE / PROJECT that I'm working on and I get a
NOT AN OBJECT REFERENCE
error when I try to LOAD the PROJECT.
An image of the error is attached.
CHAR 55 on LINE 810 seems to be the last character on the following line
Is there a library that is not being loaded within
Thank you very much.
Making those modifications made
SelectRoi
work properly.
If possible, a tutorial on how to know which IMPORTS and REFERENCES are required for a situation like this would be very helpful.
Thanks again.
-- Matt