[vtkusers] how to use vtk's FFT?

P B chose29 at hotmail.com
Sat Oct 4 11:07:35 EDT 2008




Hi everyone,    someone has to have used FFT in vtk. Why do I have unusual values in the result of my FFT? 
 
The original image's type is unsigned short. I have tried to enlarge the image and pad with 0 but that doesn't help. Should I just replace those unusual values with 0?
 
I would really appreciate any help or hints! This keeps me from applying a high pass filter to MR images for preprocessing to test another algorithm.
 
Thanks!
Pascale  


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 beforevtkImageCast * ImCast1 = vtkImageCast::New();ImCast1->SetInput(VtkImage);ImCast1->SetOutputScalarTypeToFloat();ImCast1->Modified();ImCast1->Update(); 
// convert using FFTvtkImageFFT * FFT = vtkImageFFT::New();FFT->SetDimensionality(3);FFT->SetInput(ImCast1->GetOutput());FFT->Modified();FFT->Update();// come back to spatial domainvtkImageRFFT * 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 1RealComponents->Update(); 
 
// Here: RealComponents contain -1.#QNAN00 
vtkImageCast * ImCast = vtkImageCast::New();ImCast->SetInput(RealComponents->GetOutput());ImCast->SetOutputScalarTypeToUnsignedShort();ImCast->Modified();ImCast->Update();// vtk viewervtkImageViewer * 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/20081004/67dd676d/attachment.htm>


More information about the vtkusers mailing list