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< InputImageType, OutputImageType> 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< InputImageType, InputImageType> RescaleFilterType;</span><br>
<br><div class="gmail_quote">On Sat, Jun 4, 2011 at 3:00 AM, john smith <span dir="ltr"><<a href="mailto:mkitkinsightuser@gmail.com">mkitkinsightuser@gmail.com</a>></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: 'void itk::ImageToImageFilter<TInputImage,TOutputImage>::SetInput(const itk::Image<TPixel,VImageDimension> *)' : cannot convert parameter 1 from 'itk::Image<TPixel,VImageDimension> *' to 'const itk::Image<TPixel,VImageDimension> *'</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< InputPixelType, 3 > InputImageType;<br> typedef itk::Image< OutputPixelType, 2 > OutputImageType;<br><br> typedef itk::ImageFileReader< InputImageType > ReaderType;<br>
typedef itk::ImageFileWriter< OutputImageType > WriterType;<br><br> ReaderType::Pointer reader = ReaderType::New();<br> reader->SetFileName( fileName.toStdString() );<br> reader->Update();<br>
<br>
WriterType::Pointer writer = WriterType::New();<br><br> writer->SetFileName( "z.png" );<br><br> typedef itk::RescaleIntensityImageFilter< InputImageType, OutputImageType > RescaleFilterType;<br> RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New();<br>
rescaleFilter->SetInput(reader->GetOutput());<br> rescaleFilter->SetOutputMinimum(0);<br> rescaleFilter->SetOutputMaximum(255);<br><br> <br><br> typedef itk::ExtractImageFilter< InputImageType, OutputImageType > FilterType;<br>
FilterType::Pointer filter = FilterType::New();<br><br> InputImageType::RegionType inputRegion =<br> reader->GetOutput()->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->verticalScrollBar_z->setRange(1,size_z);<br> unsigned int sliceNumber = ui->verticalScrollBar_z->value();<br> start[2] = sliceNumber;<br> // ui->verticalScrollBar_z->setValue(sliceNumber);<br>
<br><br> InputImageType::RegionType desiredRegion;<br> desiredRegion.SetSize( size );<br> desiredRegion.SetIndex( start );<br><br> filter->SetExtractionRegion( desiredRegion );<br><br><br> <span style="background-color:rgb(255, 255, 102)">filter->SetInput( rescaleFilter->GetOutput() );</span><br style="background-color:rgb(255, 255, 102)">
writer->SetInput( filter->GetOutput() );<br><br> try<br> {<br> writer->Update(); <br> }<br> catch( itk::ExceptionObject & err )<br> {<br> std::cerr << "ExceptionObject caught !" << std::endl;<br>
std::cerr << err << 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>