Hi!<div><br></div><div>I am having problems getting the ImageFileReader and ImageFileWriter to work. I just want to read a PNG File, apply a filter and write it back to the harddrive. I found out that there is a problem in 4.1 with the ImageIOFactory registration, so i register the PNGFactory manually. The .png file is in the same folder as the executable. Here is my Code:</div>
<div><br></div><div><div>#include &quot;itkImage.h&quot;</div><div>#include &quot;itkImageFileReader.h&quot;</div><div>#include &quot;itkImageFileWriter.h&quot;</div><div>#include &quot;itkCannyEdgeDetectionImageFilter.h&quot;</div>
<div>#include &quot;itkObjectFactoryBase.h&quot;</div><div>#include &quot;itkPNGImageIOFactory.h&quot;</div><div><br></div><div>int main(int argc, char *argv[])</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>itk::ObjectFactoryBase::RegisterFactory(itk::PNGImageIOFactory::New());</div>
<div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>double variance = 2.0;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>double upperThreshold = 0.0;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>double lowerThreshold = 0.0;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::Image&lt;double, 2&gt;  DoubleImageType;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::ImageFileReader&lt;DoubleImageType&gt; ReaderType;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>ReaderType::Pointer reader = ReaderType::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>reader-&gt;SetFileName(&quot;input.png&quot;);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::CannyEdgeDetectionImageFilter &lt;DoubleImageType, DoubleImageType&gt;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>CannyEdgeDetectionImageFilterType;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>CannyEdgeDetectionImageFilterType::Pointer cannyFilter = CannyEdgeDetectionImageFilterType::New();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>cannyFilter-&gt;SetInput(reader-&gt;GetOutput());</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>cannyFilter-&gt;SetVariance( variance );</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>cannyFilter-&gt;SetUpperThreshold( upperThreshold );</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>cannyFilter-&gt;SetLowerThreshold( lowerThreshold );</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::ImageFileWriter&lt;DoubleImageType&gt; WriterType;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>WriterType::Pointer writer = WriterType::New();</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>writer-&gt;SetFileName(&quot;test.png&quot;);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>writer-&gt;SetInput(cannyFilter-&gt;GetOutput());</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>try {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>writer-&gt;Update();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>} catch (itk::ExceptionObject &amp;e) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>std::cerr &lt;&lt; e &lt;&lt; std::endl;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>std::cout &lt;&lt; &quot;ENDE&quot; &lt;&lt; std::endl;</div>
<div>}</div></div><div><br></div><div>and this is the error:</div><div><br></div><div><div>itk::ImageFileReaderException (0059E4A8)</div><div>Location: &quot;void __thiscall itk::ImageFileReader&lt;class itk::Image&lt;double,2&gt;,class itk::DefaultConvertPixelTraits&lt;double&gt; &gt;::GenerateOutputInformation(void)&quot;</div>
<div>File: c:\libs\itk\include\itk-4.1\itkimagefilereader.hxx</div><div>Line: 143</div><div>Description:  Could not create IO object for file input.png</div><div>  Tried to create one of the following:</div><div>    PNGImageIO</div>
<div>  You probably failed to set a file suffix, or</div><div>    set the suffix to an unsupported type.</div></div><div><br></div><div><br></div><div>What am i doing wrong?</div><div><br></div><div>Thanks in advance, Sebastian</div>