Saving a stack of images

8 次查看(过去 30 天)
Hi. I have a set of tiff images in an array (expressed as an array of double).
I want to save as a stack of images. I have tried:
for k=1:mx
imgArray2(:,:,k)=imgArray{k};
end
try
imwrite(imgArray2,sprintf('%s\\%s.stk',folder,prefix));
catch
h = errordlg('Error Saving Image STK')
end
But get the error message:
Subscripted assignment dimension mismatch.
Error in myProgram>pushbutton53_Callback (line 4016)
imgArray2(:,:,k)=imgArray{k};
  5 个评论
Walter Roberson
Walter Roberson 2017-3-3
.stk appears to be Metamorph .stk files, which appear to be an extension of TIFF files. The contribution https://www.mathworks.com/matlabcentral/fileexchange/10298-tiffread2-m should be able to read .stk files. At the moment I do not know about writing .stk files.
Jason
Jason 2017-3-3
Yes stk is from Metamorph. I dont need this format, just some way to collect a set of tiff images (which are doubles) and be able to save as a single file in any format. I would then later need to undo this and be able to eventually read the individual images.

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2017-3-3
Try save():
save('tiff_stack.mat', 'imgArray2');

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by