[vtkusers] FFT and RFFT problems
Pascale Beliveau
beliveaup at gmail.com
Fri Oct 3 12:02:44 EDT 2008
Sorry to ask again, I did not get any answers, did anyone have a solution
for this problem?
Thanks
Pascale
On 10/2/08, Pascale Beliveau <beliveaup at gmail.com> wrote:
>
> Hi,
>
> I am having problems, applying FFT then RFFT to image. The image is
> created using dicom reader and there are no problems with the original data.
> But in the result of RFFT I get some intensities as -1.#QNAN00 over the
> image. I am trying to find out why that is but cannot find what could be
> wrong. Anyone had issues with this already?
>
> Thanks for helping, I've been having this problem for while now and can't
> find the problem,
> Pascale
>
>
>
> Here is the code:
>
> // cast to floating type, vtk fft only works with floats - was unsigned
> short before
> vtkImageCast * ImCast1 = vtkImageCast::New();
> ImCast1->SetInput(VtkImage);
> ImCast1->SetOutputScalarTypeToFloat();
> ImCast1->Modified();
> ImCast1->Update();
>
> // convert using FFT
> vtkImageFFT * FFT = vtkImageFFT::New();
> FFT->SetDimensionality(3);
> FFT->SetInput(ImCast1->GetOutput());
> FFT->Modified();
> FFT->Update();
>
> // come back to spatial domain
> vtkImageRFFT * RFFT = vtkImageRFFT::New();
> RFFT->SetDimensionality(3);
> RFFT->SetInputConnection(FFT->GetOutputPort());
> RFFT->Modified();
> RFFT->Update();
>
> vtkImageExtractComponents * RealComponents =
> vtkImageExtractComponents::New();
> RealComponents->SetInputConnection(RFFT->GetOutputPort());
> RealComponents->SetComponents(0); // to fetch the real part of the image,
> the imaginary is in component 1
> RealComponents->Update();
>
> // Here: RealComponents contain -1.#QNAN00
>
> vtkImageCast * ImCast = vtkImageCast::New();
> ImCast->SetInput(RealComponents->GetOutput());
> ImCast->SetOutputScalarTypeToUnsignedShort();
> ImCast->Modified();
> ImCast->Update();
>
> // vtk viewer
> vtkImageViewer * viewer = vtkImageViewer::New();
> viewer->SetInput(ImCast->GetOutput());
> viewer->SetColorWindow(256);
> viewer->SetColorLevel(50);
> vtkRenderWindowInteractor * viewInt = vtkRenderWindowInteractor::New();
> viewer->SetupInteractor(viewInt);
> viewer->Render();
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081003/09a84069/attachment.htm>
More information about the vtkusers
mailing list