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-&gt;SetFileName((LPCSTR) inputfile);<br><br>vtkImageFFT* fft = vtkImageFFT::New();<br>fft-&gt;SetInputConnection(vtkxmlreader-&gt;GetOutputPort());<br>
<br>vtkXMLImageDataWriter* vtkxmlwriter = vtkXMLImageDataWriter::New();<br>vtkxmlwriter-&gt;SetInputConnection(fft-&gt;GetOutputPort());<br>vtkxmlwriter-&gt;SetFileName(&quot;C:\\testfft.vti&quot;);<br>vtkxmlwriter-&gt;Write();<br>
<br>vtkxmlreader-&gt;Delete();<br>fft-&gt;Delete();<br>vtkxmlwriter-&gt;Delete();<br>--------------------------------------------------------------------------------------------------------------<br><br>I understand why the error occurred, but didn&#39;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-&gt;GetScalarPointerForExtent(outExt);<br><br>This statement always return NULL, because vtkImageData::GetArrayPointer has an if-statement that does the following:<br><br>  if (idx &lt; 0 || idx &gt; array-&gt;GetMaxId())<br>
    {<br>    vtkErrorMacro(&quot;Coordinate (&quot; &lt;&lt; coordinate[0] &lt;&lt; &quot;, &quot; &lt;&lt; coordinate[1]<br>                  &lt;&lt; &quot;, &quot; &lt;&lt; coordinate[2] &lt;&lt; &quot;) out side of array (max = &quot;<br>
                  &lt;&lt; array-&gt;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&#39;t want to change the vtk code.<br><br>Thanks,<br>Bernard<br><br><br><br>