(This topic gas been transferred from the mailing list, at Brad’s suggestion)
I’ve been encountering strange results when reading a big 2D RGB tiff that was generated by running tiffsplit on a huge 3D LSM file (from a Zeiss microscope). tiffsplit also extracts the thumbnails for each slice. The LSM file is 50 GB, one 2D slice is 127 MB. tiffinfo gives this output:
I can view a 2D slice file with ImageJ, and the three channels all make sense.
I have code to open the slice image in two ways, ReadRGB reads it as Image and ReadVectorImage reads it as VectorImage.
ReadRGB gives the max R,G,B values as 16 16 16
ReadVectorImage says NumberOfComponentsPerPixel=4, and max RGB = 16 0 0
I’m not sure what is the correct way to read this file, or if either of my programs is error-free.
The file size is consistent with 3 channels of 16-bits, i.e. 48 bits per pixel. Irfanview says that there are 48 bits per pixel, but the display is all black.
Imagemagick’s convert can extract three tiffs, each 16 bpp and 1/3 of the size of the original file, with:
After some peculiar install problems, I was able to build and install ITK 4.12.2. The effort was a waste of time, though, because the my two test programs still generate wrong results when reading my test RGB tiff. I’m willing to delve into the code (in my amateurish way), but I’d appreciate advice about where to look.
Does the problem also occur with 127MB slice, or only with the full 3D image? If so, share it and I could try to use your example programs and debug it.
One option is to share the image on data.kitware.com. Once you register for an account there, it has a limited amount of upload space associated with the account.
No, I don’t try to do anything with the 50 GB LSM file, I don’t have access to any machine that can load such a big file (even if the software understands LSM). I split the LSM file into 396 tiffs with tiffsplit, xaas.tif is one of the 127 MB tiff files. (By the way, I meant I could delve into the ITK library code, under the assumption that my code is OK - possibly a bad assumption.)
I am attaching it to this post, compressed as xaas.rar.
And thanks!
…
I don’t see the file that I uploaded. Could it be too big? It’s 57 MB. I see that Matt has just told me I can use data.kitware.com. I’ll do that now.
Three of my posts above have been hidden. I got three emails like this:
This is an automated message from ITK to let you know that your post was hidden.
(URL of the post)
Your post was flagged as spam: the community feels it is an advertisement, something that is overly promotional in nature instead of being useful or relevant to the topic as expected.
Multiple community members flagged this post before it was hidden, so please consider how you might revise your post to reflect their feedback. You can edit your post after 10 minutes, and it will be automatically unhidden.
However, if the post is hidden by the community a second time, it will remain hidden until handled by staff.
Would one of the community members who flagged my post as spam please explain why.
The Discourse system user was automatically flagging the post because it contained multiple links to the same domain. I changed this setting so it does not flag the unless there are 10 or more links instead of the default of just 3. I also improved the Post Hidden email message you received to indicate that it could come from the system instead of community members, and to reach out if there was an error.
Sorry again for the confusion. Thanks for letting me know there was an issue.
?Sorry, Dzenan, I didn’t know there was a private/public distinction. There is no help info on that site. The file I uploaded doesn’t seem to be there at all now, anyway. I have uploaded it again to my public collection.
Thanks for your help
…
Although I uploaded to my public collection, I just checked and found that I still needed to set the file access to public (which I have now done). I don’t understand what a public collection is, if you still have to set the access.
Sorry to come in late.
There does appear to be a problem with the tiff reader - for some reason the component type gets set to unsigned_char - see the bottom of this dump:
ImageFileReader (0x2140d10)
RTTI typeinfo: itk::ImageFileReader<itk::Image<itk::RGBPixel, 2u>, itk::DefaultConvertPixelTraits<itk::RGBPixel > >
Reference Count: 2
Modified Time: 56
Debug: Off
Object Name:
Observers:
none
Inputs:
FileName: (0x2147a40)
Primary: (0)
Indexed Inputs:
0: Primary (0)
No Required Input Names
NumberOfRequiredInputs: 0
Outputs:
Primary: (0x21476a0)
Indexed Outputs:
0: Primary (0x21476a0)
NumberOfRequiredOutputs: 1
Number Of Threads: 8
ReleaseDataFlag: Off
ReleaseDataBeforeUpdateFlag: Off
AbortGenerateData: Off
Progress: 1
Multithreader:
RTTI typeinfo: itk::MultiThreader
Reference Count: 1
Modified Time: 40
Debug: Off
Object Name:
Observers:
none
Thread Count: 8
Global Maximum Number Of Threads: 128
Global Default Number Of Threads: 8
ImageIO:
TIFFImageIO (0x214cf20)
RTTI typeinfo: itk::TIFFImageIO
Reference Count: 1
Modified Time: 204
Debug: Off
Object Name:
Observers:
none
AbortGenerateData: Off
Progress: 0
FileName: xaas.tif
FileType: TypeNotApplicable
ByteOrder: OrderNotApplicable
IORegion:
ImageIORegion (0x214cfb8)
Dimension: 2
Index: 0 0
Size: 4656 4656
Number of Components/Pixel: 4
Pixel Type: rgba
Component Type: unsigned_char
Dimensions: ( 4656 4656 )
Origin: ( 0 0 )
UseCompression: Off
UseStreamedReading: On
UseStreamedWriting: Off
ExpandRGBPalette: On
IsReadAsScalarPlusPalette: False
Compression: 1
JPEGQuality: 75
UserSpecifiedImageIO flag: 0
m_UseStreaming: 1
How did you generate this dump, Richard?
Do you have an idea about where this error is likely to be occurring? I’m willing to look at the code, if nobody with more expertise volunteers to do it.
OK,
I think I’ve tracked it down. This image has separate colour planes :
TIFFTAG_PLANARCONFIG = PLANARCONFIG_SEPARATE
The CanRead method checks for PLANARCONFIG_CONTIG, and is thus returning a failed state, leading to all sorts of problems setting up pixel types etc. The original setting of unsigned short pixels gets set back to unsigned char, and the number of components is set to 4. The idea is to use TIFFReadRGBAImageOriented, but it is only set up to use UCHAR pixels