[Insight-users] Problem compiling with ContourExtractor2D

Bill Lorensen bill.lorensen at gmail.com
Thu Mar 25 10:31:22 EDT 2010


Change    typedef itk::Image< unsigned char, 3 > ImageType;
to
    typedef itk::Image< unsigned char, 2 > ImageType;

On Thu, Mar 25, 2010 at 5:48 AM, Preben <64bit at mailme.dk> wrote:
> 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
>
> _____________________________________
> 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.html
>
> 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
>


More information about the Insight-users mailing list