Maximum number of frames in unint16 class tiff image (using libtiff).
Show older comments
Hi there, I have a (long) time series of uint16 xyt dataset which I want to save as tiff.
I used
filename = 'testtifffp.tiff';
t = Tiff( filename,'w' );
sz = size(d);
tagstruct.ImageLength = size(d, 1);
tagstruct.ImageWidth = size(d, 2);
%tagstruct.ImageDepth = size(d, 3);
tagstruct.SampleFormat = Tiff.SampleFormat.UInt;
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
tagstruct.BitsPerSample = 16;
tagstruct.SamplesPerPixel = 1;
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
for z = 1:min(sz(3),8189)
t.setTag(tagstruct);
t.write(d(:,:,z));
if z < sz(3)
t.writeDirectory();
fprintf('%%')
end
if ~rem(z,128);fprintf('\n');end
end
fprintf('\n');
t.close();
but reach the problem that I cannot write more than 8189 frames.
At frame 8190 I get
Error using tifflib
Unable to write strip #1.
Error in Tiff/writeAllStrips (line 1982)
tifflib('writeEncodedStrip',obj.FileID, stripNum-1,imageData(row_inds,:));
Error in Tiff/write (line 1486)
obj.writeAllStrips(varargin{:});
Error in NisargsBrain (line 125)
t.write(d(:,:,z));
the easier command
t.write(d);
causes the following error
t.write(d);
Warning: Sum of Photometric color channels and ExtraSamples does not match the value specified in SamplesPerPixel.
Writing with this configuration will error in a future release. To correct the configuration, define the non-color channels as ExtraSamples.
Error using tifflib
Unable to write strip #1.
Error in Tiff/writeAllStrips (line 1980)
tifflib('writeEncodedStrip',obj.FileID,stripNum-1,imageData(row_inds,:,:));
Error in Tiff/write (line 1486)
obj.writeAllStrips(varargin{:});
It is probably the same problem.
Is there any option to save more than 8189 frames when
sz = size(d)
sz =
512 512 16384
?
Any solution?
>> versionString = Tiff.getVersion()
versionString =
'LIBTIFF, Version 4.4.0
Copyright (c) 1988-1996 Sam Leffler
Copyright (c) 1991-1996 Silicon Graphics, Inc.'
Accepted Answer
More Answers (0)
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!