<div dir="ltr"><div>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).</div><div><br>
</div><div>Example code:</div><div><br></div><div> const char* filename = "C:\\temp\\out.tiff";</div><div><br></div><div><div><span class="" style="white-space:pre"> </span>int extents[6] = {0, 9, 0, 9, 0, 9};</div>
<div><span class="" style="white-space:pre"> </span>vtkSmartPointer<vtkImageData> imageVolume = vtkSmartPointer<vtkImageData>::New();</div><div><span class="" style="white-space:pre"> </span>imageVolume->SetExtent(extents);</div>
<div><span class="" style="white-space:pre"> </span>imageVolume->AllocateScalars(VTK_UNSIGNED_SHORT, 1);</div><div><br></div><div><span class="" style="white-space:pre"> </span>vtkSmartPointer<vtkTIFFWriter> writer = vtkSmartPointer<vtkTIFFWriter>::New();<br>
</div><div><span class="" style="white-space:pre"> </span>writer->SetInputData( imageVolume );</div><div><span class="" style="white-space:pre"> </span>writer->SetFileDimensionality(3);</div><div><span class="" style="white-space:pre"> </span>writer->SetCompressionToNoCompression();</div>
<div><span class="" style="white-space:pre"> </span>writer->SetFileName( filename );</div><div><span class="" style="white-space:pre"> </span>writer->Write();</div><div><br></div><div><span class="" style="white-space:pre"> </span>vtkSmartPointer<vtkTIFFReader> reader = vtkSmartPointer<vtkTIFFReader>::New();<br>
</div><div><span class="" style="white-space:pre"> </span>reader->SetFileName( filename );</div><div><span class="" style="white-space:pre"> </span>reader->SetFileDimensionality(3);</div><div><span class="" style="white-space:pre"> </span>reader->Update();</div>
<div><span class="" style="white-space:pre"> </span>reader->GetDataExtent(extents); // returns { 0, 9, 0, 99, 0, 0 }</div></div><div><br></div><div><br></div><div>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).</div>
<div><br></div><div>This is in VTK 6.1.0.</div><div>Can anyone suggest how to fix this??</div><div><br></div><div>Many thanks,</div><div><br></div><div>Richard</div><div><br></div><br clear="all"><div><br></div>-- <br><div dir="ltr">
<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif">Richard Whitehead </span><b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)">–</span></b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif"> Senior Imaging Engineer</span></p>
<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)">Michelson Diagnostics Ltd</span></b></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt">
<b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)">M:</span></b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif"> +44 (0)7905 955276 </span><b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)">T:</span></b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif"> +44 (0)20 8308 1695</span></p>
<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)">E: </span></b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(0,176,240)"><a href="mailto:richard.whitehead@vivosight.com" style="color:rgb(17,85,204)" target="_blank"><span style="color:rgb(0,176,240)">richard.whitehead@vivosight.com</span></a></span><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif"> </span><b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(146,39,143)">W:</span></b><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif"> </span><span lang="EN" style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(0,176,240)"><a href="http://www.vivosight.com/" style="color:rgb(17,85,204)" target="_blank"><span style="color:rgb(0,176,240)">www.vivosight.com</span></a></span></p>
<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><br></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><a href="http://www.vivosight.com/" target="_blank"><span style="color:windowtext;text-decoration:none"><img src="https://sites.google.com/a/vivosight.com/logo/_/rsrc/1361922206747/home/VivoSight.png" border="0"></span></a></p>
<p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"><br></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt"></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt">
<span style="font-size:7.5pt;font-family:Arial,sans-serif;color:gray">Michelson Diagnostics Ltd, 1 Grays Farm Production Village, Grays Farm Road, Orpington, Kent BR5 3BD, UK</span></p><p style="color:rgb(80,0,80);font-family:Calibri;margin:0cm 0cm 0.0001pt">
<span style="font-size:7.5pt;font-family:Arial,sans-serif;color:gray">Registered Office: 3 Shearwater, Maidstone, ME16 0DW. Registered in England No. 5732681</span></p></div>
</div>