[Insight-users] RE : RE : Mean image
Yankam Njiwa Josiane Adrienne
njiwa at biomed.ee.ethz.ch
Mon May 26 11:55:19 EDT 2008
Assume that i have three images I1, I2 and I3 what i would like to is:
I= (I1+I2+I3)/3.0;
Do you think that it is feasible? Thanks a lot for your answers.
Regards,
Josiane.
________________________________
De: Cameron Burnett [mailto:w_e_b_m_a_s_t_e_r_6_9 at hotmail.com]
Date: lun. 26/05/2008 17:43
À: Yankam Njiwa Josiane Adrienne
Cc: insight-users at itk.org
Objet : RE: RE : [Insight-users] Mean image
The mean of what exactly? The first time you were dividing the pointer by 3, and with the GetOutput thing I'm not even sure what that's doing... it was just a suggestion.
Do you just want the program to take 3 images then create an image that is a mix of all 3? For example, 3 poor images that combine to make 1 good image?
Whatever you're doing I don't think its that simple. Maybe there is a filter that does what you want. Like the Addition filter that you used.
________________________________
> Subject: RE : [Insight-users] Mean image
> Date: Mon, 26 May 2008 17:33:29 +0200
> From: njiwa at biomed.ee.ethz.ch
> To: w_e_b_m_a_s_t_e_r_6_9 at hotmail.com
> CC: insight-users at itk.org
>
> Hi Cameron,
>
> Thanks a lot for your answer, but i think my problem occured when i try to perfom division. Here is my complete code. I don't exactly how i can enter this division part in my pipeline. Do you have any idea?
>
> Regards,
>
> Josiane.
>
>
>
>
>
> typedef float PixelType;
>
> typedef itk::Image< PixelType, 3 > ImageType;
>
> typedef itk::ImageFileReader< ImageType > ReaderType;
>
> typedef itk::ImageFileWriter< ImageType > WriterType;
>
> ReaderType::Pointer reader1 = ReaderType::New();
>
> ReaderType::Pointer reader2 = ReaderType::New();
>
> ReaderType::Pointer reader3 = ReaderType::New();
>
> WriterType::Pointer writer = WriterType::New();
>
> reader1->SetFileName( argv[1] );
>
> reader2->SetFileName( argv[2] );
>
> reader3->SetFileName( argv[3] );
>
> writer->SetFileName( argv[4] );
>
> reader1->Update();
>
> reader2->Update();
>
> reader3->Update();
>
>
>
> typedef itk::AddImageFilter<
>
> ImageType,
>
> ImageType,
>
> ImageType > AdditionFilterType;
>
> AdditionFilterType::Pointer addition1 = AdditionFilterType::New();
>
> AdditionFilterType::Pointer addition2 = AdditionFilterType::New();
>
> addition1->SetInput1( reader1->GetOutput() );
>
> addition1->SetInput2( reader2->GetOutput() );
>
> addition2->SetInput1( reader3->GetOutput() );
>
> addition2->SetInput2( addition1->GetOutput() );
>
> writer->SetFileName( argv[4] );
>
> writer->SetInput( addition2->GetOutput()/3.0 );// I would like here to compute the mean between the three images
>
> writer->Update();
>
> return EXIT_SUCCESS;
>
>
> ________________________________
>
> De: Cameron Burnett [mailto:w_e_b_m_a_s_t_e_r_6_9 at hotmail.com]
> Date: lun. 26/05/2008 17:18
> À: Yankam Njiwa Josiane Adrienne
> Cc: insight-users at itk.org
> Objet : RE: [Insight-users] Mean image
>
>
> I'm not sure what the 'red' line is because I can't see any colour. Maybe the problem is that you haven't called Update() on your pipeline.
>
> reader1 > addition1 > addition2 > Image
> reader2 > addition1 > addition2 > Image
> reader3 > addition2 > Image
>
> Plugging in GetOutput() will set the links like above. EG: Reader3 goes to addition2 then to Image. If you do an Image->Update() then that will update everything thats linked to Image that is before it (all the links I typed above). Then you can actually use the image :).
>
> What are you doing on this line? ImageType::Pointer Image1 =Image/3.0;
> It seems like you're dividing the pointer by 3, and I'm fairly sure you don't want to do that. Maybe ImageType::Pointer Image1 =Image->GetOutput()/3.0; might do something?? In that case I think writer->Update() WILL update your whole pipeline, and that previous problem will be fixed also.
>
>
>
>
>
> ________________________________
>
> > Date: Mon, 26 May 2008 17:01:33 +0200
> > From: njiwa at biomed.ee.ethz.ch
> > To: insight-users at itk.org
> > Subject: [Insight-users] Mean image
> >
> >
> >
> > Dear all,
> >
> > I would like to compute the mean between 3 images. I used the code bollow but the line in red seems to be false and i don't understand why. Could somebody help me please?
> >
> > Regards,
> >
> > Josiane.
> >
> >
> >
> >
> >
> > typedef itk::AddImageFilter<
> >
> > ImageType,
> >
> > ImageType,
> >
> > ImageType > AdditionFilterType;
> >
> > AdditionFilterType::Pointer addition1 = AdditionFilterType::New();
> >
> > AdditionFilterType::Pointer addition2 = AdditionFilterType::New();
> >
> > addition1->SetInput1( reader1->GetOutput() );
> >
> > addition1->SetInput2( reader2->GetOutput() );
> >
> > addition2->SetInput1( reader3->GetOutput() );
> >
> > addition2->SetInput2( addition1->GetOutput() );
> >
> > ImageType::Pointer Image = addition2->GetOutput();
> >
> > ImageType::Pointer Image1 =Image/3.0;
> >
> > writer->SetFileName( argv[4] );
> >
> > writer->SetInput( Image1 );
> >
> > writer->Update();
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
>
>
> ________________________________
>
> Email Australia. Be part of history. Take part in Australia's first e-mail archive with <http://emailaustralia.ninemsn.com.au/>
________________________________
at CarPoint.com.au It's simple! Sell your car for just $30 <http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT>
More information about the Insight-users
mailing list