Login  Register

Re: Increment option missing in "AVI..." read and "Z Project..." write macros

Posted by Wayne Rasband on Aug 18, 2009; 7:50pm
URL: http://imagej.273.s1.nabble.com/Increment-option-missing-in-AVI-read-and-Z-Project-write-macros-tp3691458p3691460.html

On Aug 17, 2009, at 11:46 PM, Alan Hewat wrote:

> It took me a while, but searching the archives :-) I came across the
> Image>Stacks>Reduce Size command that existed in ImageJ 1.42, but has
> since been removed from the standard distribution :-(
>
> I have re-installed it from
> http://rsb.info.nih.gov/ij/plugins/stack-reducer.html and it is
> perfect for my purposes eg
>
> run("AVI...", "select=D:\\temp\\vdub.avi first=1 last=500");
> run("Reduce Size...", "reduction=10");
>
> I can't see how to do that in standard v1.43  with ImageJ>Adjust Size
> or ImageJ>Scale

You can do this with the v1.43f daily build using the Image>Adjust>Size
command, which now has the ability to resize in the Z dimension. Here
is an example:

    run("AVI...", "select=D:\\temp\\vdub.avi first=1 last=500");
    run("Size...", "depth=50 interpolation=None");

This can be generalized by using variables:

    path = "D:\\temp\\vdub.avi";
    run("AVI...", "select=path");
    size = nSlices/2;
    run("Size...", "depth=size interpolation=None");

The AVI Reader in v1.43f reads all the frames when "first=n1" and
"last=n2" are omitted from the options string.

The macro interpreter no longer requires string concatenation to use
variables in run() calls. The 'path' value following the "select=" key
is assumed to be a variable because it does not contain a period. The
'size' value following the "depth=" key is assumed to be a variable
because it is not a number. You can force the interpreter to always
treat a value as a variable by preceding it with '&', for example:

    size = nSlices*2;
    method = "Bilinear";
    run("Size...", "depth=&size interpolation=&method");

-wayne


> Wayne wrote 2 June:
>> The Image>Adjust Size and Image>Scale commands in v1.43
>> will be able to scale in the z dimension.
>
> BTW I found the archives at http://n2.nabble.com/ImageJ-f588099.html
> easier to use than those at https://list.nih.gov/archives/imagej.html
>
> 2009/8/17 Alan Hewat <[hidden email]>:
>> Creating a stack using "Image Sequence..." has the useful "Increment"
>> option that imports only every Nth image.
>>
>> Creating a stack using "AVI..." does NOT have this "Increment" option,
>> but only accepts the First and Last Frame to import.
>>
>> After importing the avi I want to sum the frames using "Z Project...",
>> which also doesn't have an Increment option :-)
>>
>> So how can I open an avi file and sum every Nth frame ?
>>
>> Explanation: my camera's PAL output is captured as an avi file at 25
>> fps using Vdub, but since the camera integrates N frames internally,
>> only every Nth frame is different. This is not a problem if I output
>> the "Average Intensity" with "Z Project..." to create an 8-bit
>> average, but I would like also to "Sum Slices" to create a 32-bit sum.
>> If there are lots of duplicate frames, the sum can overflow the
>> resulting 32-bit TIF file. Yes, I could average every N-frames, create
>> a new stack, and then sum these averages, but that seems rather
>> inelegant :-)
>>
>> Alan.
>> ______________________________________________
>> Dr Alan Hewat, NeutronOptics, Grenoble, FRANCE
>> <[hidden email]> +33.476.98.41.68
>>        http://www.NeutronOptics.com/hewat
>> ______________________________________________
>>
>
>
>
> --
> ______________________________________________
> Dr Alan Hewat, NeutronOptics, Grenoble, FRANCE
> <[hidden email]> +33.476.98.41.68
>         http://www.NeutronOptics.com/hewat
> ______________________________________________
>