Better way to read number of images in a TIFF stack
jjweimer
I discovered the code to read the number of images in a stack. Thank you!
Could we have a way to do this that avoids the explicit need to create and then kill a temporary directory for the tags that we do not want to store. Two options (using the C or perhaps better the RTIO flag) come to mind.
ImageLoad/C=0/T=TIFF/RTIO/P=imgPath fname
print V_numImages
ImageLoad/C=-1/T=TIFF/RTIO=0/P=imgPath fname
print V_numImages
print V_numImages
ImageLoad/C=-1/T=TIFF/RTIO=0/P=imgPath fname
print V_numImages
Oops! Sorry. The C=0 approach is not viable since stack numbers are zero based. In any case, the RTIO=0 approach is clearer to mean read the tags only but do not store the tags.
June 7, 2019 at 06:07 pm - Permalink
Another update here. The correct method to determine the number of images in a stack appears to be with the code change below. Note the difference in C=0 rather than C=-1.
The modification that would be useful to just determine the number of stacks without reading the tags is this.
June 8, 2019 at 06:04 am - Permalink
There is another topic here which might be pertinent.
https://www.wavemetrics.com/forum/general/read-number-frames-tiff-stack…
June 8, 2019 at 08:07 am - Permalink
Yes, I found that code as well, especially since I am also interested in this possibility ...
My image files have useful meta-information stored either in the additional (non-base) TIFF tags or in a non-tag field. I have some testing to do exactly with the code that you reference.
June 8, 2019 at 02:42 pm - Permalink
My explorations are done. I again note a mistake in the help files.
I also again ask for an easier way to just read the number of pages in a multipage file ...
Finally, I learned that all parts of the multipage TIFF tags are being read fully. My TIFF images are not as complex as I thought (the TIFFTagReader code was not working properly for multi-page images and I correspondingly misread the results compared to those from using the /RAT tag). My mistake ... /RTIO=2 is not needed.
June 13, 2019 at 05:02 pm - Permalink