[vtkusers] Re: vtkImageFFT Magnitude

Randall Hand randall.hand at gmail.com
Wed Sep 7 15:43:20 EDT 2005


As requested, here's the code i'm using:

vtkDataSetReader *reader = vtkDataSetReader::New();
reader->SetFileName(argv[1]);
reader->Update();
reader->GetOutput()->GetPointData()->CopyAllOff();
reader->GetOutput()->GetPointData()->SetActiveScalars("Velocity");
reader->GetOutput()->GetPointData()->CopyScalarsOn();
printf("Done!\n");
// PrintStatistics(reader->GetOutput());


printf("Extracting Velocity X-Component...\n");
vtkArrayCalculator *extract = vtkArrayCalculator::New();
extract->SetInput(reader->GetOutput());
extract->SetResultArrayName("result");
extract->AddScalarVariable("x", "Velocity", 0);
extract->SetFunction("x");
extract->Update();
PrintStatistics(extract->GetOutput());

printf("Computing FFT...\n");
vtkImageFFT *fft = vtkImageFFT::New();
fft->SetInput(extract->GetOutput());
fft->SetDimensionality(3);
fft->Update();
PrintStatistics(fft->GetOutput());


printf("Computing Magnitude...\n");
vtkArrayCalculator *mag = vtkArrayCalculator::New();
mag->SetInput(fft->GetOutput());
mag->SetResultArrayName("FFTMag");
mag->AddScalarVariable("x", "result", 0);
mag->AddScalarVariable("y", "result", 1);
mag->SetFunction("(x*x) + (y*y)");
mag->Update();
PrintStatistics(mag->GetOutput());


>From the "PrintStatistics" function, the "result" array before the FFT looks 
like this:
p Array [4]: vtkDoubleArray "result", 2,097,152 points, 8 bytes per point
p Magnitude Range: -0.07686 0.07686
p Component 0 Range: -0.07686 0.07686
 And after the FFT:
p Array [0]: vtkDoubleArray "result", 2,097,152 points, 8 bytes per point
p Magnitude Range: 3.485e+19 7.803e+22
p Component 0 Range: -7.688e+22 7.688e+22
p Component 1 Range: -6.814e+22 6.814e+22
 


On 9/7/05, Randall Hand <randall.hand at gmail.com> wrote:
> 
> I have a 3D 128^3 volume of data, containing a velocity vector. I use a 
> vtkArrayCalculator to extract a single component of the velocity (X in this 
> case), and use the vtkImageFFT to compute a Fourier Transform of the data.
> 
> The original data is of the range -0.02 to 0.02, but computing the 
> magnitude of the resulting FFT dataset yields a minimum value of 6*10^20, 
> and a Maximum of over *10^24. Can anyone explain what might be happening 
> here? Parseval's theorem states that the resulting FFT should be of similar 
> magnitude to the input data.
> 
> -- 
> Randall Hand
> Visualization Scientist
> ERDC-MSRC Vicksburg, MS
> 



-- 
Randall Hand
Visualization Scientist, 
ERDC-MSRC Vicksburg, MS
Homepage: http://www.yeraze.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050907/489c5b75/attachment.htm>


More information about the vtkusers mailing list