Hi,<br><br>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:<br><br>-----------------------------------------------------------------------------------------------------------<br>

vtkXMLImageDataReader* vtkxmlreader = vtkXMLImageDataReader::New();<br>vtkxmlreader->SetFileName((LPCSTR) inputfile);<br><br>vtkImageFFT* fft = vtkImageFFT::New();<br>fft->SetInputConnection(vtkxmlreader->GetOutputPort());<br>
<br>vtkXMLImageDataWriter* vtkxmlwriter = vtkXMLImageDataWriter::New();<br>vtkxmlwriter->SetInputConnection(fft->GetOutputPort());<br>vtkxmlwriter->SetFileName("C:\\testfft.vti");<br>vtkxmlwriter->Write();<br>
<br>vtkxmlreader->Delete();<br>fft->Delete();<br>vtkxmlwriter->Delete();<br>--------------------------------------------------------------------------------------------------------------<br><br>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<br>
<br>outPtr = outData->GetScalarPointerForExtent(outExt);<br><br>This statement always return NULL, because vtkImageData::GetArrayPointer has an if-statement that does the following:<br><br>  if (idx < 0 || idx > array->GetMaxId())<br>
    {<br>    vtkErrorMacro("Coordinate (" << coordinate[0] << ", " << coordinate[1]<br>                  << ", " << coordinate[2] << ") out side of array (max = "<br>
                  << array->GetMaxId());<br>    return NULL;<br>    }<br><br>Since the scalar array of the output image has not been initialized, MaxId is always -1 and NULL is always returned.<br><br>Run-time error therefore must occur at vtkImageFFT::vtkImageFFTExecute.<br>
<br>Could anyone tell me whether there is anything a user can do? I don't want to change the vtk code.<br><br>Thanks,<br>Bernard<br><br><br><br>