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

10 次查看(过去 30 天)
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.

回答(1 个)

Rollin Baker
Rollin Baker 2017-4-12
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 个评论
Dhrubajyoti Basuroy
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...

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Graphics Object Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by