Hi,
I have a bunch of TIFF stacks that I want to open with ImageJ. Each stack has 6000 slices. When I try to open a TIFF stack, it takes about 40 seconds for ImageJ to count how many slices are in the stack. I noticed that if I open a stack with ImageJ, save it, and re-open it, it immediately knows how many slices are in the stack and doesn't have to spend those 40 seconds trying to figure it out. Looking in TiffDecoder.java, I see this is because it reads the number of images/slices from the TIFF description tag and then sets FileInfo nImages to 6000. I tried modifying the code to automatically set nImages to 6000. When I do this, my TIFF stacks open without the 40-second delay. However, the stacks don't open correctly. Only the first slice appears OK, and the subsequent 5999 slices look bad. Does anyone know how I can modify the source to have ImageJ assume there are 6000 slices in every TIFF stack so that I don't have to waste 40 seconds having ImageJ count the slices? Thanks! Andrew |
On Jun 25, 2009, at 4:11 PM, aweitz wrote:
> Hi, > > I have a bunch of TIFF stacks that I want to open with ImageJ. Each > stack > has 6000 slices. When I try to open a TIFF stack, it takes about 40 > seconds > for ImageJ to count how many slices are in the stack. > > I noticed that if I open a stack with ImageJ, save it, and re-open it, > it > immediately knows how many slices are in the stack and doesn't have to > spend > those 40 seconds trying to figure it out. Looking in > TiffDecoder.java, I > see this is because it reads the number of images/slices from the TIFF > description tag and then sets FileInfo nImages to 6000. > > I tried modifying the code to automatically set nImages to 6000. When > I do > this, my TIFF stacks open without the 40-second delay. However, the > stacks > don't open correctly. Only the first slice appears OK, and the > subsequent > 5999 slices look bad. > > Does anyone know how I can modify the source to have ImageJ assume > there are > 6000 slices in every TIFF stack so that I don't have to waste 40 > seconds > having ImageJ count the slices? You could open the stacks using File>Import>Raw. To find the offset (header size), enable debugging in Edit>Options>Misc and use File>Open to open one of the stacks. The offset is the value of the StripOffsets tag. -wayne |
Import->Raw is a very cool feature! I had no idea it existed.
I was able to get things working using Import->Raw, but it wasn't as simple as taking the StripOffsets value from the debug info. My debug info looked like: frame1_e72_25_burst40_60us_dt100ms_thresh_uA_4_6_8_10_12_14_16_19_22_25.tif: opening 256, "ImageWidth", value=502 257, "ImageLength", value=501 258, "BitsPerSample", value=16 259, "Compression", value=1 262, "PhotoInterp", value=1 273, "StripOffsets", value=146, count=126 278, "RowsPerStrip", value=4 279, "StripByteCount", value=650, count=126 282, "XResolution", value=1 283, "YResolution", value=1 296, "ResolutionUnit", value=1 nextIFD=504158 256, "ImageWidth", value=502 257, "ImageLength", value=501 258, "BitsPerSample", value=16 259, "Compression", value=1 262, "PhotoInterp", value=1 273, "StripOffsets", value=504296, count=126 278, "RowsPerStrip", value=4 279, "StripByteCount", value=504800, count=126 282, "XResolution", value=1 283, "YResolution", value=1 296, "ResolutionUnit", value=1 That shows the first two IFDs. There are 6000 in total. You'd think that the "Offset to First Image" would have to be 146, which is the value of the first StripOffsets tag. However, I had to set the first image offset to 1154. I also had to set the "Gap Between Images" to 1146. Not sure why that's the case, but it works now. Thanks Wayne!
|
Free forum by Nabble | Edit this page |