Hi Brad, <div><br></div><div>thanks for your response. I should have mentioned in my first post that i am using Visual Studio 2010 on a Win7 32bit machine. I&#39;ve read that this problem can be solved by adding 
<span style="font-family:monospace;font-size:12px;white-space:pre;background-color:rgb(255,255,255)">include(${ITK_USE_FILE})</span>  to the makefile. But what is the corresponding way to do it in visual studio?</div><div>
<br></div><div>Thanks, Sebastian<br><br><div class="gmail_quote">2012/5/22 Bradley Lowekamp <span dir="ltr">&lt;<a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Most likely this is a problem with how you are using CMake for ITK and is not related to the code you have included here.<div><br></div><div>There is an example of what a basic CMake project which uses ITK should like like  int ITK/Examples/Installation/CMakeLists.txt</div>
<div><br></div><div><a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Examples/Installation/CMakeLists.txt;h=5e1b9e7ae0a95430f5162e8ff435b98570c5ad6e;hb=HEAD" target="_blank">http://itk.org/gitweb?p=ITK.git;a=blob;f=Examples/Installation/CMakeLists.txt;h=5e1b9e7ae0a95430f5162e8ff435b98570c5ad6e;hb=HEAD</a></div>
<div><br></div><div>Hopefully, this will get you started in the right direction to solve you problem.</div><div><br></div><div>Brad<br><div><br></div><div><br><div><div><div class="h5"><div>On May 22, 2012, at 4:35 AM, Sebastian Losch wrote:</div>
<br></div></div><blockquote type="cite"><div><div class="h5">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 style="white-space:pre-wrap">        </span>itk::ObjectFactoryBase::RegisterFactory(itk::PNGImageIOFactory::New());</div>

<div><br></div><div><br></div><div><span style="white-space:pre-wrap">        </span>double variance = 2.0;</div><div><span style="white-space:pre-wrap">        </span>double upperThreshold = 0.0;</div>
<div><span style="white-space:pre-wrap">        </span>double lowerThreshold = 0.0;</div><div><br></div><div><span style="white-space:pre-wrap">        </span>typedef itk::Image&lt;double, 2&gt;  DoubleImageType;</div>
<div><br></div><div><span style="white-space:pre-wrap">        </span>typedef itk::ImageFileReader&lt;DoubleImageType&gt; ReaderType;</div><div><span style="white-space:pre-wrap">        </span>ReaderType::Pointer reader = ReaderType::New();</div>

<div><span style="white-space:pre-wrap">        </span>reader-&gt;SetFileName(&quot;input.png&quot;);</div><div><br></div><div><span style="white-space:pre-wrap">        </span>typedef itk::CannyEdgeDetectionImageFilter &lt;DoubleImageType, DoubleImageType&gt;</div>

<div><span style="white-space:pre-wrap">                </span>CannyEdgeDetectionImageFilterType;</div><div><br></div><div><span style="white-space:pre-wrap">        </span>CannyEdgeDetectionImageFilterType::Pointer cannyFilter = CannyEdgeDetectionImageFilterType::New();</div>

<div><span style="white-space:pre-wrap">        </span>cannyFilter-&gt;SetInput(reader-&gt;GetOutput());</div><div><span style="white-space:pre-wrap">        </span>cannyFilter-&gt;SetVariance( variance );</div>
<div><span style="white-space:pre-wrap">        </span>cannyFilter-&gt;SetUpperThreshold( upperThreshold );</div><div><span style="white-space:pre-wrap">        </span>cannyFilter-&gt;SetLowerThreshold( lowerThreshold );</div>
<div><br></div><div><span style="white-space:pre-wrap">        </span>typedef itk::ImageFileWriter&lt;DoubleImageType&gt; WriterType;</div><div><span style="white-space:pre-wrap">        </span>WriterType::Pointer writer = WriterType::New();</div>

<div><br></div><div><span style="white-space:pre-wrap">        </span>writer-&gt;SetFileName(&quot;test.png&quot;);</div><div><span style="white-space:pre-wrap">        </span>writer-&gt;SetInput(cannyFilter-&gt;GetOutput());</div>
<div><br></div><div><span style="white-space:pre-wrap">        </span>try {</div><div><span style="white-space:pre-wrap">                </span>writer-&gt;Update();</div><div><span style="white-space:pre-wrap">        </span>} catch (itk::ExceptionObject &amp;e) {</div>

<div><span style="white-space:pre-wrap">                </span>std::cerr &lt;&lt; e &lt;&lt; std::endl;</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">        </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>
</div></div>
_____________________________________<br>Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>Kitware offers ITK Training Courses, for more information visit:<br><a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br><div>
<span style="font-size:12px"><div style="word-wrap:break-word"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:12px;white-space:normal;font-family:Helvetica;word-spacing:0px"><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica">========================================================</font></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica">Bradley Lowekamp<span> </span><span> </span></font></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica">Medical Science and Computing for</font></p>
<p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica">Office of High Performance Computing and Communications</font></p>
<p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px"><font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica">National Library of Medicine<span> </span></font></p><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<font face="Helvetica" size="3" style="font:normal normal normal 12px/normal Helvetica"><a href="mailto:blowekamp@mail.nih.gov" target="_blank">blowekamp@mail.nih.gov</a></font></p><br></span></div></span><br>
</div>
<br></div></div></div></blockquote></div><br></div>