On Mon, Dec 3, 2012 at 12:24 PM, Bill Lorensen &lt;<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt; David,<br>&gt;<br>&gt; Is this using itkv4. Looks like it was fixed tor itkv4  but I have not<br>
&gt; tested it yet.<br>&gt;<br>&gt; Bill<br><br>Ok, I guess it is not the exact same problem, but it seems very similar. If I read a 4 channel (RGBA) png into an Image&lt;unsigned char, 2&gt; and write it out again, I get a 1 channel image that looks just like the original image (the original image was binary (only had values (255 0 0 0) and (0 0 0 0))).<br>
<br>However, I read a 2 channel png (gray, alpha) into an Image&lt;unsigned char, 2&gt; and write it out again, the result is a black image.<br><br>Using the attached GrayAlpha.png as input and running the following will produce the all black GrayAlphaOutput.png (also attached).<br>
<br>#include &quot;itkImage.h&quot;<br>#include &quot;itkImageFileReader.h&quot;<br>#include &quot;itkImageFileWriter.h&quot;<br><br>int main(int argc, char *argv[])<br>{<br>  if(argc &lt; 3)<br>  {<br>    std::cerr &lt;&lt; &quot;Required: input output&quot; &lt;&lt; std::endl;<br>
<br>    return EXIT_FAILURE;<br>  }<br><br>  std::string inputFilename = argv[1];<br>  std::string outputFilename = argv[2];<br><br>  typedef itk::Image&lt; unsigned char, 2 &gt;  ImageType;<br><br>  typedef itk::ImageFileReader&lt;ImageType&gt; ReaderType;<br>
  ReaderType::Pointer reader = ReaderType::New();<br>  reader-&gt;SetFileName(inputFilename);<br>  reader-&gt;Update();<br><br>  typedef itk::ImageFileWriter&lt;ImageType&gt; WriterType;<br>  WriterType::Pointer writer = WriterType::New();<br>
  writer-&gt;SetFileName(outputFilename);<br>  writer-&gt;SetInput(reader-&gt;GetOutput());<br>  writer-&gt;Update();<br>}<br><br><br>David