SetInput requires a const.<div><br></div><div>Either:<div><p style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">const itk::Image<InputPixelType, Dimension>* pOutputImage = reader1->GetOutput();</p>
<p style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"> CCFilter->SetInput(pOutputImage); </p>or</div><div><p style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
CCFilter->SetInput(reader1->GetOutput()); </p><p style="font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"></p><div class="gmail_quote">On Mon, Sep 3, 2012 at 8:25 AM, D, Yamini <span dir="ltr"><<a href="mailto:Yamini.D@philips.com" target="_blank">Yamini.D@philips.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p>Hi,</p>
<p>I am sending you a part of the code that involves the error. Headers, typedef and the filter parts. Hessian and Connected component are the filters which included.
</p>
<p> </p>
<p>#include "stdafx.h"</p>
<p>#include "itkHessianToObjectnessMeasureImageFilter.h"</p>
<p>#include "itkMultiScaleHessianBasedMeasureImageFilter.h"</p>
<p>#include "itkConnectedComponentImageFilter.h"</p>
<p>#include "itkImageFileReader.h"</p>
<p>#include "itkImageFileWriter.h"</p>
<p> </p>
<p>typedef float InputPixelType;</p>
<p> typedef itk::Image<InputPixelType,Dimension> InputImageType;</p>
<p> </p>
<p> typedef float OutputPixelType;</p>
<p> typedef itk::Image<OutputPixelType,Dimension> OutputImageType;</p>
<p> </p>
<p> typedef itk::ImageFileReader<InputImageType> FileReaderType;</p>
<p> </p>
<p> typedef itk::ImageFileWriter<OutputImageType> FileWriterType;</p>
<p> </p>
<p> typedef itk::NumericTraits< InputPixelType >::RealType RealPixelType;</p>
<p> </p>
<p> typedef itk::SymmetricSecondRankTensor< RealPixelType, Dimension > HessianPixelType;</p>
<p> typedef itk::Image< HessianPixelType, Dimension > HessianImageType;</p>
<p> </p>
<p> typedef itk::HessianToObjectnessMeasureImageFilter< HessianImageType,OutputImageType > ObjectnessFilterType;</p>
<p> </p>
<p> typedef itk::MultiScaleHessianBasedMeasureImageFilter< InputImageType,HessianImageType, OutputImageType > MultiScaleEnhancementFilterType;</p>
<p> </p>
<p> // for Connected component</p>
<p> typedef itk::ConnectedComponentImageFilter< HessianImageType,OutputImageType > ConnectedComponentFilterType;</p>
<p> </p>
<p>FileReaderType::Pointer imageReader = FileReaderType::New();</p>
<p> imageReader->SetFileName(argv[1]);</p>
<p> try</p>
<p> {</p>
<p> imageReader->Update();</p>
<p> }</p>
<p> catch (itk::ExceptionObject &ex)</p>
<p> {</p>
<p> std::cout << ex << std::endl;</p>
<p> return EXIT_FAILURE;</p>
<p> }</p>
<p>.........</p>
<p>........</p>
<p>FileWriterType::Pointer writer2 = FileWriterType::New();</p>
<p> writer2->SetFileName(argv[9]);</p>
<p> writer2->UseCompressionOn();</p>
<p> writer2->SetInput( multiScaleEnhancementFilter->GetOutput() );</p>
<p>........</p>
<p>//CC PART</p>
<p> FileReaderType::Pointer reader1 = FileReaderType::New();</p>
<p> reader1->SetFileName(argv[9]);</p>
<p> cout<<"reader1 passed"<<endl;</p>
<p> ConnectedComponentFilterType::Pointer CCFilter = ConnectedComponentFilterType::New();</p>
<p> itk::Image<InputPixelType, Dimension>* pOutputImage = reader1->GetOutput();</p>
<p> </p>
<p> CCFilter->SetInput(pOutputImage);
<b><span style="color:red"><-------------this is the line where I get the error</span></b></p>
<p> FileWriterType::Pointer writer4 = FileWriterType::New();</p>
<p> writer4->SetInput(CCFilter->GetOutput());</p>
<p> writer4->SetFileName("d:\\Final2.mhd");</p>
<p> cout<<"writer4 passed"<<endl;</p>
<p> </p>
<p>return EXIT_SUCCESS;</p><div class="im">
<p>}</p>
<p> </p>
<p> </p>
<p>-----Original Message-----<br>
From: David Doria <a href="mailto:[mailto:daviddoria@gmail.com]" target="_blank">[mailto:daviddoria@gmail.com]</a>
<br>
Sent: Monday, September 03, 2012 5:28 PM<br>
To: D, Yamini<br>
Cc: <a href="mailto:insight-users@itk.org" target="_blank">insight-users@itk.org</a><br>
Subject: Re: One of the common Errors-want to know why it occurs</p>
<p> </p>
<p>On Mon, Sep 3, 2012 at 2:17 AM, D, Yamini <<a href="mailto:Yamini.D@philips.com" target="_blank"><span style="color:windowtext;text-decoration:none">Yamini.D@philips.com</span></a>> wrote:</p>
<p>> Hi,</p>
<p>> </p>
<p>> </p>
<p>> </p>
<p>> Can you tell me what would be the cause of the following error ? I
</p>
<p>> have come across this lot of times and want to know why this occurs.</p>
<p>> </p>
<p>> </p>
<p>> </p>
<p>> error C2664: 'void</p>
<p>> itk::ImageToImageFilter<TInputImage,TOutputImage>::SetInput(const</p>
<p>> itk::Image<TPixel,VImageDimension> *)' : cannot convert parameter 1
</p>
<p>> from 'itk::Image<TPixel,VImageDimension> *' to 'const </p>
<p>> itk::Image<TPixel,VImageDimension> *'</p>
<p> </p>
<p>Can you please give this some context? I.e. make a minimal compilable example of where you are calling this function that produces the error you are seeing.</p>
<p> </p>
<p>David</p>
<p class="MsoNormal"> </p>
</div></div>
<br><div class="im">
<hr>
<font face="Arial" color="Gray" size="1">The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified
that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.<br>
</font>
</div></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.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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br><br>
</div></div>