title: Save uint16 tiff image as truecolor with Matlab
body: <p>I am processing microscopy images (in Matlab) in the tiff format, normally uint8 or uint16. Basically I read them, put them in a cell array for processing and then export them in the tiff format either as an image sequence or a stack (using imwrite and either the 'overwrite' or 'append' writemode property of imwrite, respectively). Up to now everything works very well.</p>
  
  <p>The problem I'm having is the following: </p>
  
  <p>When I open the images with ImageJ, they are not in truecolor "RGB" color mode, but rather in composite mode. For example ImageJ reads the data as 8 bit, which it is, but does not open the image as a truecolor (Sorry for the bad choice of words I don't know the right terminology). Hence I have to manually combine the 3 channels together, which is bothersome for large datasets. </p>
  
  <p>Here is a screen shot explaining. On the left is what I would like,i.e. what I obtain if I open the image directly with ImageJ, and on the right is what I currently have after saving images with Matlab and opening them with ImageJ, which I don't want.</p>
  
  <p><img src="https://i.stack.imgur.com/jEZRZ.png" alt="enter image description here"></p>
  
  <p>The code I'm using to export the image sequence is the following. "FinalSequenceToExport" is the cell array containing the images.</p>
  
  <pre><code>for i = 1:SliceNumber
      ExportedName = sprintf('%s%s%d.tiff',fileName,'Z',i);
    imwrite(FinalSequenceToExport{i},ExportedName,'tif','WriteMode','overwrite','Compression','none');
  
  end
  </code></pre>
  
  <ul>
  <li>If I ask Matlab the size of FinalSequenceToExport{1}, for instance, it gives 512 x 512 x 3.</li>
  <li>If I open a given image in the command window and then save it with the same code as above, it does what I want and the resulting image opens as I want in ImageJ. Hence my guess would be that the problem arises from the use of the cell array but I don't understand how.</li>
  </ul>
  
  <p>I hope I've been clear enough. If not please ask for more details.
  Thanks for the help!</p>