[Insight-users] problem in using itkLabelOverlayImageFilter in 3D
john smith
mkitkinsightuser at gmail.com
Thu Jun 30 08:45:10 EDT 2011
Hello to all,
I had used the itkLabelOverlayImageFilter in 2D and I didn;t have any
problem. No I am trying to use tis filter in 3D. I have written exactly the
same code but for 3D, and I get this error which I don't know what exactly
means.
the error is the following:
error C2440: 'initializing' : cannot convert from
'itk::Concept::Detail::UniqueType_unsigned_int<__formal>' to
'itk::Concept::Detail::UniqueType_unsigned_int<__formal>'
I hope someone could help me.
Thanks in advance
///////////// code///////////
typedef itk::Image<unsigned char, 3> ImageType;
ImageType::Pointer image1 = ImageType::New();
ImageType::Pointer image_label = ImageType::New();
typedef unsigned char InternalPixelType_add;
const unsigned int Dimension = 3;
typedef itk::Image< InternalPixelType_add, Dimension >
InternalImageType_add;
typedef itk::ImageFileReader< InternalImageType_add > ReaderType_add;
ReaderType_add::Pointer reader1 = ReaderType_add::New();
reader1->SetFileName( fileName.toStdString() );
reader1->Update();
image1 = reader1->GetOutput();
ReaderType_add::Pointer reader2 = ReaderType_add::New();
reader2->SetFileName( "result.hdr" );
reader2->Update();
image_label = reader2->GetOutput();
typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef itk::Image<RGBPixelType> RGBImageType;
typedef itk::LabelOverlayImageFilter<ImageType, ImageType, RGBImageType>
LabelOverlayImageFilterType;
LabelOverlayImageFilterType::Pointer labelOverlayImageFilter =
LabelOverlayImageFilterType::New();
labelOverlayImageFilter->SetInput(image1);
labelOverlayImageFilter->SetLabelImage(image_label);
// labelOverlayImageFilter->SetOpacity(.5);
labelOverlayImageFilter->SetOpacity(1.0);
labelOverlayImageFilter->ResetColors(); // reset color map
labelOverlayImageFilter->AddColor(0, 0, 255); // fill color map with blue
labelOverlayImageFilter->SetBackgroundValue(0); // don't overlay the
background, i.e., label 0
labelOverlayImageFilter->Update();
typedef itk::ImageFileWriter< RGBImageType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("output.hdr");
writer->SetInput(labelOverlayImageFilter->GetOutput());
writer->Update();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110630/a2138204/attachment.htm>
More information about the Insight-users
mailing list