Login  Register

Re: linear translation of stack

Posted by Michael Schmid on Nov 06, 2013; 8:56am
URL: http://imagej.273.s1.nabble.com/linear-translation-of-stack-tp5005448p5005469.html

Hi Arvid,

this is a usual problem in this mailing list: The mailer has introduced a line break in a long line. ImageJ macro statements cannot extend over multiple lines, however.
The following should be one line (I write it as one line, but the mailer may introduce a line break again...)
  run("Translate...", "x="+i*xTranslate+" y="+i*yTranslate+" interpolation=None slice");

Please note that there should be a space between the quotes and the word interpolation.

Michael
________________________________________________________________
On Nov 5, 2013, at 23:20, rosteu wrote:

> hi again,
>
> thanks for a quick response, I'm suspecting that I might have installed the
> macro in the wrong way or something, when I run it I get:
>
> ')' expected in line 13
> <interpolation> = none slice ");"
>
> and no translation of my stack of about ~100 images (2x1k pixels).
>
> the debug window says:
>
> FreeMemory()      496MB of 14991MB (3%)
> nImages()             1
> getTitle()               "tif"
> xTranslate            1
> yTtranslate           0
> i                              1
>
> I didn't want to ask about it until I read up a bit on macros to see if I
> did something wrong, but now that you asked, this is as far as I've gotten..
>
> (I'm using FIJI (ImageJ 1.48a) and Java 1.6.0_65 (64-bit) on a macbook pro
> running OS X 10.9)
>
> /arvid
>
>
> On Tue, Nov 5, 2013 at 9:10 PM, George Patterson-2 [via ImageJ] <
> [hidden email]> wrote:
>
>> Hi Arvid,
>> What's the problem/error?
>> I ran a quick little test on a stack of ~100 images before sending and I
>> thought it worked fine.
>> George
>>
>>
>> On Tue, Nov 5, 2013 at 2:56 PM, rosteu <[hidden email]<http://user/SendEmail.jtp?type=node&node=5005460&i=0>>
>> wrote:
>>
>>> 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] <http://user/SendEmail.jtp?type=node&node=5005460&i=1>>
>> 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]<
>>> http://user/SendEmail.jtp?type=node&node=5005453&i=0>>
>>>> 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
>>>>>
>>>>>


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