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

조회 수: 9 (최근 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
Dhrubajyoti Basuroy 2018년 7월 27일
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에서 Image Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by