[Insight-users] Problem printing the ContourExtractor2D
Preben
64bit at mailme.dk
Fri Mar 26 05:17:07 EDT 2010
Hi again
I've tried to change to parameter as you wrote - it compiles ;-)
However, when I try to use the Print() method, I get an error and the
program terminates.
What is wrong
Best regards,
Preben
Den 25-03-2010 15:31, Bill Lorensen skrev:
> 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