[Insight-users] errors when implementing itkCannyEdgeDetectionImageFilter

danieljohnsonusa at netscape.net danieljohnsonusa at netscape.net
Mon Apr 9 20:37:14 EDT 2012


I tried to build a simple program to implement the 
itkCannyEdgeDetectionImageFilter, but I got an error that I am having a 
hard time understanding.  I got the error

1>c:\slicer4-sbuild-new\itkv3\code\common\itkConceptChecking.h(723) : 
error C2440: 'initializing' : cannot convert from 
'itk::Concept::Detail::UniqueType_bool<__formal>' to 
'itk::Concept::Detail::UniqueType_bool<__formal>'
1>        with
1>        [
1>            __formal=false
1>        ]
1>        and
1>        [
1>            __formal=true
1>        ]
1>        No user-defined-conversion operator available that can 
perform this conversion, or the operator cannot be called
1>        
c:\slicer4-sbuild-new\itkv3\code\common\itkConceptChecking.h(722) : 
while compiling class template member function 'void 
itk::Concept::IsFloatingPoint<T>::Constraints::constraints(void)'
1>        with
1>        [
1>            T=short
1>        ]

It seems like the input variable data type that I'm sending as an input 
don't match the datatypes that the filter class is expecting.  What 
datatypes does the filter expect.  My program inputs are the lower 
threshold, upper threshold, and variance, all formatted as double.  Is 
there an input I'm missing, or is the datatype supposed to be other 
than double?  I'm posting the code I used below (very short).  Can 
anyone help identify which variables I have formatted incorrectly?

Thanks,

Daniel


typedef itk::Image<short,3> ImageType;

typedef itk::ImageFileReader<ImageType> ReaderType;
typedef itk::ImageFileWriter<ImageType> WriterType;

  ReaderType::Pointer reader = ReaderType::New();
WriterType::Pointer writer = WriterType::New();
reader->SetFileName(inputVolume.c_str() );
writer->SetFileName (outputVolume.c_str());
typedef itk::CannyEdgeDetectionImageFilter <ImageType, ImageType> 
FilterType;
FilterType::Pointer filter = FilterType::New();
try {
filter->SetInput(reader->GetOutput());
filter->SetVariance(variance);
filter->SetLowerThreshold(lthreshold);
filter->SetUpperThreshold(uthreshold);
writer->SetInput(filter->GetOutput());
writer->Update();
}





More information about the Insight-users mailing list