re position ROIs at certain stacks

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

re position ROIs at certain stacks

PabloSAguilar
Hi,
I have a time series with 50-100 cells and I need to monitor fluorescence at a particular spot within each cell.
I manually define an ROI within each cell for this. Most of them work fine over the entire time series but (because some cells move) other ROIs are shifted away from their targets.
Thus, I am wondering if there is a plugin to re-position an ROI at certain stacks according to need.
Thanks!
Pablo
Reply | Threaded
Open this post in threaded view
|

Re: re position ROIs at certain stacks

Jacob Keller
Yes!

I have this same question, and feel this should be a relatively easy thing
to do (track cells over time, do intensity measurements thereupon), but I
have not found the right combination of features to do this. So please copy
me on any private responses if you are willing.

Thanks,

Jacob Keller


On Mon, Feb 3, 2014 at 12:22 PM, PabloSAguilar <[hidden email]
> wrote:

> Hi,
> I have a time series with 50-100 cells and I need to monitor fluorescence
> at
> a particular spot within each cell.
> I manually define an ROI within each cell for this. Most of them work fine
> over the entire time series but (because some cells move) other ROIs are
> shifted away from their targets.
> Thus, I am wondering if there is a plugin to re-position an ROI at certain
> stacks according to need.
> Thanks!
> Pablo
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/re-position-ROIs-at-certain-stacks-tp5006379.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
*******************************************

Jacob Pearson Keller, PhD

Looger Lab/HHMI Janelia Farms Research Campus

19700 Helix Dr, Ashburn, VA 20147

email: [hidden email]

*******************************************

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: re position ROIs at certain stacks

gankaku
In reply to this post by PabloSAguilar
Hi Pablo, hi Jacob

potentially you can check the following macro. It might do, what you need.
I simply put it together quickly, so if there is a problem contact me again.

What you have to do:

1.) draw the ROI you want to put into the image
2.) choose the color of the ROI using the color picker tool
3.) run the macro I attached here
4.) go through your slices and if you need to manually move a selection do the following
     5.) keep [Alt] pressed and click inside your ROI (thus you reactivate it
     6.) move it or change its appearance
     7.) click somewhere outside the ROI to add it back to the overlay layer
     8.) press Ok in the small dialog box

--> This will add all the ROIs to teh ROI-Manager and using this one you can select >More >Multi Measure with the choice to measure all slices active and you will get the analyses of all the ROIs in all slices in teh results table.


Macro code:

/**Macro written by Jan Brocher/BioVoxxel
 * NO WARRENTY of functionality and no liability for any damages.
 */

getDimensions(width, height, channels, slices, frames);
Dialog.create("ROI setup");
        Dialog.addChoice("label:", newArray( "frames", "slices", "channels"), "frames");
        Dialog.show();
        dimension = Dialog.getChoice();

color = toHex(getValue("rgb.foreground"));

run("Overlay Options...", "stroke="+color+" width=0 fill=none set");

setBatchMode(true);
if(dimension=="frames") {
        if(frames<2) {
                exit("no multiple frames available");
        } else {
                toLabel = frames;
        }
} else if(dimension=="slices") {
        if(slices<2) {
                exit("no multiple slices available");
        } else {
                toLabel = slices;
        }
} else if(dimension=="channels") {
        if(channels<2) {
                exit("no multiple channels available");
        } else {
                toLabel = channels;
        }
}

roiManager("reset");
for(i=1; i<=toLabel; i++) {
        if(dimension=="frames") {
                Stack.setFrame(i);
        } else if(dimension=="slices") {
                Stack.setSlice(i);
        } else if(dimension=="channels") {
                Stack.setChannel(i);
        }


        run("Add Selection...");
}

//reset Stack position
if(dimension=="frames") {
                Stack.setFrame(1);
} else if(dimension=="slices") {
                Stack.setSlice(1);
} else if(dimension=="channels") {
                Stack.setChannel(1);
}

setBatchMode(true);
//enable manual adjustments to the individual ROIs
waitForUser("adjust overlays and press Ok");
run("To ROI Manager");
exit();

//end of macro---------------------------------------------

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: re position ROIs at certain stacks

Krs5
I had thought about this in the past while doing FRAP experiments and after the start of this macro by Jan Brocher have used his code as basis for a macro that when you move the ROI it automatically updates the ROI for all following images in the stack and moves automatically to the next image in the stack.

You can change the sensitivity of the repositioning of the ROI by changing the wait(350) at line 61 of the code.

