It means that RescaleImageFilter cannot convert the input image from 3D to 2D. Change:<div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">typedef itk::RescaleIntensityImageFilter&lt; InputImageType, OutputImageType&gt; RescaleFilterType;</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">to<br></span></font><div><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">typedef itk::RescaleIntensityImageFilter&lt; InputImageType, InputImageType&gt; RescaleFilterType;</span><br>
<br><div class="gmail_quote">On Sat, Jun 4, 2011 at 3:00 AM, 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;">
Hello to all,<br><br>I am using itkExtractImageFilter and RescaleImageFilter, but when I make the pipeline among reader, rescaleimagefilter, extractimageFilter and writer I get this error.<br><i>error C2664: &#39;void itk::ImageToImageFilter&lt;TInputImage,TOutputImage&gt;::SetInput(const itk::Image&lt;TPixel,VImageDimension&gt; *)&#39; : cannot convert parameter 1 from &#39;itk::Image&lt;TPixel,VImageDimension&gt; *&#39; to &#39;const itk::Image&lt;TPixel,VImageDimension&gt; *&#39;</i><br>

<br>Couldsomebody tell me what I am doing wrong?<br>Thanks in advance<br><br><br>Here is my code (I have highlighted the point of the error)<br><br><br>  typedef unsigned char        InputPixelType;<br>  typedef unsigned char        OutputPixelType;<br>

<br>  typedef itk::Image&lt; InputPixelType,  3 &gt;    InputImageType;<br>  typedef itk::Image&lt; OutputPixelType, 2 &gt;    OutputImageType;<br><br>  typedef itk::ImageFileReader&lt; InputImageType  &gt;  ReaderType;<br>

  typedef itk::ImageFileWriter&lt; OutputImageType &gt;  WriterType;<br><br>     ReaderType::Pointer reader = ReaderType::New();<br>     reader-&gt;SetFileName( fileName.toStdString()  );<br>     reader-&gt;Update();<br>
<br>
  WriterType::Pointer writer = WriterType::New();<br><br>  writer-&gt;SetFileName( &quot;z.png&quot; );<br><br>  typedef itk::RescaleIntensityImageFilter&lt; InputImageType, OutputImageType &gt; RescaleFilterType;<br>  RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New();<br>

  rescaleFilter-&gt;SetInput(reader-&gt;GetOutput());<br>  rescaleFilter-&gt;SetOutputMinimum(0);<br>  rescaleFilter-&gt;SetOutputMaximum(255);<br><br>  <br><br>  typedef itk::ExtractImageFilter&lt; InputImageType, OutputImageType &gt; FilterType;<br>

  FilterType::Pointer filter = FilterType::New();<br><br>  InputImageType::RegionType inputRegion =<br>           reader-&gt;GetOutput()-&gt;GetLargestPossibleRegion();<br><br>  InputImageType::SizeType size = inputRegion.GetSize();<br>

 <br>  // get the size of the hole 3D image<br>  size_x = size[0];<br>  size_y = size[1];<br>  size_z = size[2];<br>  <br>  // get slices of z coordiante<br>  size[2] = 0; <br>  <br>  <br>  InputImageType::IndexType start = inputRegion.GetIndex();<br>

 // const unsigned int sliceNumber = 90;<br>  ui-&gt;verticalScrollBar_z-&gt;setRange(1,size_z);<br>  unsigned int sliceNumber = ui-&gt;verticalScrollBar_z-&gt;value();<br>  start[2] = sliceNumber;<br> // ui-&gt;verticalScrollBar_z-&gt;setValue(sliceNumber);<br>

 <br><br>  InputImageType::RegionType desiredRegion;<br>  desiredRegion.SetSize( size );<br>  desiredRegion.SetIndex( start );<br><br>  filter-&gt;SetExtractionRegion( desiredRegion );<br><br><br>  <span style="background-color:rgb(255, 255, 102)">filter-&gt;SetInput( rescaleFilter-&gt;GetOutput() );</span><br style="background-color:rgb(255, 255, 102)">

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

    std::cerr &lt;&lt; err &lt;&lt; std::endl;<br>    }<br>}<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>
<br>_____________________________________<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></div>