[Insight-users] need help in using itkLabelOverlayImageFilter

robert tamburo robert.tamburo at gmail.com
Wed Jun 29 13:15:36 EDT 2011


Source of errors:
*  labelOverlayFilter->SetInput(reader1);
  labelOverlayFilter->**SetLabelImage("result.png");*
*
*
On Wed, Jun 29, 2011 at 1:11 PM, john smith <mkitkinsightuser at gmail.com>wrote:

> 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
>
> _____________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110629/595d848b/attachment.htm>


More information about the Insight-users mailing list