How do I write individual 'labels' for each slice (e.g. ImageJ) of a multi-page TIF in Matlab?
5 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Rollin Baker
on 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
See Also
Categories
Find more on Image Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!