[Insight-users] One of the common Errors-want to know why itoccurs

alex Dowson alexdowson at hotmail.com
Mon Sep 3 08:51:16 EDT 2012


Hi

in ConnectedComponentImageFilter  image type is different than reader image.  so may be you need to convert reader image to HessianImageType . 


Alex



From: D, Yamini 
Sent: Monday, September 03, 2012 5:58 PM
To: daviddoria at gmail.com 
Cc: insight-users at itk.org 
Subject: Re: [Insight-users] One of the common Errors-want to know why itoccurs

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] 
Sent: Monday, September 03, 2012 5:28 PM
To: D, Yamini
Cc: 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> 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

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120903/3da28b9f/attachment.htm>


More information about the Insight-users mailing list