[Insight-users] add two images

john smith mkitkinsightuser at gmail.com
Wed Jun 29 10:29:10 EDT 2011


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/67f0f76c/attachment.htm>


More information about the Insight-users mailing list