[Insight-users] need help in using itkLabelOverlayImageFilter
john smith
mkitkinsightuser at gmail.com
Wed Jun 29 13:11:29 EDT 2011
Hello,
I am trying to use itkLabelOverlayImageFilter. My initial image (which I
segment) is a greyscale image (with values 0-255) and I load it using a
dialog box of Qt, as it seems
* typedef float InternalPixelType;
const unsigned int Dimension = 2;
typedef itk::Image< InternalPixelType, Dimension > InternalImageType;
typedef itk::ImageFileReader< InternalImageType > ReaderType;
ReaderType::Pointer reader1 = ReaderType::New();
reader1->SetFileName(fileName.toStdString());*
The result of my segmentation is a binary image , which is been saved wih
name "result.png", and I use a reader to read this file:
*ReaderType::Pointer reader2 = ReaderType::New();
reader2->SetFileName("result.png");*
I want to ask how I could use itkLabelOverlayImageFilter and what changes I
should make in order to work properly. Any example whould be very useful ,
as I am confused with the image type casting.
I have tried something like this, But I got errors:
* typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef itk::Image<RGBPixelType> RGBImageType;
typedef itk::LabelOverlayImageFilter<OutputImageType, OutputImageType,
RGBImageType> LabelOverlayFilterType;
LabelOverlayFilterType::Pointer labelOverlayFilter =
LabelOverlayFilterType::New();
labelOverlayFilter->SetInput(reader1);
labelOverlayFilter->SetLabelImage("result.png");
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();*
Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110629/bd1d475e/attachment.htm>
More information about the Insight-users
mailing list