<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    <font face="Helvetica, Arial, sans-serif">Dear </font>Jihang,<br>
    <br>
    it works fine for me.<br>
    <br>
    Even if it may sound evident, please include the path of your images
    when trying to read and write them. And also, don't forget to define
    the template parameter OutputImageType.<br>
    <br>
    It is also recommendable to include every read/write/update
    operation into a try/catch block. That may give you some hint.<br>
     <br>
    Best regards,<br>
    JON HAITZ<br>
    <br>
    <br>
    <br>
    El 29/10/2010 9:50, 汪济航 escribió:
    <blockquote
      cite="mid:AANLkTikqmwHSwNgNTfoXB+F=6207Uo0SOpvv6xoV4DP2@mail.gmail.com"
      type="cite">
      <div>Hi,</div>
      <div> </div>
      <div>I meet a run-time problem when I try to read the jpg format
        file and save it as png. I just simulate the coding in
        itkPNGImageIOTest.cxx. </div>
      <div>The problem may happen in the coding below</div>
      <div> </div>
      <div>// Read in the image<br>
          itk::PNGImageIO::Pointer io;<br>
          io = itk::PNGImageIO::New();</div>
      <div>  itk::ImageFileReader&lt;RGBImageType&gt;::Pointer
        PNGreader;<br>
          PNGreader = itk::ImageFileReader&lt;RGBImageType&gt;::New();<br>
          PNGreader-&gt;SetFileName( "demoMeanFilter.jpg" );<br>
          PNGreader-&gt;SetImageIO(io);<br>
          PNGreader-&gt;Update();</div>
      <div>  itk::ImageFileWriter&lt;OutputImageType&gt;::Pointer
        PNGwriter;<br>
          PNGwriter =
        itk::ImageFileWriter&lt;OutputImageType&gt;::New();<br>
          PNGwriter-&gt;SetInput(PNGreader-&gt;GetOutput());<br>
          PNGwriter-&gt;SetFileName("demoMeanFilter.png" );<br>
          PNGwriter-&gt;SetImageIO(io);<br>
          PNGwriter-&gt;Write();</div>
      <div> </div>
      <div>Thanks,</div>
      <div> </div>
      <div>Jihang</div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_____________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at
<a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Kitware offers ITK Training Courses, for more information visit:
<a class="moz-txt-link-freetext" href="http://www.kitware.com/products/protraining.html">http://www.kitware.com/products/protraining.html</a>

Please keep messages on-topic and check the ITK FAQ at:
<a class="moz-txt-link-freetext" href="http://www.itk.org/Wiki/ITK_FAQ">http://www.itk.org/Wiki/ITK_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a>
</pre>
    </blockquote>
    <div class="moz-signature"><br>
    </div>
  </body>
</html>