Create new ROI in Javascript

90 views
Skip to first unread message

Tamlyn Peel

unread,
Jun 8, 2017, 11:59:31 AM6/8/17
to Icy imaging
Hi, simple question but I'm struggling to find an answer in the Javadoc

I want to create a new ROI (in this case, the size of the whole image) and then do an newROI.intersect(roi, true) with an existing ROI to only have what is in a certain area, but I can't work out how to create a new ROI and set it's size and position.

the current ROIs I have report as ROI3DArea with println(roi.getClass()), and work with roi.setPosition5D(Point5D.Double(x, y, z, t, c)) and roi.exclusiveAdd(roi, true).

I've tried all variations on:

newROI = new ROI3DArea(Point5D.Double(0, 0, 0, 0, 0)), new ROI5D, etc

Any help appreciated!

Cheers

Tamlyn

Stephane

unread,
Jun 12, 2017, 4:15:46 AM6/12/17
to Icy imaging
Hi Tamlyn,

ROI3DArea are "boolean mask" 3D ROI so they contains a list of point to build the mask.
You can build easily a ROI3DArea by adding points by point or from Boolean Mask or 2D Area ROIs :

<<
importClass(Packages.plugins.kernel.roi.roi3d.ROI3DArea)

r = new ROI3DArea()

// add a single point in the mask
r.addPoint(x, y, z)
// add a full Z slice at zPosition from a BooleanMask or a ROI2DArea
r.setSlice(zPosition, BooleanMask2D)
r.setSlice(zPosition, ROI2DArea)
// merge the current mask at given Z position with specified ROI2DArea
r.add(z, ROI2DArea)
...
>>

Hope that helps !

Best,

- Stephane

Tamlyn Peel

unread,
Jun 14, 2017, 5:31:45 AM6/14/17
to Icy imaging
Great, thanks for the clear explanations! For the life of me I just couldn't work it out.
Reply all
Reply to author
Forward
0 new messages