Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
8 posts
|
Hi everybody,
I have generated a binary image consisting of segmented particles. With ImageJ's API, I would like to obtain its particles as ROIs, so as to analyze them later. What is the easiest way to obtain those ROIs? The following way works using the ParticleAnalyzer class to store the detected ROIs into the RoiManager, so that I can retrieve them later. But I can't prevent this approach from opening the ROI Manager Window, which is annoying in an automatised context. int options = ParticleAnalyzer.ADD_TO_MANAGER; ParticleAnalyzer pa = new ParticleAnalyzer(options, 0, new ResultsTable(), 0, Double.MAX_VALUE, 0, 1); pa.analyze(imSegmented); // imSegmented is my binary image RoiManager manager = RoiManager.getInstance(); Roi[] rois = manager.getRoisAsArray(); Do you know how to prevent that window from appearing? Or any different way to obtain the ROIs? Thanks in advance! |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
1064 posts
|
On Nov 24, 2011, at 12:54 PM, Rafael Ballester wrote:
> Hi everybody, > > I have generated a binary image consisting of segmented particles. With > ImageJ's API, I would like to obtain its particles as ROIs, so as to analyze > them later. What is the easiest way to obtain those ROIs? > > The following way works using the ParticleAnalyzer class to store the > detected ROIs into the RoiManager, so that I can retrieve them later. But I > can't prevent this approach from opening the ROI Manager Window, which is > annoying in an automatised context. > > int options = ParticleAnalyzer.ADD_TO_MANAGER; > ParticleAnalyzer pa = new ParticleAnalyzer(options, 0, new ResultsTable(), > 0, Double.MAX_VALUE, 0, 1); > pa.analyze(imSegmented); // imSegmented is my binary image > RoiManager manager = RoiManager.getInstance(); > Roi[] rois = manager.getRoisAsArray(); > > Do you know how to prevent that window from appearing? Or any different way > to obtain the ROIs? ... [show rest of quote] The ImageJ 1.46b daily build adds a ParticleAnalyzer.setRoiManager() method that can be used to prevent the ROI Manager window from appearing. Here is a JavaScript example: imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif"); IJ.setAutoThreshold(imp, "Default"); manager = new RoiManager(true); ParticleAnalyzer.setRoiManager(manager); IJ.run(imp, "Analyze Particles...", "size=600 exclude add"); rois = manager.getRoisAsArray(); for (i=0; i<rois.length; i++) { imp.setRoi(rois[i]); print(i+" "+imp.getStatistics()); } And here is a lower level example: imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif"); IJ.setAutoThreshold(imp, "Default"); manager = new RoiManager(true); ParticleAnalyzer.setRoiManager(manager); pa = new ParticleAnalyzer(0, 0, new ResultsTable(), 600, Double.MAX_VALUE, 0, 1); pa.analyze(imp); rois = manager.getRoisAsArray(); -wayne |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
8 posts
|
Thank you for this new feature!
2011/11/25 Rasband, Wayne (NIH/NIMH) [E] <[hidden email]> > On Nov 24, 2011, at 12:54 PM, Rafael Ballester wrote: > > > Hi everybody, > > > > I have generated a binary image consisting of segmented particles. With > > ImageJ's API, I would like to obtain its particles as ROIs, so as to > analyze > > them later. What is the easiest way to obtain those ROIs? > > > > The following way works using the ParticleAnalyzer class to store the > > detected ROIs into the RoiManager, so that I can retrieve them later. > But I > > can't prevent this approach from opening the ROI Manager Window, which is > > annoying in an automatised context. > > > > int options = ParticleAnalyzer.ADD_TO_MANAGER; > > ParticleAnalyzer pa = new ParticleAnalyzer(options, 0, new > ResultsTable(), > > 0, Double.MAX_VALUE, 0, 1); > > pa.analyze(imSegmented); // imSegmented is my binary image > > RoiManager manager = RoiManager.getInstance(); > > Roi[] rois = manager.getRoisAsArray(); > > > > Do you know how to prevent that window from appearing? Or any different > way > > to obtain the ROIs? > > The ImageJ 1.46b daily build adds a ParticleAnalyzer.setRoiManager() > method that can be used to prevent the ROI Manager window from appearing. > Here is a JavaScript example: > > imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif"); > IJ.setAutoThreshold(imp, "Default"); > manager = new RoiManager(true); > ParticleAnalyzer.setRoiManager(manager); > IJ.run(imp, "Analyze Particles...", "size=600 exclude add"); > rois = manager.getRoisAsArray(); > for (i=0; i<rois.length; i++) { > imp.setRoi(rois[i]); > print(i+" "+imp.getStatistics()); > } > > And here is a lower level example: > > imp = IJ.openImage("http://imagej.nih.gov/ij/images/blobs.gif"); > IJ.setAutoThreshold(imp, "Default"); > manager = new RoiManager(true); > ParticleAnalyzer.setRoiManager(manager); > pa = new ParticleAnalyzer(0, 0, new ResultsTable(), 600, > Double.MAX_VALUE, 0, 1); > pa.analyze(imp); > rois = manager.getRoisAsArray(); > > -wayne > ... [show rest of quote]
|
Free forum by Nabble | Disable Popup Ads | Edit this page |