Tiff (tifflib) append reaching limit of frames

13 views (last 30 days)
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 Comment
Walter Roberson
Walter Roberson on 27 Jul 2021
I am not clear why you construct t in the loop? It does not appear to depend on the loop variable?

Sign in to comment.

Answers (0)

Categories

Find more on Large Files and Big Data in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!