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 "itkImage.h"</div><div>#include "itkImageFileReader.h"</div><div>#include "itkImageFileWriter.h"</div><div>#include "itkCannyEdgeDetectionImageFilter.h"</div>
<div>#include "itkObjectFactoryBase.h"</div><div>#include "itkPNGImageIOFactory.h"</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<double, 2> DoubleImageType;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::ImageFileReader<DoubleImageType> 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->SetFileName("input.png");</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::CannyEdgeDetectionImageFilter <DoubleImageType, DoubleImageType></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->SetInput(reader->GetOutput());</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>cannyFilter->SetVariance( variance );</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>cannyFilter->SetUpperThreshold( upperThreshold );</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>cannyFilter->SetLowerThreshold( lowerThreshold );</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef itk::ImageFileWriter<DoubleImageType> 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->SetFileName("test.png");</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>writer->SetInput(cannyFilter->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->Update();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>} catch (itk::ExceptionObject &e) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>std::cerr << e << 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 << "ENDE" << 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: "void __thiscall itk::ImageFileReader<class itk::Image<double,2>,class itk::DefaultConvertPixelTraits<double> >::GenerateOutputInformation(void)"</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>