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
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 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!