[Insight-users] add two images
robert tamburo
robert.tamburo at gmail.com
Wed Jun 29 11:02:48 EDT 2011
It's in the Review directory. I use it with 3.18 so 3.20 should be fine.
Here's the code I use:
typedef itk::LabelOverlayImageFilter<CharImageType, CharImageType,
RGBImageType> LabelOverlayFilterType;
LabelOverlayFilterType::Pointer labelOverlayFilter =
LabelOverlayFilterType::New();
labelOverlayFilter->SetInput(inputImage);
labelOverlayFilter->SetLabelImage(labelImage);
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();
On Wed, Jun 29, 2011 at 10:51 AM, john smith <mkitkinsightuser at gmail.com>wrote:
> Do you know if there is a good example of itkLabelOverlayImageFilter?
> Also, I am using ITK v3.2. Is itkLabelOverlayImageFilter suitable for this
> version?Because I can't find it in the libraries.
>
> Thanks
>
> 2011/6/29 robert tamburo <robert.tamburo at gmail.com>
>
>> I suggest using itkLabelOverlayImageFilter . It applies a color map to a
>> label image (segmentation image) and overlays it on the original image with
>> the ability to adjust opacity of the overlay.
>>
>>
>> On Wed, Jun 29, 2011 at 10:29 AM, john smith <mkitkinsightuser at gmail.com>wrote:
>>
>>> The problem is that the segment of my original image is white. So If this
>>> part after the segmentation is also white, then the result of AddImageFilter
>>> will not be good, concerning visualization. Also, If this part is black
>>> after segmentation then I will not have any change using AddImageFilter.
>>> What you suggest to do in this case?
>>>
>>> Thanks for your response
>>>
>>>
>>> 2011/6/29 robert tamburo <robert.tamburo at gmail.com>
>>>
>>>> If your segmented object is black and black means zero-valued, then
>>>> you're adding zero to the original image.
>>>>
>>>> On Wed, Jun 29, 2011 at 10:14 AM, john smith <
>>>> mkitkinsightuser at gmail.com> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I want to read two png images (one is already saved in memory and the
>>>>> other I get it from a dialog box of Qt).The first is the result of the
>>>>> segmentation (black for the segmented object) and the second is the original
>>>>> image. I use AddImage filter as it can be seen from the foloowing code but I
>>>>> do not get the right result. Could somebody tell me what I am doing wrong?
>>>>> Is it correct to use two readers?
>>>>>
>>>>> ReaderType::Pointer reader1 = ReaderType::New();
>>>>> ReaderType::Pointer reader2 = ReaderType::New();
>>>>>
>>>>> reader1->SetFileName(fileName.toStdString());
>>>>> reader2->SetFileName("result.png");
>>>>>
>>>>> reader1->Update();
>>>>> reader2->Update();
>>>>> typedef itk::AddImageFilter<
>>>>> InternalImageType,
>>>>> InternalImageType,
>>>>> OutputImageType > AddFilterType;
>>>>>
>>>>> AddFilterType::Pointer addFilter = AddFilterType::New();
>>>>> addFilter->SetInput1( reader1->GetOutput() );
>>>>> addFilter->SetInput2( reader2->GetOutput() );
>>>>>
>>>>> try
>>>>> {
>>>>> addFilter->Update();
>>>>> }
>>>>> catch( itk::ExceptionObject & err )
>>>>> {
>>>>> std::cout << "ExceptionObject caught !" << std::endl;
>>>>> std::cout << err << std::endl;
>>>>> }
>>>>>
>>>>> WriterType::Pointer writer = WriterType::New();
>>>>> writer->SetInput( addFilter->GetOutput() );
>>>>> writer->SetFileName( "addImage.png" );
>>>>> writer->Update();
>>>>>
>>>>>
>>>>> 2011/6/29 robert tamburo <robert.tamburo at gmail.com>
>>>>>
>>>>>> itkAddImageFilter
>>>>>>
>>>>>> Alternatively, itkLabelOverlayImageFilter will allow you to overlay
>>>>>> your segmentation on the original image.
>>>>>>
>>>>>> On Wed, Jun 29, 2011 at 3:17 AM, john smith <
>>>>>> mkitkinsightuser at gmail.com> wrote:
>>>>>>
>>>>>>> Hello to all,
>>>>>>>
>>>>>>> I am working in an application in order to segment an object. Well, I
>>>>>>> have managed to get the segmented contour of my object. But now I want to
>>>>>>> display this result over my initial image. Do you know how I could add two
>>>>>>> images?
>>>>>>>
>>>>>>> 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/24486925/attachment.htm>
More information about the Insight-users
mailing list