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="visibility: hidden; left: -5000px; position: absolute; z-index: 9999; 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%;" id="avg_ls_inline_popup">
</div>