<div dir="ltr">What input data do you pass to this code?<br>What is the error message you get?<br>What is the number of points reported? What is the number you expect?<br><br><br><div class="gmail_quote">On Mon, Oct 13, 2008 at 11:23 AM, Ming Chao <span dir="ltr">&lt;<a href="mailto:mingchao2005@gmail.com">mingchao2005@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><span style="border-collapse: collapse;">Recently I updated my VTK to Release&nbsp;<a href="http://5.2.0." style="color: rgb(0, 0, 204);" target="_blank">5.2.0.</a>&nbsp;However, I encountered an error when using the function GetNumberOfPoints in using vtkPoints. In the past when I used a earlier version I didn&#39;t have this problem. My code remains the same, but I got an error now. Any help would be appreciated.&nbsp;<div>

<br></div><div>The sample code is shown below:</div><div><br></div><div><div>#include &quot;itkImage.h&quot;</div><div><br></div><div>#include &quot;itkImageFileReader.h&quot;</div><div>#include &quot;itkImageFileWriter.h&quot;</div>

<div><br></div><div>#include &quot;vtkCellArray.h&quot;</div><div>#include &quot;vtkPoints.h&quot;</div><div>#include &quot;vtkPolyData.h&quot;</div><div>#include &quot;vtkPolyDataWriter.h&quot;</div><div>#include &quot;vtkPolyDataReader.h&quot;</div>

<div>#include &quot;vtkDoubleArray.h&quot;</div><div>#include &quot;vtkPointData.h&quot;</div><div><br></div><div>#include &lt;fstream&gt;</div><div><br></div><div>// ------ end of header files &nbsp;------</div><div><br></div>

<div><br></div><div><br></div><div>const &nbsp; unsigned int &nbsp; Dimension = 3;</div><div>typedef float VectorComponentType;</div><div><br></div><div>typedef itk::Vector&lt; VectorComponentType, Dimension &gt;<span style="white-space: pre;">                        </span>&nbsp;&nbsp;VectorType;</div>

<div>typedef itk::Image&lt; VectorType, &nbsp;Dimension &gt;<span style="white-space: pre;">                                        </span>&nbsp;&nbsp;DeformationFieldType;</div><div>typedef itk::DeformationFieldSource&lt; DeformationFieldType &gt;<span style="white-space: pre;">                </span>&nbsp;&nbsp;DeformationSourceType;</div>

<div><br></div><div>typedef float PixelType;</div><div>typedef itk::Image&lt; PixelType, Dimension &gt;<span style="white-space: pre;">                                                </span>&nbsp;&nbsp;ImageType;</div><div>//typedef itk::ImageFileReader&lt; &nbsp;ImageType &gt;<span style="white-space: pre;">                                                </span>&nbsp;&nbsp;ReaderType;</div>

<div>typedef itk::ImageFileWriter&lt; &nbsp;ImageType &gt;<span style="white-space: pre;">                                                </span>&nbsp;&nbsp;WriterType;</div><div><br></div><div>typedef itk::ImageFileReader&lt; DeformationFieldType &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DeformationFieldReaderType;</div>

<div><br></div><div>typedef itk::WarpImageFilter&lt; ImageType, ImageType, DeformationFieldType &gt; FilterType;</div><div><br></div><div>typedef itk::LinearInterpolateImageFunction&lt; ImageType, double &gt; InterpolaterType;</div>

<div><br></div><div>typedef itk::Point&lt; double, Dimension&gt; PointType;</div><div><br></div><div>//ReaderType::Pointer<span style="white-space: pre;">                        </span>fixedReader;</div><div>WriterType::Pointer<span style="white-space: pre;">                        </span>outputWriter;</div>

<div><br></div><div>DeformationFieldReaderType::Pointer &nbsp;deformationFieldReader;</div><div><br></div><div>InterpolaterType::Pointer &nbsp; interpolator;</div><div><br></div><div>//PointType point;</div><div><br></div><div>//---------------------------------------------------------------------------------------</div>

