Re: Open every nth image in a stack?
Posted by
Michael Herron on
Nov 22, 2005; 7:48pm
URL: http://imagej.273.s1.nabble.com/Open-every-nth-image-in-a-stack-tp3704402p3704411.html
Wayne,
Ok...so I ran ImageJ in the Debug mode and got:
273, "StripOffsets", value=100600808, count=126
I used 126 in the macro using my image's height and width like this
run("Raw...", "width=1004 height=1002 offset=126 number=10 gap=0")
BUT the images were shifted to the right a bit.
So I tried to decrease the offset and that seemed to help, but on a
whim I used your example offset of 768 and "wallah" it worked fine.
WHY?
Mike
On Nov 22, 2005, at 12:04 PM, Wayne Rasband wrote:
>> How do I find the offset in a tiff stack?
>
> It is the value of tag 273 (StripOffsets), which you find by
> opening the stack in ImageJ with "Debug Mode" checked in
> Edit>Options>Misc.
>
> -wayne
>
>
>> On Nov 22, 2005, at 10:44 AM, Wayne Rasband wrote:
>>
>> >> I am generating very large stacks and it would often be useful
>> >> when importing a stack of images to only open a subset of
>> >> the stack. Such as the first 100 slices or every third slice.
>> >> Is there a way to do this?
>> >
>> > You may be able to do this using the File>Import>Raw command if the
>> > images are uncompressed TIFFs, you know the offset to the first
>> > image, and the images are stored consecutively. For example, you
>> > can import the first 10 slices of a 100 slice stack of 512x512 16-
>> > bit images using the macro
>> >
>> > run("Raw...", "width=512 height=512 offset=768 number=10 gap=0")
>> >
>> > You can import every third slice using the macro
>> >
>> > run("Raw...", "width=512 height=512 offset=768 number=33
>> > gap=1048576")
>> >
>> > These macros assumes the TIFF stack was created by ImageJ, where
>> > the offset to the start of the image data is always 768. To import
>> > every third slice the gap must be set to 512*512*2*2 (1048576).
>> >
>> > -wayne
>> >
>