[Insight-users] ITK example that sums multiple metaheader images
Stéphane CALANDE
scalande at gmail.com
Wed Oct 22 05:31:12 EDT 2008
Finally, I think that "itkAddImageFilter" is not what I need.
Which function can I use to create a program that takes multiple 3D
images.mhd as input and create as output one 3D image.mhd containing the
average(mean) of the multiple images ?
Any help is appreciated...
Thank you !
Stéphane
2008/10/22 Stéphane CALANDE <scalande at gmail.com>
> Hi Luis, hi everybody...
>
>
> I have little problems with the program I created to add my images (see
> former mail) : in fact I badly expressed myself.
> I don't want a program that "sums" my 3D metaheaders images, but I want a
> program that give, as output, a file containing a MEAN of the images.
>
> If I have 10 images represented by different "grey-level", the image I want
> is an other "grey-level" one (but now the problem is that the output image
> is black and white, probably because of the SUM, isn't it?)
>
>
> Luis, I'd like to know if the program you gave me (just under this mail)
> can resolve that problem ?
>
> I'm trying to compile it but the variable "adder" is undeclared... What is
> the type of "adder" ? Can you help me ?
>
>
> Thank you very much !!
>
>
>
> Stéphane
>
>
> 2008/10/16 Luis Ibanez <luis.ibanez at kitware.com>
>
>
>> Hi Stéphane
>>
>> It should be relatively straight forward to implement this.
>>
>> Put the list of filenames in an array of std::strings called
>> "name" and do the following:
>>
>>
>> reader->SetFileName( name[0] );
>> reader->Update();
>> ImageType::Pointer inputImage1 = reader->GetOutput();
>> adder->SetInput1( inputImage1 );
>>
>> for( int i=0; i<numberOfFiles; i++)
>> {
>> reader->SetFileName( name[i] );
>> reader->Update();
>> ImageType::Pointer inputImage2 = reader->GetOutput();
>> inputImage2->DisconnectPipeline();
>> adder->SetInput2( inputImage2 );
>> adder->Update();
>> ImageType::Pointer sumImage = adder->GetOutput();
>> sumImage->DisconnectPipeline();
>> adder->SetInput1( sumImage );
>> }
>>
>> // Here sumImage has the output.
>>
>>
>> Note the use of the DisconnectPipeline() method, that
>> makes possible to reuse the reader and the adder filter.
>>
>>
>>
>> Regards,
>>
>>
>> Luis
>>
>>
>> -------------------------
>> Stéphane CALANDE wrote:
>>
>>> Hi,
>>>
>>>
>>> I'm a newbie in ITK and I'm looking for a example of program that takes,
>>> as input, several 3D metaheader image (.mhd) having the same spacing,
>>> size,... and that "sums" these images to create one "total_Image.mhd" having
>>> the same size, spacing,... than the input ones.
>>>
>>>
>>> Does it exist ?
>>>
>>>
>>> Thank you very much.
>>>
>>>
>>>
>>>
>>> Regards,
>>>
>>>
>>> Stéphane
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20081022/8e869413/attachment.htm>
More information about the Insight-users
mailing list