Looks like concept checking for DerivativeImageFilter. The output image type likely needs to be signed. <div><br><div class="gmail_quote">On Wed, Mar 16, 2011 at 1:59 PM, john smith <span dir="ltr">&lt;<a href="mailto:mkitkinsightuser@gmail.com">mkitkinsightuser@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">and here is my code (if this could help you):<br>\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\<div class="im"><br><br>#include &quot;itkImage.h&quot;<br>
#include &quot;itkImageFileReader.h&quot;<br>#include &quot;itkImageFileWriter.h&quot;<br>
#include &quot;itkDerivativeImageFilter.h&quot;<br> <br><br> <br>int main(int argc, char * argv[])<br>{<br>  // Verify command line arguments<br>  if( argc &lt; 2 )<br>    {<br>    std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; std::endl;<br>

    std::cerr &lt;&lt; argv[0] &lt;&lt; &quot; inputImageFile&quot; &lt;&lt; std::endl;<br>    return EXIT_FAILURE;<br>    }<br> <br>  // Parse command line arguments<br>  std::string inputFilename = argv[1];<br> <br>  // Setup types<br>

 // typedef itk::Image&lt; float,  2 &gt;        FloatImageType;<br></div>  typedef itk::Image&lt; unsigned char, 2 &gt; ImageType;<br> <br>  typedef itk::ImageFileReader&lt; ImageType &gt;  readerType;<br>  typedef itk::ImageFileWriter&lt; ImageType &gt;  writerType;<br>

 <br>  typedef itk::DerivativeImageFilter&lt;<br>          ImageType, ImageType &gt;  filterType;<div class="im"><br> <br>  // Create and setup a reader<br>  readerType::Pointer reader = readerType::New();<br>  reader-&gt;SetFileName( inputFilename.c_str() );<br>

 <br>  // Create and setup a derivative filter<br>  filterType::Pointer derivativeFilter = filterType::New();<br>  derivativeFilter-&gt;SetInput( reader-&gt;GetOutput() );<br>  derivativeFilter-&gt;SetDirection(0); // &quot;x&quot; axis<br>

 <br><br></div><div class="im">  writerType::Pointer writer = writerType::New();<br>  writer-&gt;SetFileName(&quot;result.png&quot;);<br>  writer-&gt;SetInput(derivativeFilter-&gt;GetOutput());<br><br>      try<br>    {<br>
    writer-&gt;Update();<br>
    }<br>    catch( itk::ExceptionObject exp )<br>    {<br>    std::cerr &lt;&lt; &quot;Exception caught !&quot; &lt;&lt; std::endl;<br>    std::cerr &lt;&lt; exp &lt;&lt; std::endl;<br>    }<br> <br>  return EXIT_SUCCESS;<br>

}<br><br></div><div><div></div><div class="h5"><div class="gmail_quote">2011/3/16 john smith <span dir="ltr">&lt;<a href="mailto:mkitkinsightuser@gmail.com" target="_blank">mkitkinsightuser@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">

Hi,<br><br>I made thechanges and  when I run it from the command line window I get a message which is says that png supports unsigned char and unsigned short. But when I make these changes I get failures in the building of the project:<br>


<i>error C2440: &#39;initializing&#39; : cannot convert from &#39;itk::Concept::Detail::UniqueType_bool&lt;__formal&gt;&#39; to &#39;itk::Concept::Detail::UniqueType_bool&lt;__formal&gt;&#39;. </i>Could somebody help me with this?<br>


<br>Thanks in advance<div><div></div><div><br><br><br><div class="gmail_quote">2011/3/15 robert tamburo <span dir="ltr">&lt;<a href="mailto:robert.tamburo@gmail.com" target="_blank">robert.tamburo@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
Take a look at your writerType typedef.<div><br><br><div class="gmail_quote"><div><div></div><div>On Tue, Mar 15, 2011 at 9:49 AM, john smith <span dir="ltr">&lt;<a href="mailto:mkitkinsightuser@gmail.com" target="_blank">mkitkinsightuser@gmail.com</a>&gt;</span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><div></div><div>Hi to everyone,<br><br>I want to read an image and use a derivative image filter.I wrote the following code, but when I get a failure because I thonk that the types of reader,writer and derivative image filter do not match each other.Could somebody help me?<br>




<br>Thanks in advance<br><br>================DerivativeImageFilter.cxx==========================<br>#include &quot;itkImage.h&quot;<br>#include &quot;itkImageFileReader.h&quot;<br>#include &quot;itkImageFileWriter.h&quot;<br>




#include &quot;itkDerivativeImageFilter.h&quot;<br> <br><br> <br>int main(int argc, char * argv[])<br>{<br>  // Verify command line arguments<br>  if( argc &lt; 2 )<br>    {<br>    std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; std::endl;<br>




    std::cerr &lt;&lt; argv[0] &lt;&lt; &quot; inputImageFile&quot; &lt;&lt; std::endl;<br>    return EXIT_FAILURE;<br>    }<br> <br>  // Parse command line arguments<br>  std::string inputFilename = argv[1];<br> <br>  // Setup types<br>




  typedef itk::Image&lt; float,  2 &gt;        FloatImageType;<br>  typedef itk::Image&lt; unsigned char, 2 &gt; UnsignedCharImageType;<br> <br>  typedef itk::ImageFileReader&lt; UnsignedCharImageType &gt;  readerType;<br>




  typedef itk::ImageFileReader&lt; UnsignedCharImageType &gt;  writerType;<br> <br>  typedef itk::DerivativeImageFilter&lt;<br>          UnsignedCharImageType, FloatImageType &gt;  filterType;<br> <br>  // Create and setup a reader<br>




  readerType::Pointer reader = readerType::New();<br>  reader-&gt;SetFileName( inputFilename.c_str() );<br> <br>  // Create and setup a derivative filter<br>  filterType::Pointer derivativeFilter = filterType::New();<br>



  derivativeFilter-&gt;SetInput( reader-&gt;GetOutput() );<br>
  derivativeFilter-&gt;SetDirection(0); // &quot;x&quot; axis<br> <br>   typedef  itk::ImageFileWriter&lt; writerType  &gt; WriterType;<br>  WriterType::Pointer writer = WriterType::New();<br>  writer-&gt;SetFileName(&quot;result.png&quot;);<br>




  writer-&gt;SetInput(derivativeFilter-&gt;GetOutput());<br><br>      try<br>    {<br>    writer-&gt;Update();<br>    }<br>    catch( itk::ExceptionObject exp )<br>    {<br>    std::cerr &lt;&lt; &quot;Exception caught !&quot; &lt;&lt; std::endl;<br>




    std::cerr &lt;&lt; exp &lt;&lt; std::endl;<br>    }<br> <br>  return EXIT_SUCCESS;<br>}<br>
<br></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.html" target="_blank">http://www.kitware.com/products/protraining.html</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>
<br></blockquote></div><br></div>
</blockquote></div><br><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%">
</div>
</div></div></blockquote></div><br><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%">
</div>
</div></div></blockquote></div><br></div>