title: Blank TIF image when using MATLAB TIFF class
body: <p>*<em>strong text</em>*I am trying to save a multi-page TIF file using the MATLAB TIFF class in 2012a by following the <a href="http://www.mathworks.com/help/techdoc/import_export/f5-123068.html#br_c_iz-1" rel="nofollow">example in the documentation</a>. My usage differs in that I am writing a 32-bit grayscale image with values ranging from approximately -10,000 to 200,000. </p>
  
  <pre><code>% Use 'a' for 'append' since this code is in a loop that writes each page.
  % Note: 'fileName' is defined elsewhere and the file is created.
  t = Tiff(fileName, 'a');
  
  tagstruct.ImageLength = size(result, 2);
  tagstruct.ImageWidth = size(result, 1);
  tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
  tagstruct.SampleFormat = Tiff.SampleFormat.IEEEFP;
  tagstruct.Compression = Tiff.Compression.None;
  tagstruct.BitsPerSample = 32;
  tagstruct.SamplesPerPixel = 1;
  tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky;
  tagstruct.Software = 'MATLAB';
  t.setTag(tagstruct);
  
  % Viewing the data immediately before the 'write' operation shows it correct.
  % imtool(result(:, :, j));
  % Tools -&gt; Adjust Contrast                       
  t.write(result(:, :, j));
  
  t.close();
  </code></pre>
  
  <p>The output image, as inspected by both MATLAB and ImageJ, is the correct size and has the correct metadata, but all values are zero.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>MATLAB's documentation is somewhat sparse for the TIFF class, which itself is a wrapper for the <a href="http://www.remotesensing.org/libtiff/" rel="nofollow">LibTIFF library</a>. The <a href="http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf" rel="nofollow">official TIFF Specification Version 6</a> denotes the full list of required fields for each TIF image type.</p>