Hi all,
Given a ROI, I would like to obtain via ImageJ API another ROI consisting of its boundary pixels. I guess this may be done by dilating the original ROI's mask and then substracting the original ROI's mask from it. But even if I do that, I can't figure out a way to create then a new ROI from the resulting mask. Any idea on this (or some different path to get a boundary ROI)? Thanks, Rafa |
2011/11/7 Rafael Ballester <[hidden email]>:
> Hi all, > > Given a ROI, I would like to obtain via ImageJ API another ROI consisting of > its boundary pixels. > I guess this may be done by dilating the original ROI's mask and then > substracting the original ROI's mask from it. But even if I do that, I can't > figure out a way to create then a new ROI from the resulting mask. Any idea > on this (or some different path to get a boundary ROI)? Rafa, you are mixing "mask" and "ROI". The latter, in ImageJ parlance, is a vector graphics representation of the former. Could you reformulate your question? I am not sure you are but trying to paint a ROI onto a black image to obtain the contour as painted pixels. Albert -- http://albert.rierol.net http://www.ini.uzh.ch/~acardona/ |
In reply to this post by Rafael Ballester
Hi Rafael,
Does Edit > Selection > Make Band do what you need? Regards, Curtis On Mon, Nov 7, 2011 at 12:28 PM, Rafael Ballester <[hidden email]> wrote: > Hi all, > > Given a ROI, I would like to obtain via ImageJ API another ROI consisting > of > its boundary pixels. > I guess this may be done by dilating the original ROI's mask and then > substracting the original ROI's mask from it. But even if I do that, I > can't > figure out a way to create then a new ROI from the resulting mask. Any idea > on this (or some different path to get a boundary ROI)? > > Thanks, > > Rafa > > > -- > View this message in context: > http://imagej.588099.n2.nabble.com/Creating-a-new-ROI-out-of-a-ROI-boundary-tp6971550p6971550.html > Sent from the ImageJ mailing list archive at Nabble.com. > |
In reply to this post by Albert Cardona-2
> Could you reformulate your question?
Firstly I get my roi from the RoiManager: ... Roi roi = table.get(label); Now I get its outline: BinaryProcessor bp = new BinaryProcessor((ByteProcessor)roi.getMask()); bp.invert(); bp.outline(); Now, my question is: how to create a new Roi, so that its mask is bp? @Curtis: thanks, but I would like to do it with Java code, via ImageJ's API. 2011/11/7 Albert Cardona <[hidden email]> > 2011/11/7 Rafael Ballester <[hidden email]>: > > Hi all, > > > > Given a ROI, I would like to obtain via ImageJ API another ROI > consisting of > > its boundary pixels. > > I guess this may be done by dilating the original ROI's mask and then > > substracting the original ROI's mask from it. But even if I do that, I > can't > > figure out a way to create then a new ROI from the resulting mask. Any > idea > > on this (or some different path to get a boundary ROI)? > > Rafa, > > you are mixing "mask" and "ROI". The latter, in ImageJ parlance, is a > vector graphics representation of the former. > > Could you reformulate your question? I am not sure you are but trying > to paint a ROI onto a black image to obtain the contour as painted > pixels. > > Albert > > -- > http://albert.rierol.net > http://www.ini.uzh.ch/~acardona/ > |
2011/11/7 Rafa Ballester <[hidden email]>:
>> Could you reformulate your question? > > Firstly I get my roi from the RoiManager: > > ... > Roi roi = table.get(label); > > Now I get its outline: > > BinaryProcessor bp = new BinaryProcessor((ByteProcessor)roi.getMask()); > bp.invert(); > bp.outline(); > > Now, my question is: how to create a new Roi, so that its mask is bp? Use the ThresholdToSelection class: bp.setThreshold(255, 255, ImageProcessor.NO_LUT_UPDATE); ThresholdToSelection ts = new ThresholdToSelection(); Roi roi = ts.convert(bp); Albert -- http://albert.rierol.net http://www.ini.uzh.ch/~acardona/ |
Thanks, this method worked like a charm.
2011/11/8 Albert Cardona <[hidden email]> > 2011/11/7 Rafa Ballester <[hidden email]>: > >> Could you reformulate your question? > > > > Firstly I get my roi from the RoiManager: > > > > ... > > Roi roi = table.get(label); > > > > Now I get its outline: > > > > BinaryProcessor bp = new BinaryProcessor((ByteProcessor)roi.getMask()); > > bp.invert(); > > bp.outline(); > > > > Now, my question is: how to create a new Roi, so that its mask is bp? > > > Use the ThresholdToSelection class: > > bp.setThreshold(255, 255, ImageProcessor.NO_LUT_UPDATE); > ThresholdToSelection ts = new ThresholdToSelection(); > Roi roi = ts.convert(bp); > > > Albert > > > -- > http://albert.rierol.net > http://www.ini.uzh.ch/~acardona/ > |
Free forum by Nabble | Edit this page |