[Insight-users] need help in using itkLabelOverlayImageFilter
john smith
mkitkinsightuser at gmail.com
Wed Jun 29 13:34:20 EDT 2011
You have right, I have change these as it seems bellow but still I get this
error. Do you know wat is going wrong?
* error C2296: '%' : illegal, left operand has type 'const float'*
and my code is the following:
*
ReaderType::Pointer reader1 = ReaderType::New();
reader1->SetFileName( fileName.toStdString() );
reader1->Update();
InternalImageType::Pointer image1 = reader1->GetOutput();
ReaderType::Pointer reader2 = ReaderType::New();
reader2->SetFileName( "result.png" );
reader2->Update();
InternalImageType::Pointer image2 = reader2->GetOutput();
typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef itk::Image<RGBPixelType> RGBImageType;
typedef itk::LabelOverlayImageFilter<InternalImageType, InternalImageType,
RGBImageType> LabelOverlayFilterType;
LabelOverlayFilterType::Pointer labelOverlayFilter =
LabelOverlayFilterType::New();
labelOverlayFilter->SetInput(image1);
labelOverlayFilter->SetLabelImage(image2);
labelOverlayFilter->SetOpacity(1.0);
labelOverlayFilter->ResetColors(); // reset color map
labelOverlayFilter->AddColor(0, 0, 255); // fill color map with blue
labelOverlayFilter->SetBackgroundValue(0); // don't overlay the
background, i.e., label 0
labelOverlayFilter->Update();
typedef itk::ImageFileWriter< RGBImageType > WriterType_RGB;
WriterType_RGB::Pointer writer_RGB = WriterType_RGB::New();
writer_RGB->SetFileName("addImage.png");
writer_RGB->SetInput(labelOverlayFilter->GetOutput());
writer_RGB->Update();*
2011/6/29 David Doria <daviddoria at gmail.com>
> On Wed, Jun 29, 2011 at 1:17 PM, john smith <mkitkinsightuser at gmail.com>
> wrote:
> > Thanks for your response. I know that there are these two errors but, do
> you
> > know what must be done in order to fix this errors?
>
> Did you look at the example I made you? SetLabelImage takes an
> itkImage not a string.
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110629/2fc4c1f6/attachment.htm>
More information about the Insight-users
mailing list