E Voelkl
E Voelkl

Reputation: 55

With several ROIs in an image, how can I send the ROI to the back

When I have several ROIs in an image, they can overlap and sometimes the smaller one gets lost behind the bigger one. However, one of the is on "top" and the other is "below." I have the ID of the ROI, but I am missing the command ROI_ID.ROISendToBack() or similar.

Any trick available? Thanks!

Upvotes: 0

Views: 47

Answers (1)

BmyGuest
BmyGuest

Reputation: 2949

The order of ROIs on a display can not be the property of an individual ROI, but it is a property of the thing 'containing' the ROIs. That's why you search for the command at the wrong place. It is not a command of the ROI object, but of the ImageDisplay object.

Each ImageDisplay contains a "list" of its ROIs and you want to change the order in that list.

The commands for specifying the "order" of ROIs on an ImageDisplay are

ROI order commands

There is no command to "move" a ROI, but you can simple remove and re-add it.

image img := RealImage( "Dummy",4, 350, 350)
img = iradius
img.ShowImage()
imageDisplay disp = img.ImageGetImageDisplay(0)

ROI roi1 = NewROI()
roi1.ROISetRectangle( 100, 100, 200, 200 )
roi1.ROISetVolatile(0)
roi1.ROISetColor(1,0,0)
roi1.ROISetDrawFilled(1)
roi1.ROISetFillProperties(0.2,0.1,0,0)

ROI roi2 = NewROI()
roi2.ROISetRectangle( 125, 125, 225, 225 )
roi2.ROISetVolatile(0)
roi2.ROISetColor(0,1,0)
roi2.ROISetDrawFilled(1)
roi2.ROISetFillProperties(0.2,0,0.1,0)

ROI roi3 = NewROI()
roi3.ROISetRectangle( 150, 150, 250, 250 )
roi3.ROISetVolatile(0)
roi3.ROISetColor(0,0,1)
roi3.ROISetDrawFilled(1)
roi3.ROISetFillProperties(0.2,0,0,0.1)

disp.ImageDisplayAddROI( roi1 )
disp.ImageDisplayAddROI( roi2 )
disp.ImageDisplayAddROI( roi3 )

OKDialog( "Now send blue to the bottom" )
disp.ImageDisplayDeleteROI( roi3 )
disp.ImageDisplayAddROIAtBeginning( roi3 )

OKDialog( "Now send red to front" )
disp.ImageDisplayDeleteROI( roi1 )
disp.ImageDisplayAddROIAtEnd( roi1 )

Demo

Upvotes: 0

Related Questions