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 ______________________________________________ |
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 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 ______________________________________________ |
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 > ______________________________________________ > |
That's perfect ! Thanks Wayne. Yes, I prefer to use a function in the
standard distribution (1.43f onwards) rather than ask my users to download a special plugin. But I wonder how Adjust>Size reduces the stack to a specific number of frames like 50 if the original stack contains an odd number like 483 rather than 500 ? With Stack Reduce it is clear, since that just divides the number of frames by a factor like 10, so the result is then 483/10 = 48. Finally, VirtualDub always drops a few frames, and perhaps because the resulting AVI is interleaved (?) "Avi..." only seems to read about half the frames that ImageJ reports the vdub AVI file to contain. I have described my efforts so far on http://www.neutronoptics.com/vdubcap.html#vdubcap Thanks again, Alan. 2009/8/18 Wayne Rasband <[hidden email]>: > 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 >> ______________________________________________ >> > -- ______________________________________________ Dr Alan Hewat, NeutronOptics, Grenoble, FRANCE <[hidden email]> +33.476.98.41.68 http://www.NeutronOptics.com/hewat ______________________________________________ |
On Aug 18, 2009, at 4:32 PM, Alan Hewat wrote:
> That's perfect ! Thanks Wayne. Yes, I prefer to use a function in the > standard distribution (1.43f onwards) rather than ask my users to > download a special plugin. > > But I wonder how Adjust>Size reduces the stack to a specific number of > frames like 50 if the original stack contains an odd number like 483 > rather than 500 ? With Stack Reduce it is clear, since that just > divides the number of frames by a factor like 10, so the result is > then 483/10 = 48. Image>Adjust>Size reduces a stack the same way the Stack Reducer plugin does as long as you select "None" as the Interpolation Method. It calculates the reduction factor by dividing the number of frames in the stack by the "Depth" value you enter, and truncating. In the case of a 483 frames stack, it uses a reduction factor of 10 if you enter 48 (483/10) as the "Depth" value, and you end up with a 49 frame stack. -wayne > Finally, VirtualDub always drops a few frames, and perhaps because the > resulting AVI is interleaved (?) "Avi..." only seems to read about > half the frames that ImageJ reports the vdub AVI file to contain. > > I have described my efforts so far on > http://www.neutronoptics.com/vdubcap.html#vdubcap > > Thanks again, Alan. > > 2009/8/18 Wayne Rasband <[hidden email]>: >> 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 >>> ______________________________________________ >>> >> > > > > -- > ______________________________________________ > Dr Alan Hewat, NeutronOptics, Grenoble, FRANCE > <[hidden email]> +33.476.98.41.68 > http://www.NeutronOptics.com/hewat > ______________________________________________ > |
Free forum by Nabble | Edit this page |