<div><br></div><div>int main( int argc, char * argv[] )</div><div>{</div><div><br></div><div><span style="white-space: pre;">        </span>std::cout &lt;&lt; &quot; Starting....... &quot; &lt;&lt; std::endl;</div><div><br></div>

<div><span style="white-space: pre;">        </span>if( argc &lt; 1 ) {</div><div><span style="white-space: pre;">                </span>std::cerr &lt;&lt; &quot;Missing Parameters &quot; &lt;&lt; std::endl;</div><div><span style="white-space: pre;">                </span>std::cerr &lt;&lt; &quot;Usage: &quot; &lt;&lt; argv[0];</div>

<div><span style="white-space: pre;">                </span>std::cerr &lt;&lt; &quot;fixedImage &quot;;</div><div><span style="white-space: pre;">                </span>std::cerr &lt;&lt; &quot;contour &quot; &lt;&lt; std::endl;</div><div><span style="white-space: pre;">                </span>return 1;</div>

<div><span style="white-space: pre;">        </span>}</div><div><br></div><div><span style="white-space: pre;">        </span>outputWriter<span style="white-space: pre;">        </span>= WriterType::New();</div><div><br></div><div><span style="white-space: pre;">        </span>interpolator &nbsp; &nbsp;= InterpolaterType::New();</div>

<div><br></div><div><span style="white-space: pre;">        </span>// read in the original contour</div><div><span style="white-space: pre;">        </span>vtkPolyDataReader *contourReader = vtkPolyDataReader::New();</div><div><span style="white-space: pre;">        </span>contourReader-&gt;SetFileName( argv[1] );</div>

<div><br></div><div><span style="white-space: pre;">        </span>try {</div><div><span style="white-space: pre;">                </span>contourReader-&gt;Update();</div><div><span style="white-space: pre;">        </span>}</div><div><span style="white-space: pre;">        </span>catch( itk::ExceptionObject &amp; excp_poly ) {</div>

<div><span style="white-space: pre;">                </span>std::cerr &lt;&lt; &quot;Exception thrown &quot; &lt;&lt; std::endl;</div><div><span style="white-space: pre;">                </span>std::cerr &lt;&lt; excp_poly &lt;&lt; std::endl;</div>

<div><span style="white-space: pre;">                </span>return EXIT_FAILURE;</div><div><span style="white-space: pre;">        </span>}</div><div><br></div><div><span style="white-space: pre;">        </span>vtkPolyData *poly = vtkPolyData::New();</div>

<div><span style="white-space: pre;">        </span>poly-&gt;DeepCopy( contourReader-&gt;GetOutput() );</div><div><span style="white-space: pre;">        </span>contourReader-&gt;Delete();</div><div><br></div><div><span style="white-space: pre;">        </span>vtkPoints *points = poly-&gt;GetPoints();</div>

<div><span style="white-space: pre;">        </span></div><div><span style="white-space: pre;">        </span>//vtkFloatArray *array = &nbsp;vtkFloatArray::New();</div><div><span style="white-space: pre;">        </span>//array-&gt;SetNumberOfComponents(3);</div>

<div><br></div><div><span style="white-space: pre;">        </span>//return 0;</div><div><br></div><div><span style="white-space: pre;">        </span>int NumberOfTotalPoints = points-&gt;GetNumberOfPoints();</div><div><br></div><div>

<span style="white-space: pre;">        </span>std::cout &lt;&lt; &quot;total number of points = &quot; &lt;&lt; NumberOfTotalPoints &lt;&lt; std::endl;</div><div><br></div><div><span style="white-space: pre;">        </span></div><div>

<br></div><div><br></div><div><span style="white-space: pre;">        </span>return 0;</div><div><br></div><div>}</div></div></span></div>
<br>_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>