Login  Register

Re: linear translation of stack

Posted by rosteu on Nov 05, 2013; 7:55pm
URL: http://imagej.273.s1.nabble.com/linear-translation-of-stack-tp5005448p5005459.html

Thank you so much George, I haven't gotten it to work yet, but I'm trying to figure it out - it's exactly what I need!
/Arvid


On Tue, Nov 5, 2013 at 5:05 PM, George Patterson-2 [via ImageJ] <[hidden email]> wrote:
Hi Arvid,
The little macro below should do the trick.
In ImageJ, just open a text window and paste into the window.  In Fiji,
open a new Script, select ImageJ macro as the language and paste the text
into the window.
Edit the xTranslate and yTranslate as necessary.  Open your stack and Run
Macro.
FYI, if you go to Plugins>Macros>Record, you can find the commands to run
ImageJ's functions and put these into a simple macro.  For your purposes,
it just needed to be put into a loop to run through the stack and edited to
use n, 2n, 3n, etc.
George



//Stack needs to be open

xTranslate=1;
yTranslate=0;
/*Translate a stack of images so that the first image is moved n
pixels in the X direction, the second moved 2n pixels, the third 3n pixels
and so on..
the variable "n" is represented by xTranslate and yTranslate
*/


for(i=1;i<=nSlices;i++){
setSlice(i);
run("Translate...", "x="+i*xTranslate+" y="+i*yTranslate+"
interpolation=None slice");
}




On Mon, Nov 4, 2013 at 6:17 PM, rosteu <[hidden email]> wrote:

> hi,
> I'm new, so please forgive me if this is a stupid question:
>
> I want to translate a stack of images so that the first image is moved n
> pixels in the X direction, the second moved 2n pixels, the third 3n pixels
> and so on..
>
> the tool image>transform>translate does exactly what I need, but each of my
> experiments contains >1000 images in a stack, so doing it manually for each
> image isn't really an option..
> I don't need any fancy content based registration, only a simple
> progressive
> linear movement of each slice where I can specify how many pixels the
> images
> will be moved per slice.
>
> any ideas much appreciated!
> arvid
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/linear-translation-of-stack-tp5005448.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/linear-translation-of-stack-tp5005448p5005453.html
To unsubscribe from linear translation of stack, click here.
NAML