[Insight-users] add two images
john smith
mkitkinsightuser at gmail.com
Wed Jun 29 10:14:39 EDT 2011
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/8e7e068f/attachment.htm>
More information about the Insight-users
mailing list