ROI manager - change order of rois ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ROI manager - change order of rois ?

beijaflor4
Hello.

for my data analysis I need to list ROIs in temporal order of my experiments. In other words, ROI1 connects to the first experiment, ROI2 to the second one,... and lastROI connects to my last experiment.
Sometimes I realize later that I forgot to add one ROI. I could then still add one to the ROI manager, however, it is then not anymore in the correct temporal order. I usually then delete all ROIs which happened after the forgotten experiment, add the forgotten one and make all the other ones which I deleted. This is VERY annoying though, when I have a long list of ROIs.
Does one of you know how to write a macro or so, with which I can move one selected ROI up or down in the ROI Manager list?

Thanks,
b
Reply | Threaded
Open this post in threaded view
|

Re: ROI manager - change order of rois ?

will.armour
This post was updated on .
Hi,

Here is a simple macro that should be able to help. Use is as follows:
1. Add your new ROIs which are correct and they should be at the bottom of the ROI list.
2. Select the ROI before the spot where you want the 'n' items to be moved to.
3. Enter the number of items that need to be moved up.

If you need to insert ROIs at different locations just repeat steps 1-3.

Will

macro "Move items from bottom of list in the ROI manager" {
        Dialog.create("Move items in the ROI manager");
        Dialog.addNumber("Move the last 'n' items up the ROI list: ",1);
        Dialog.addMessage("Select the ROI where you want them inserted after");
        Dialog.show();
       
        noOfGoodRois=Dialog.getNumber();
        inputROI=roiManager("index");
        totalNoOfRois=roiManager("count");
        noOfRoisToMove=totalNoOfRois-(inputROI+1)-noOfGoodRois;
        currentROI=inputROI+1;
       
        if (inputROI==(-1)) exit("Error: Please select the ROI where you want your new n ROIs to be placed under");
        if (currentROI==totalNoOfRois) exit("Error: select the ROI where you want the new ROIs to be inseted after");
       
        for (j=0;j<noOfRoisToMove;j++) {
                roiManager("Select",currentROI);
                origLabel=getInfo("roi.name");
                roiManager("Add");//creates the same selection at bottom of list
                roiManager("Delete");//deletes the old selection
                roiManager("Select",totalNoOfRois-1);//selects the new entry at bottom of list
                roiManager("Rename",origLabel);
        }
}

<quote author="beijaflor4">
Hello.

for my data analysis I need to list ROIs in temporal order of my experiments. In other words, ROI1 connects to the first experiment, ROI2 to the second one,... and lastROI connects to my last experiment.
Sometimes I realize later that I forgot to add one ROI. I could then still add one to the ROI manager, however, it is then not anymore in the correct temporal order. I usually then delete all ROIs which happened after the forgotten experiment, add the forgotten one and make all the other ones which I deleted. This is VERY annoying though, when I have a long list of ROIs.
Does one of you know how to write a macro or so, with which I can move one selected ROI up or down in the ROI Manager list?

Thanks,
b
Reply | Threaded
Open this post in threaded view
|

Re: ROI manager - change order of rois ?

lechristophe
You can rename ROIs and there is a command to sort them in the ROI
manager. So you could make sure that the sorted order corresponds to
the temporal order (by renaming them) and then sort them to put the
added one at its place. Be carefull that messing with the first number
in the ROI name can have effects on its binding to a particular slice.

Christophe

On Wed, Apr 25, 2012 at 07:27, will.armour <[hidden email]> wrote:

> Hi,
>
> Here is a simple macro that should be able to help. Use is as follows:
> 1. Add your new ROIs which are correct and they should be at the bottom of
> the ROI list.
> 2. Select the ROI before the spot where you want the 'n' items to be moved
> to.
> 3. Enter the number of items need to be moved up.
>
> If you need to insert ROIs at different locations just repeat steps 1-3.
>
> Will
>
> macro "Move items from bottom of list in the ROI manager" {
>        Dialog.create("Move items in the ROI manager");
>        Dialog.addNumber("Move the last 'n' items up the ROI list: ",1);
>        Dialog.addMessage("Select the ROI where you want them inserted after");
>        Dialog.show();
>
>        noOfGoodRois=Dialog.getNumber();
>        inputROI=roiManager("index");
>        totalNoOfRois=roiManager("count");
>        noOfRoisToMove=totalNoOfRois-(inputROI+1)-noOfGoodRois;
>        currentROI=inputROI+1;
>
>        if (inputROI==(-1)) exit("Error: Please select the ROI where you want your
> new n ROIs to be placed under");
>        if (currentROI==totalNoOfRois) exit("Error: select the ROI where you want
> the new ROIs to be inseted after");
>
>        for (j=0;j<noOfRoisToMove;j++) {
>                roiManager(&quot;Select&quot;,currentROI);
>                origLabel=getInfo(&quot;roi.name&quot;);
>                roiManager(&quot;Add&quot;);//creates the same selection at bottom of list
>                roiManager(&quot;Delete&quot;);//deletes the old selection
>                roiManager(&quot;Select&quot;,totalNoOfRois-1);//selects the new entry at
> bottom of list
>                roiManager(&quot;Rename&quot;,origLabel);
>        }
> }
>
> &lt;quote author=&quot;beijaflor4&quot;>
> Hello.
>
> for my data analysis I need to list ROIs in temporal order of my
> experiments. In other words, ROI1 connects to the first experiment, ROI2 to
> the second one,... and lastROI connects to my last experiment.
> Sometimes I realize later that I forgot to add one ROI. I could then still
> add one to the ROI manager, however, it is then not anymore in the correct
> temporal order. I usually then delete all ROIs which happened after the
> forgotten experiment, add the forgotten one and make all the other ones
> which I deleted. This is VERY annoying though, when I have a long list of
> ROIs.
> Does one of you know how to write a macro or so, with which I can move one
> selected ROI up or down in the ROI Manager list?
>
> Thanks,
> b
>
>
> --
> View this message in context: http://imagej.1557.n6.nabble.com/ROI-manager-change-order-of-rois-tp3682185p4915681.html
> Sent from the ImageJ mailing list archive at Nabble.com.