[vtkusers] Is there a bug in vtkImageFFT?
Bernard Chiu
bcychiu at alumni.uwo.ca
Wed Apr 15 19:08:27 EDT 2009
Hi,
I am trying to understand how vtkImageFFT works before using a similar
method to process my image. I found that there is a run-time error. I wrote
the following:
-----------------------------------------------------------------------------------------------------------
vtkXMLImageDataReader* vtkxmlreader = vtkXMLImageDataReader::New();
vtkxmlreader->SetFileName((LPCSTR) inputfile);
vtkImageFFT* fft = vtkImageFFT::New();
fft->SetInputConnection(vtkxmlreader->GetOutputPort());
vtkXMLImageDataWriter* vtkxmlwriter = vtkXMLImageDataWriter::New();
vtkxmlwriter->SetInputConnection(fft->GetOutputPort());
vtkxmlwriter->SetFileName("C:\\testfft.vti");
vtkxmlwriter->Write();
vtkxmlreader->Delete();
fft->Delete();
vtkxmlwriter->Delete();
--------------------------------------------------------------------------------------------------------------
I understand why the error occurred, but didn't know what is the best
approach to make it work. I found that in the vtkImageFFT::ThreadedExecute
method, there is a line
outPtr = outData->GetScalarPointerForExtent(outExt);
This statement always return NULL, because vtkImageData::GetArrayPointer has
an if-statement that does the following:
if (idx < 0 || idx > array->GetMaxId())
{
vtkErrorMacro("Coordinate (" << coordinate[0] << ", " << coordinate[1]
<< ", " << coordinate[2] << ") out side of array (max = "
<< array->GetMaxId());
return NULL;
}
Since the scalar array of the output image has not been initialized, MaxId
is always -1 and NULL is always returned.
Run-time error therefore must occur at vtkImageFFT::vtkImageFFTExecute.
Could anyone tell me whether there is anything a user can do? I don't want
to change the vtk code.
Thanks,
Bernard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090415/30e42a87/attachment.htm>
More information about the vtkusers
mailing list