Not extensively tested but seems to work.

Best wishes

Kees

Dr Ir K.R. Straatman
Senior Experimental Officer
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif (notice new website!)




-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Jan Brocher - BioVoxxel
Sent: 04 February 2014 10:10
To: [hidden email]
Subject: Re: re position ROIs at certain stacks

Hi Pablo, hi Jacob

potentially you can check the following macro. It might do, what you need.
I simply put it together quickly, so if there is a problem contact me again.

What you have to do:

1.) draw the ROI you want to put into the image
2.) choose the color of the ROI using the color picker tool
3.) run the macro I attached here
4.) go through your slices and if you need to manually move a selection do the following
     5.) keep [Alt] pressed and click inside your ROI (thus you reactivate it
     6.) move it or change its appearance
     7.) click somewhere outside the ROI to add it back to the overlay layer
     8.) press Ok in the small dialog box

--> This will add all the ROIs to teh ROI-Manager and using this one you can select >More >Multi Measure with the choice to measure all slices active and you will get the analyses of all the ROIs in all slices in teh results table.


Macro code:

/**Macro written by Jan Brocher/BioVoxxel
 * NO WARRENTY of functionality and no liability for any damages.
 */

getDimensions(width, height, channels, slices, frames); Dialog.create("ROI setup");
        Dialog.addChoice("label:", newArray( "frames", "slices", "channels"), "frames");
        Dialog.show();
        dimension = Dialog.getChoice();

color = toHex(getValue("rgb.foreground"));

run("Overlay Options...", "stroke="+color+" width=0 fill=none set");

setBatchMode(true);
if(dimension=="frames") {
        if(frames<2) {
                exit("no multiple frames available");
        } else {
                toLabel = frames;
        }
} else if(dimension=="slices") {
        if(slices<2) {
                exit("no multiple slices available");
        } else {
                toLabel = slices;
        }
} else if(dimension=="channels") {
        if(channels<2) {
                exit("no multiple channels available");
        } else {
                toLabel = channels;
        }
}

roiManager("reset");
for(i=1; i<=toLabel; i++) {
        if(dimension=="frames") {
                Stack.setFrame(i);
        } else if(dimension=="slices") {
                Stack.setSlice(i);
        } else if(dimension=="channels") {
                Stack.setChannel(i);
        }


        run("Add Selection...");
}

//reset Stack position
if(dimension=="frames") {
                Stack.setFrame(1);
} else if(dimension=="slices") {
                Stack.setSlice(1);
} else if(dimension=="channels") {
                Stack.setChannel(1);
}

setBatchMode(true);
//enable manual adjustments to the individual ROIs waitForUser("adjust overlays and press Ok"); run("To ROI Manager"); exit();

