[Insight-users] Problem with Multiplying Two Complex Images, and a big thanks to ITK community for this extensive body of work!

Saurabh Sethi sethi.saurabh at gmail.com
Mon Nov 24 07:22:44 EST 2008


Hi All,

I recently started using the ITK after a lot of word of mouth publicity from
peer groups :)

And I must say that im very impressed by it.

Have been going through all of the Software guide and Message Archives since
some time now.

I have a bit of problem with the FFT / IFFT implementation. There is some
"Access Violation" that I'm unable to fix since some time.

Maybe I have used the Complex Image in a wrong ( read Silly) way which I'm
unable to debug now.

It would be great if someone could help ->



I need to convolve two images (one is the test image, and other is my data
image)

For this, I had thought of first doing the FFT, then Multiplying both the
images and taking the IFFT in the end.



Here is my pseudo code:



read image 1 (im1)

Padd the image to nearest power of 2.

compute its FFT. (I'm using FFTRealToComplexConjugateImageFilter)



read image 2. (im2)

Padd the image to the same power of 2.

compute its FFT.



Multiply both the images

MultiplyImageFilter->SetInput1(fft_input);

MultiplyImageFilter->SetInput2(fft_weight);

MultiplyImageFilter->Update();



IT is here that this strange error occurs:



Unhandled exception at 0x0046193a in ItkScatter.exe: 0xC0000005: Access
violation reading location 0x61371000.



And the code breaks in at this place  in file
itkDefaultPixelAccessorFunctor.h:

inline const ExternalPixelType Get( const InternalPixelType & input ) const

{

   return m_PixelAccessor.Get( input );

}





Below is the relevant part of the code:



typedef itk::FFTRealToComplexConjugateImageFilter<pixelTypeC, dim2D>
FFTFilterType;

typedef itk::FFTComplexConjugateToRealImageFilter<pixelTypeC, dim2D>
IFFTFilterType;

typedef FFTFilterType::OutputImageType ComplexImageType;

typedef itk::MultiplyImageFilter<ComplexImageType, ComplexImageType,
ComplexImageType>MultiplyImageFilterType;//>



constPadImage->SetPadLowerBound(paddin);// specifying padding options

constPadImage->SetPadUpperBound(paddin);

constPadImage->SetInput(inputImage_C); // set padding filter input.

fftFilter->SetInput(constPadImage->GetOutput()); //set the fft.

ComplexImageType::Pointer fft_input = fftFilter->GetOutput(); // fft filter
done on image.

fftFilter->Update();



constPadImage2->SetPadUpperBound(paddin_wt_upper);

constPadImage2->SetInput(inputImage2); // set padding filter input.

fft_wtFilter->SetInput(constPadImage2->GetOutput()); //set the fft.

ComplexImageType::Pointer fft_weight= fft_wtFilter->GetOutput();// fft
filter done on image.

fft_wtFilter->Update();



MultiplyImageFilter->SetInput1(fft_input);

MultiplyImageFilter->SetInput2(fft_weight);

MultiplyImageFilter->Update() // Error occurs here.

ifftFilter->SetInput(MultiplyImageFilter->GetOutput());

ifftFilter->Update();



Hi,Many thanks

Saurabh

New ITKer..






2008/11/21 chensiqi <pidanchen at hotmail.com>

>
> Hi, ITKers,
>
> Does anybody know how to load sequence items using ITK? Such as "ROI
> Contour Sequence".
> Or if you know how to do it in GDCM, and integrate into ITK, that will also
> be very helpful.
>
> Thanks
> Siqi
>
>
> ------------------------------
> 更多热辣资讯尽在新版MSN首页! 立刻访问! <http://cn.msn.com/>
>
> _______________________________________________
> 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/20081124/f934fc9a/attachment.htm>


More information about the Insight-users mailing list