[Insight-users] problem in using itkLabelOverlayImageFilter in 3D

john smith mkitkinsightuser at gmail.com
Thu Jun 30 10:40:13 EDT 2011


I have noticed that when I open the output.hdr with Bioimage Suite I get the
strange results. But when I open the output.hdr with itk snap, I do not have
any problem.Do you know why is this happening? I will try to display it just
using ITK libraries in my application. Should I expect to have problem?

Thanks

2011/6/30 robert tamburo <robert.tamburo at gmail.com>

> Actually, the documentation for AnalyzeImageIO indicates an RGB image is an
> acceptable image format. Looks like there might be a bug.
>
>
> On Thu, Jun 30, 2011 at 10:25 AM, robert tamburo <robert.tamburo at gmail.com
> > wrote:
>
>> It appears the Analyze file format does not handle RGB images well (should
>> an exception be thrown or concept checking catch this?). If you output the
>> image as a meta or raw image (use .mhd or .raw file name extensions),
>> results should be as expected.
>>
>>
>> On Thu, Jun 30, 2011 at 9:48 AM, robert tamburo <robert.tamburo at gmail.com
>> > wrote:
>>
>>> Can you send me Region.hdr and Result.hdr?
>>>
>>>
>>> On Thu, Jun 30, 2011 at 9:46 AM, john smith <mkitkinsightuser at gmail.com>wrote:
>>>
>>>> I have made this change in my previous code and now I do not get any
>>>> errors. But when I run the algorithm I get very strange results. I get a
>>>> volume with confused the red and blue colors and not the blue contour of the
>>>> label image added on the initial grayscale 3D image. I hope someone could
>>>> help as I cannot understand the reason why I am getting these results.
>>>>
>>>>
>>>> Thanks in advance
>>>>
>>>> 2011/6/30 john smith <mkitkinsightuser at gmail.com>
>>>>
>>>>> I have made this change in my previous code and now I do not get any
>>>>> errors. But when I run the algorithm I get very strange results. I send a
>>>>> docx file including the two inputs and the output of
>>>>> itkLabelOverlayImageFilter. I hope someone to help me as I cannot understand
>>>>> the reason why I am getting these results.
>>>>>
>>>>> Thanks in advance
>>>>>
>>>>> 2011/6/30 john smith <mkitkinsightuser at gmail.com>
>>>>>
>>>>>> I have made this change in my previous code and now I do not get any
>>>>>> errors. But when I run the algorithm I get very strange results. I send a
>>>>>> docx file including the two inputs and the output of
>>>>>> itkLabelOverlayImageFilter. I hope someone to help me as I cannot understand
>>>>>> the reason why I am getting these results.
>>>>>>
>>>>>> Thanks in advance
>>>>>>
>>>>>> 2011/6/30 john smith <mkitkinsightuser at gmail.com>
>>>>>>
>>>>>>> I have made this change in my previous code and now I do not get any
>>>>>>> errors. But when I run the algorithm I get very strange results. I send a
>>>>>>> docx file including the two inputs and the output of
>>>>>>> itkLabelOverlayImageFilter. I hope someone to help me as I cannot understand
>>>>>>> the reason why I am getting these results.
>>>>>>>
>>>>>>> Thanks in advance
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2011/6/30 john smith <mkitkinsightuser at gmail.com>
>>>>>>>
>>>>>>>> You have right. I will post the solution for 2D immediatly.
>>>>>>>>
>>>>>>>> Thanks for your response
>>>>>>>>
>>>>>>>>
>>>>>>>> 2011/6/30 robert tamburo <robert.tamburo at gmail.com>
>>>>>>>>
>>>>>>>>> Your typedef for RGBImageType does not have a template parameter
>>>>>>>>> for dimension.
>>>>>>>>>
>>>>>>>>> Also, it'd be nice if you posted your solution to your previous
>>>>>>>>> error for the benefit of other ITK users that may encounter the same
>>>>>>>>> problem.
>>>>>>>>>
>>>>>>>>> On Thu, Jun 30, 2011 at 8:45 AM, john smith <
>>>>>>>>> mkitkinsightuser at gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> 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();
>>>>>>>>>>
>>>>>>>>>> _____________________________________
>>>>>>>>>> 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/20110630/c03ebe0b/attachment.htm>


More information about the Insight-users mailing list