Tiff (tifflib) append reaching limit of frames

5 次查看(过去 30 天)
Hi Community
I have a function that export a 3D matrix to a tiff file.
Its working well, but when appending the submatrix 4096 and error is shown
Error using tifflib
Unable to write strip #1.
Error in Tiff/writeAllStrips (line 1978)
tifflib('writeEncodedStrip',obj.FileID, stripNum-1,imageData(row_inds,:));
Error in Tiff/write (line 1486)
obj.writeAllStrips(varargin{:});
Error in exportToTIF (line 52)
write(t,single(imgdata(:,:,i))); %% When i = 4096
Have you seen that behaviour before?
Thanks a lot
Here's the code
% Config. Tif
tagstruct.SampleFormat = Tiff.SampleFormat.IEEEFP;
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.BitsPerSample = 32;
tagstruct.SamplesPerPixel = 1;
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
tagstruct.Software = 'MATLAB';
tagstruct.ImageLength = size(imgdata,1);
tagstruct.ImageWidth = size(imgdata,2);
% Writting first frame
t = Tiff(selpath + folder + fileName + ".tif",'w');
setTag(t,tagstruct)
write(t,single(imgdata(:,:,1)));
close(t);
% Appending the rest
for i = 2 : size(imgdata,3)
t = Tiff(selpath + folder + fileName + ".tif",'a');
setTag(t,tagstruct)
write(t,single(imgdata(:,:,i))); % Here the error when i = 4069
end
close(t);
  1 个评论
Walter Roberson
Walter Roberson 2021-7-27
I am not clear why you construct t in the loop? It does not appear to depend on the loop variable?

请先登录,再进行评论。

回答(0 个)

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by