Login  Register

rotate stack around point

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

rotate stack around point

radioradio
7 posts
Hi, is it possible to rotate a stack around a xyz point? If yes, how?
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: rotate stack around point

John Oreopoulos
117 posts
Try the 3D Viewer plugin:

http://rsbweb.nih.gov/ij/plugins/3d-viewer/index.html
http://3dviewer.neurofly.de/

Cheers,

John Oreopoulos
Research Assistant
Spectral Applied Research
Richmond Hill, Ontario
Canada
www.spectral.ca


On 2011-08-30, at 3:45 PM, radioradio wrote:

> Hi, is it possible to rotate a stack around a xyz point? If yes, how?
>
>
> --
> View this message in context: http://imagej.588099.n2.nabble.com/rotate-stack-around-point-tp6743703p6743703.html
> Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: rotate stack around point

radioradio
7 posts
Thanks John!

My problem is that the stack should rotate around a point selection by an angle and show a slice with the point in it's center. I also tried the great Reorient3TP, but somehow I don't get it right. Maybe it's my lack of geometry knowledge?
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: rotate stack around point

dscho
1631 posts
Hi radio,

On Thu, 15 Sep 2011, radioradio wrote:

> My problem is that the stack should rotate around a point selection by
> an angle and show a slice with the point in it's center. I also tried
> the great Reorient3TP, but somehow I don't get it right. Maybe it's my
> lack of geometry knowledge?

Probably the best idea is to extend the canvas to an appropriate size
first. Something like this should get you started with a macro to do what
you want:

-- snipsnap --
getSelectionCoordinates(x, y);
width = getWidth();
height = getHeight();

if (x[0] != width / 2 || y [0] != height / 2) {
        offsetX = 0;
        halfWidth = width - x[0];
        if (halfWidth < x[0]) {
                halfWidth = x[0];
        }
        else {
                offsetX = halfWidth - x[0];
        }

        offsetY = 0;
        halfHeight = height - y[0];
        if (halfHeight < y[0]) {
                halfHeight = y[0];
        }
        else {
                offsetY = halfHeight - y[0];
        }

        run("Select All");
        run("Copy");
        title = getTitle();
        getMinAndMax(min, max);

        newImage(title, "32-bit", 2 * halfWidth, 2 * halfHeight, 1);
        makeRectangle(offsetX, offsetY, width, height);
        run("Paste");
        setMinAndMax(min, max);
        run("Select None");
}

run("Rotate... ", "angle=30");
makePoint(getWidth() / 2, getHeight() / 2);
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: rotate stack around point

radioradio
7 posts
Wow! Excellent idea! I started with your macro and ended up like this:

// translate stack or slice to center on point pox,poy, create centered stack, then jump to slice no. poz

getSelectionCoordinates(pox, poy);
poz = getSliceNumber();
width = getWidth();
height = getHeight();
NumberOfSlices = nSlices;

translx = (width/2 - pox [0]);
transly = (height/2 - poy [0]);

run("Duplicate...", "title=centered duplicate range=1-nSlices");
run("Translate...", "x=translx y=transly interpolation=None stack");
setSlice(poz);
makePoint(getWidth() / 2, getHeight() / 2);



now i would like to reorient my centered stack around this point along a line between two given xyz-points. in Reorient3 TP i tried to import three "pick points" into the results table and use them, but the plugin still tells me to pick 3 points first :(( any ideas?
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: rotate stack around point

radioradio
7 posts
Reorient3 TP uses the 3 points as a plane, i somehow need to recalculate...