[vtkusers] vtkTiffWriter does not write 3d volume
Richard Whitehead
richard.whitehead at vivosight.com
Fri May 9 10:36:31 EDT 2014
The vtkTiffWriter does not set the "number of pages" in a tiff file. If
you try to write a 3d volume you get a single 2d slice whose height is
(image height * number of slices).
Example code:
const char* filename = "C:\\temp\\out.tiff";
int extents[6] = {0, 9, 0, 9, 0, 9};
vtkSmartPointer<vtkImageData> imageVolume =
vtkSmartPointer<vtkImageData>::New();
imageVolume->SetExtent(extents);
imageVolume->AllocateScalars(VTK_UNSIGNED_SHORT, 1);
vtkSmartPointer<vtkTIFFWriter> writer =
vtkSmartPointer<vtkTIFFWriter>::New();
writer->SetInputData( imageVolume );
writer->SetFileDimensionality(3);
writer->SetCompressionToNoCompression();
writer->SetFileName( filename );
writer->Write();
vtkSmartPointer<vtkTIFFReader> reader =
vtkSmartPointer<vtkTIFFReader>::New();
reader->SetFileName( filename );
reader->SetFileDimensionality(3);
reader->Update();
reader->GetDataExtent(extents); // returns { 0, 9, 0, 99, 0, 0 }
I don't really understand what's happening, for example I can see the
writer setting TIFFTAG_IMAGELENGTH to the image height, but when the reader
reads the same tag it gets (height * number of slices).
This is in VTK 6.1.0.
Can anyone suggest how to fix this??
Many thanks,
Richard
--
Richard Whitehead *–* Senior Imaging Engineer
*Michelson Diagnostics Ltd*
*M:* +44 (0)7905 955276 *T:* +44 (0)20 8308 1695
*E: *richard.whitehead at vivosight.com *W:* www.vivosight.com
<http://www.vivosight.com/>
Michelson Diagnostics Ltd, 1 Grays Farm Production Village, Grays Farm
Road, Orpington, Kent BR5 3BD, UK
Registered Office: 3 Shearwater, Maidstone, ME16 0DW. Registered in
England No. 5732681
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140509/64fb0aba/attachment-0001.html>
More information about the vtkusers
mailing list