Converting multilayer grayscale tiff images to JPG2000

7 visualizzazioni (ultimi 30 giorni)
New to Matlab so I hope someone can help. I do most of my image analysis/processing in Fiji/ImageJ. I am looking for a way to convert Tiff image stacks (single tiff files with 4 to 7 images, grayscale, 8bit, made with Fiji) to JPEG2000 files. I can read and write RGB tif and jp2 files using imload and imwrite but these commands do not work on stacks. However, when I try an load tif stacks using the Tiff class I get the following:
ts = Tiff('BrainStack.tif', 'r');
I get the following errors
Warning: TIFF library warning - 'TIFFReadDirectory: Unknown field with tag 50838 (0xc696) encountered.' Warning: TIFF library warning - 'TIFFReadDirectory: Unknown field with tag 50839 (0xc697) encountered.'
I can use the following code to load each layer of the image.
for k = 1:7
I(:,:,k) = imread('BrainStack.tif', k);
end
However once loaded I can not save the images as jp2. I have also not been able to save them as new tif files, I assume I'm not setting one of the tags correctly but not sure which.
So is it even possible to convert multi layer grayscale tif stacks to JPG2000? And any idea what i'm doing wrong trying to write these files back to tif files.
Thanks for any guidance.
Ron

Risposte (1)

Ashish Uthama
Ashish Uthama il 24 Apr 2013
The warning is telling you that there was some tag in the file that the reader could not interpret. It is most likely some custom metadata, and your pixel values ought to be fine.
JP2 write support is currently limited to either 1 or 3 (RGB) channels. You could consider multiple 1 channel JP2 files.
Consider updating the question with where you are stuck with writing out a tiff file to get some help there. (also look at this example to get started)

Categorie

Scopri di più su Convert Image Type in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by