How do I write individual 'labels' for each slice (e.g. ImageJ) of a multi-page TIF in Matlab?

10 visualizzazioni (ultimi 30 giorni)
Hello!
I am working with some multi-page TIF files in Matlab, and have been able to successfully create multi-page TIFs by using the imwrite(img, filename, 'writemode', 'append') command.
f_identifier=('*_spot_*.tif');
f_list=dir(f_identifier);
for i=1:length(f_list)
im=imread(f_list(i).name);
fprintf('%s%d %s\n','Appending slice#',i,f_list(i).name);
imwrite(im,stack_name,'WriteMode','append','Description','FakeLabel');
end
However, once the stack is successfully generated, the individual images dont have a 'label' Is there an option to include a text string as a label for each slice?
For those who use ImageJ, I am trying to replicate the ImageJ function of assigning individual names to each slice of a stack ('ImageJ > Stacks > Tools > Set Label...' option).
I tried 'imfinfo' and tried adding a 'Description' field, but it didnt work: imwrite(im,stack_name,'WriteMode','append','Description','DesiredLabel');
I also looked into the Tiff() object tags, but cannot find the specific handle for individual slice labels.

Risposte (1)

Rollin Baker
Rollin Baker il 12 Apr 2017
Hi Dhrubajyoti,
Looking through the MATLAB documentation, I was able to find a "PageName" tag for TIFF objects. You can use the setTag function to configure these properties. You may be able to use this to achieve your desired behavior, although it's not clear if the property can applied to an individual slice.
Take a look at the link below for information on how to set the tags of a TIFF object, you can find the "PageName" property under the "Table 1: Supported TIFF Tags" header.
Good luck with your project!
-Rollin
  1 Commento
Dhrubajyoti Basuroy
Dhrubajyoti Basuroy il 27 Lug 2018
Thanks so much Rollin. I tried 'PageName' but it seems to be only for single image TIFFs, not multi-page TIFFs. I may be doing something wrong...

Accedi per commentare.

Categorie

Scopri di più su Graphics Object Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by