[Insight-users] Problem compiling with ContourExtractor2D

Preben 64bit at mailme.dk
Thu Mar 25 08:48:15 EDT 2010


Hi again

So far so good! But not that far actually...

I've written this little example code here:
----
#include <iostream>
#include <itkImage.h>
#include <itkImageFileReader.h>
#include <itkImageFileWriter.h>
#include <itkContourExtractor2DImageFilter.h>
#include <itkPolyLineParametricPath.h>

int main() {
     typedef itk::Image< unsigned char, 3 > ImageType;
     typedef itk::ImageFileReader< ImageType >  ReaderType;
     typedef itk::ImageFileWriter< ImageType >  WriterType;
     typedef itk::ContourExtractor2DImageFilter< ImageType > ContourFilter;

     ReaderType::Pointer reader  = ReaderType::New();
     WriterType::Pointer writer  = WriterType::New();
     reader->SetFileName("can_scene.bmp");
     writer->SetFileName("can_contours.png");

     ContourFilter::Pointer filter = ContourFilter::New();
     filter->SetInput( reader->GetOutput() );

     // Run and output data to data object
     ContourFilter::OutputPathType::Pointer path;
     filter->Update();
     path = filter->GetOutput();

     path->Print(std::cout);
}
----


but I get this strange error when compiling:
----
C:\working\itkExample>make
[100%] Building CXX object CMakeFiles/itkTest.dir/src/main.cpp.obj
C:/working/InsightToolkit-3.16.0/Code/Common/itkConceptChecking.h: In 
member function `void itk::Concept::SameDimension<D1, 
D2>::Constraints::constraints() [with unsigned int D1 = 3u, unsigned int 
D2 = 2u]':
C:/working/InsightToolkit-3.16.0/Code/Common/itkConceptChecking.h:547:   
instantiated from `itk::Concept::SameDimension<3u, 2u>'
C:/working/InsightToolkit-3.16.0/Code/Review/itkContourExtractor2DImageFilter.h:158:   
instantiated from `itk::ContourExtractor2DImageFilter<main()::ImageType>'
C:\working\itkExample\src\main.cpp:19:   instantiated from here
C:/working/InsightToolkit-3.16.0/Code/Common/itkConceptChecking.h:543: 
error: conversion from 
`itk::Concept::Detail::UniqueType_unsigned_int<2u>' to non-scalar type 
`itk::Concept::Detail::UniqueType_unsigned_int<3u>' requested
make[2]: *** [CMakeFiles/itkTest.dir/src/main.cpp.obj] Error 1
make[1]: *** [CMakeFiles/itkTest.dir/all] Error 2
make: *** [all] Error 2
----

What should I do about it?

(I'm using Windows XP 32bit with MinGW compiler and configures ITK with 
REVIEW code set to ON)


Best regards,

Preben Holm



More information about the Insight-users mailing list