//end of macro---------------------------------------------

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Move_ROI3.txt (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: re position ROIs at certain stacks

gankaku
In reply to this post by PabloSAguilar
Hi Kees,

Nice improvement!
one more suggestion to that (since I don't find the time to do it at the moment in the code):

Using your macro and changing the ROI position directly moves on to the next slide even without "confirming" the acceptance of the repositioning by adding the overly back due to clciking outside it. This might lead to problems when you would need to reposition the same ROI with several trials.
Thus, I would suggest to run the update on the ROIs after the acceptance of the changes by a fina click outside the ROI and then move to the next slice.

cheers,
Jan

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: re position ROIs at certain stacks

Jacob Keller
In reply to this post by Krs5
But can the ROI repositioning be done automatically by somehow calling one
of the tracking algorithms? I have 1000s-frame stacks with tens to hundreds
of discrete cells to be tracked.

I often have this experience with imageJ/FIJI that there are things which
are incredibly simple in theory to do, but sifting through all of the
plugins and very fancy and sometimes specialized programs takes a long
time, and one often finds only workarounds. Don't a lot of people track
cells while measuring their brightness or ratios or whatever?

JPK


On Tue, Feb 4, 2014 at 11:39 AM, Straatman, Kees (Dr.) <[hidden email]
> wrote:

> I had thought about this in the past while doing FRAP experiments and
> after the start of this macro by Jan Brocher have used his code as basis
> for a macro that when you move the ROI it automatically updates the ROI for
> all following images in the stack and moves automatically to the next image
> in the stack.
>
> You can change the sensitivity of the repositioning of the ROI by changing
> the wait(350) at line 61 of the code.
>
> Not extensively tested but seems to work.
>
> Best wishes
>
> Kees
>
> Dr Ir K.R. Straatman
> Senior Experimental Officer
> Centre for Core Biotechnology Services
> University of Leicester
>
> http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif(notice new website!)
>
>
>
>
> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Jan
> Brocher - BioVoxxel
> Sent: 04 February 2014 10:10
> To: [hidden email]
> Subject: Re: re position ROIs at certain stacks
>
> Hi Pablo, hi Jacob
>
> potentially you can check the following macro. It might do, what you need.
> I simply put it together quickly, so if there is a problem contact me
> again.
>
> What you have to do:
>
> 1.) draw the ROI you want to put into the image
> 2.) choose the color of the ROI using the color picker tool
> 3.) run the macro I attached here
> 4.) go through your slices and if you need to manually move a selection do
> the following
>      5.) keep [Alt] pressed and click inside your ROI (thus you reactivate
> it
>      6.) move it or change its appearance
>      7.) click somewhere outside the ROI to add it back to the overlay
> layer
>      8.) press Ok in the small dialog box
>
> --> This will add all the ROIs to teh ROI-Manager and using this one you
> can select >More >Multi Measure with the choice to measure all slices
> active and you will get the analyses of all the ROIs in all slices in teh
> results table.
>
>
> Macro code:
>
> /**Macro written by Jan Brocher/BioVoxxel
>  * NO WARRENTY of functionality and no liability for any damages.
>  */
>
> getDimensions(width, height, channels, slices, frames); Dialog.create("ROI
> setup");
>         Dialog.addChoice("label:", newArray( "frames", "slices",
> "channels"), "frames");
>         Dialog.show();
>         dimension = Dialog.getChoice();
>
> color = toHex(getValue("rgb.foreground"));
>
> run("Overlay Options...", "stroke="+color+" width=0 fill=none set");
>
> setBatchMode(true);
> if(dimension=="frames") {
>         if(frames<2) {
>                 exit("no multiple frames available");
>         } else {
>                 toLabel = frames;
>         }
> } else if(dimension=="slices") {
>         if(slices<2) {
>                 exit("no multiple slices available");
>         } else {
>                 toLabel = slices;
>         }
> } else if(dimension=="channels") {
>         if(channels<2) {
>                 exit("no multiple channels available");
>         } else {
>                 toLabel = channels;
>         }
> }
>
> roiManager("reset");
> for(i=1; i<=toLabel; i++) {
>         if(dimension=="frames") {
>                 Stack.setFrame(i);
>         } else if(dimension=="slices") {
>                 Stack.setSlice(i);
>         } else if(dimension=="channels") {
>                 Stack.setChannel(i);
>         }
>
>
>         run("Add Selection...");
> }
>
> //reset Stack position
> if(dimension=="frames") {
>                 Stack.setFrame(1);
> } else if(dimension=="slices") {
>                 Stack.setSlice(1);
> } else if(dimension=="channels") {
>                 Stack.setChannel(1);
> }
>
> setBatchMode(true);
> //enable manual adjustments to the individual ROIs waitForUser("adjust
> overlays and press Ok"); run("To ROI Manager"); exit();
>
> //end of macro---------------------------------------------
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--
*******************************************

Jacob Pearson Keller, PhD

Looger Lab/HHMI Janelia Farms Research Campus

19700 Helix Dr, Ashburn, VA 20147

email: [hidden email]

*******************************************

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: re position ROIs at certain stacks

Krs5
In reply to this post by gankaku
Hi Jan,

OK, took a little more time than I had planned but the attached macro allows you to move the ROI and confirm with a left mouse click outside the ROI its position what will update the positions in the ROI manager of this and all following ROIs.

As before not extensively tested but it seems to work.

Best wishes

Kees


Dr Ir K.R. Straatman
Senior Experimental Officer
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif 


-----Original Message-----
From: Jan Brocher - BioVoxxel [mailto:[hidden email]]
Sent: 04 February 2014 17:36
To: [hidden email]; Straatman, Kees (Dr.)
Subject: Re: re position ROIs at certain stacks

Hi Kees,

Nice improvement!
one more suggestion to that (since I don't find the time to do it at the moment in the code):

Using your macro and changing the ROI position directly moves on to the next slide even without "confirming" the acceptance of the repositioning by adding the overly back due to clciking outside it. This might lead to problems when you would need to reposition the same ROI with several trials.
Thus, I would suggest to run the update on the ROIs after the acceptance of the changes by a fina click outside the ROI and then move to the next slice.

cheers,
Jan


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Move_ROI3b.txt (4K) Download Attachment