flip ROI selection

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

flip ROI selection

Liz Bless
Hello - I have images of brain sections - sometimes the right hemisphere and sometimes the left hemisphere. I have an ROI that I would like to analyze. How can I get my ROI from the left hemisphere to flip (not rotate) so that it fits onto the right hemisphere? In other words I would like a mirror image of the ROI I have made. Any advice would be very helpful!
Thank you

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

Re: flip ROI selection

Василий Попков
Maybe it would be easier to mirior image itself?

2014-12-06 18:27 GMT+03:00 Liz Bless <[hidden email]>:

> Hello - I have images of brain sections - sometimes the right hemisphere
> and sometimes the left hemisphere. I have an ROI that I would like to
> analyze. How can I get my ROI from the left hemisphere to flip (not rotate)
> so that it fits onto the right hemisphere? In other words I would like a
> mirror image of the ROI I have made. Any advice would be very helpful!
> Thank you
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: flip ROI selection

Tiago Ferreira-2
In reply to this post by Liz Bless
Dear Liz,

On Dec 6, 2014, at 10:27, Liz Bless <[hidden email]> wrote:
> I would like a mirror image of the ROI I have made.

The two macros below would do it:
Install them, create a selection, and press F1/F2 to obtain dorsal-caudal/ventral-dorsal mirrors of the active ROI.

These used to be present in earlier versions of the ROI Manager Tools[1], but somehow got removed as were deemed
too specific (they were mainly used for manual quantification of in-situ slices). They could be re-introduced if
you think they are of broader scope. In that case, they would be made available through the BAR update site[2].

To install: Copy the snippet below, paste it into ImageJ, then used the Install command in the editor window.

Hope it helps,
-tiago

[1] http://imagej.net//plugins/roi-manager-tools/
[2] http://fiji.sc/BAR


// Begin of snippet
macro "Contralateral in X [F1]" {
        mirrorROI(-1, 1);
}
macro "Contralateral in Y [F2]" {
        mirrorROI(1, -1);
}

function mirrorROI(fx, fy) {
        roi = selectionType();
        if (roi>8 || roi<0)
                exit("Cannot mirror current selection");
        getSelectionBounds(x, y, width, height);
        originalX = x;
        originalY = y;
        getSelectionCoordinates(x, y);
        aX= newArray(x.length);
        aY= newArray(x.length);
        for (i=0; i<x.length; i++) {
                aX[i] = fx*x[i];
                aY[i] = fy*y[i];
        }
        makeSelection(roi, aX, aY);
        setSelectionLocation(originalX, originalY);
}
// End of snippet

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