Re: Disjoint ROI selection using macro language
Posted by
Michael Schmid on
URL: http://imagej.273.s1.nabble.com/Disjoint-ROI-selection-using-macro-language-tp3692854p3692864.html
Hi Fabrice,
what about something like this:
myID = getImageID();
n = roiManager("count");
for (i=0; i<n; i++) {
selectImage(myID);
roiManager("select", i);
run("Duplicate...", "title=particle_"+i);
}
Michael
________________________________________________________________
On 17 Apr 2009, at 17:06, Senger Fabrice wrote:
> Gabriel Landini a écrit :
>> On Friday 17 April 2009, Senger Fabrice wrote:
>>
>>> I have a picture with 10 cells in it.
>>> I'm able to segment them.
>>> Next for each cell I would create a new picture.
>>> So I don't want to copy one specific particle, I would like to
>>> create
>>> one image for each particle.
>>> This is part of an analysis scheme where I plan to isolate cells
>>> from a
>>> picture into a folder and then batch process this folder with
>>> another
>>> macro.
>>>
>>
>> Have a look at the Catalogue_Particles macro in the Morphology
>> collection.
>> It can create a stack of objects extracted from a binary image
>> (one object per slice).
>>
>> Cheers,
>> G
>>
> I tried this but did not succeeded yet as i get some error
> messages, but i will try again.
> Actually I wanted to adapt this code taken from :
>
> // ROI Manager Stack Demo
> //
>
> n = roiManager("count");
> for (i=0; i<n; i++) {
> roiManager("select", i);
> getStatistics(area, mean);
> setResult("Area", i, area);
> setResult("Mean", i, mean);
> }
> updateResults();
> roiManager("deselect");
>
>
> and instead of making measurements I would rather go for a
> duplicate image command I tried different ways but it does not work
> yet, one of my macros get stuck to the first ROI and another
> version only displays the last particle...
> To me the advantage of using the ROI manager is to vizualize the
> selected particles and to have the opportunity to discard not
> relevant particles.
>
> Fabrice.
>
> --
> Senger Fabrice