[Insight-users] FW: One of the common Errors-want to know why it occurs

D, Yamini Yamini.D at philips.com
Mon Sep 3 08:33:35 EDT 2012


Hi,

Yes at first  I tried with CCFilter->SetInput(reader1->GetOutput());
It threw the same error so tried the other way. But it didn't solve the issue

Thank you.


From: Bill Lorensen [mailto:bill.lorensen at gmail.com]
Sent: Monday, September 03, 2012 5:58 PM
To: D, Yamini
Cc: David Doria; insight-users at itk.org
Subject: Re: [Insight-users] One of the common Errors-want to know why it occurs

SetInput requires a const.

Either:

const  itk::Image<InputPixelType, Dimension>* pOutputImage = reader1->GetOutput();

  CCFilter->SetInput(pOutputImage);
or

  CCFilter->SetInput(reader1->GetOutput());
On Mon, Sep 3, 2012 at 8:25 AM, D, Yamini <Yamini.D at philips.com<mailto:Yamini.D at philips.com>> wrote:

Hi,

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.



#include "stdafx.h"

#include "itkHessianToObjectnessMeasureImageFilter.h"

#include "itkMultiScaleHessianBasedMeasureImageFilter.h"

#include "itkConnectedComponentImageFilter.h"

#include "itkImageFileReader.h"

#include "itkImageFileWriter.h"



typedef float                                 InputPixelType;

  typedef itk::Image<InputPixelType,Dimension>  InputImageType;



  typedef float                                 OutputPixelType;

  typedef itk::Image<OutputPixelType,Dimension> OutputImageType;



  typedef itk::ImageFileReader<InputImageType>  FileReaderType;



  typedef itk::ImageFileWriter<OutputImageType> FileWriterType;



  typedef itk::NumericTraits< InputPixelType >::RealType RealPixelType;



  typedef itk::SymmetricSecondRankTensor< RealPixelType, Dimension > HessianPixelType;

  typedef itk::Image< HessianPixelType, Dimension >                  HessianImageType;



  typedef itk::HessianToObjectnessMeasureImageFilter< HessianImageType,OutputImageType > ObjectnessFilterType;



  typedef itk::MultiScaleHessianBasedMeasureImageFilter< InputImageType,HessianImageType, OutputImageType > MultiScaleEnhancementFilterType;



  // for Connected component

  typedef itk::ConnectedComponentImageFilter< HessianImageType,OutputImageType > ConnectedComponentFilterType;



FileReaderType::Pointer imageReader = FileReaderType::New();

  imageReader->SetFileName(argv[1]);

  try

    {

    imageReader->Update();

    }

  catch (itk::ExceptionObject &ex)

    {

    std::cout << ex << std::endl;

    return EXIT_FAILURE;

    }

.........

........

FileWriterType::Pointer writer2 = FileWriterType::New();

    writer2->SetFileName(argv[9]);

    writer2->UseCompressionOn();

    writer2->SetInput( multiScaleEnhancementFilter->GetOutput() );

........

//CC PART

  FileReaderType::Pointer reader1 = FileReaderType::New();

  reader1->SetFileName(argv[9]);

  cout<<"reader1 passed"<<endl;

  ConnectedComponentFilterType::Pointer CCFilter = ConnectedComponentFilterType::New();

  itk::Image<InputPixelType, Dimension>* pOutputImage = reader1->GetOutput();



  CCFilter->SetInput(pOutputImage);                                                                                  <-------------this is the line where I get the error

  FileWriterType::Pointer writer4 = FileWriterType::New();

  writer4->SetInput(CCFilter->GetOutput());

  writer4->SetFileName("d:\\Final2.mhd");

  cout<<"writer4 passed"<<endl;



return EXIT_SUCCESS;

}





-----Original Message-----
From: David Doria [mailto:daviddoria at gmail.com]<mailto:[mailto:daviddoria at gmail.com]>
Sent: Monday, September 03, 2012 5:28 PM
To: D, Yamini
Cc: insight-users at itk.org<mailto:insight-users at itk.org>
Subject: Re: One of the common Errors-want to know why it occurs



On Mon, Sep 3, 2012 at 2:17 AM, D, Yamini <Yamini.D at philips.com<mailto:Yamini.D at philips.com>> wrote:

> Hi,

>

>

>

> Can you tell me what would be the cause of  the following error ? I

> have come across this lot of times and want to know why this occurs.

>

>

>

> 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> *'



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.



David


________________________________
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.

_____________________________________
Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users



--
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120903/c5368242/attachment.htm>


More information about the Insight-users mailing list