<div dir="ltr">The input was a contour file for a tumor target in vtk format. The error occurs when I run it. Compiling and linking are fine. I tried to debug it. However, the debugger pointed to <div><br></div><div><div>#else /* _WINMAIN_ */</div>
<div><br></div><div>#ifdef WPRFLAG</div><div> __winitenv = envp;</div><div> mainret = wmain(argc, argv, envp);</div><div>#else /* WPRFLAG */</div><div> __initenv = envp;</div><div> mainret = main(argc, argv, envp); <============== problem happens!</div>
<div>#endif /* WPRFLAG */</div><div><br></div><div>#endif /* _WINMAIN_ */</div><div><br></div><div> if ( !managedapp )</div><div> exit(mainret);</div><div><br></div><div> _cexit();</div>
<div><br></div><div><br></div></div><div>in crtexe.c file....No number of points reported at all.</div><div><br></div><div><br></div><div><br><div><br><div class="gmail_quote">On Mon, Oct 13, 2008 at 10:37 AM, David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><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"><div><div></div><div class="Wj3C7c">On Mon, Oct 13, 2008 at 11:23 AM, Ming Chao <span dir="ltr"><<a href="mailto:mingchao2005@gmail.com" target="_blank">mingchao2005@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div><div></div><div class="Wj3C7c"><div dir="ltr"><span style="border-collapse:collapse">Recently I updated my VTK to Release <a href="http://5.2.0." style="color:rgb(0, 0, 204)" target="_blank">5.2.0.</a> However, I encountered an error when using the function GetNumberOfPoints in using vtkPoints. In the past when I used a earlier version I didn't have this problem. My code remains the same, but I got an error now. Any help would be appreciated. <div>
<br></div><div>The sample code is shown below:</div><div><br></div><div><div>#include "itkImage.h"</div><div><br></div><div>#include "itkImageFileReader.h"</div><div>#include "itkImageFileWriter.h"</div>
<div><br></div><div>#include "vtkCellArray.h"</div><div>#include "vtkPoints.h"</div><div>#include "vtkPolyData.h"</div><div>#include "vtkPolyDataWriter.h"</div><div>#include "vtkPolyDataReader.h"</div>
<div>#include "vtkDoubleArray.h"</div><div>#include "vtkPointData.h"</div><div><br></div><div>#include <fstream></div><div><br></div><div>// ------ end of header files ------</div><div><br></div>
<div><br></div><div><br></div><div>const unsigned int Dimension = 3;</div><div>typedef float VectorComponentType;</div><div><br></div><div>typedef itk::Vector< VectorComponentType, Dimension ><span style="white-space:pre">                        </span> VectorType;</div>
<div>typedef itk::Image< VectorType, Dimension ><span style="white-space:pre">                                        </span> DeformationFieldType;</div><div>typedef itk::DeformationFieldSource< DeformationFieldType ><span style="white-space:pre">                </span> DeformationSourceType;</div>
<div><br></div><div>typedef float PixelType;</div><div>typedef itk::Image< PixelType, Dimension ><span style="white-space:pre">                                                </span> ImageType;</div><div>//typedef itk::ImageFileReader< ImageType ><span style="white-space:pre">                                                </span> ReaderType;</div>
<div>typedef itk::ImageFileWriter< ImageType ><span style="white-space:pre">                                                </span> WriterType;</div><div><br></div><div>typedef itk::ImageFileReader< DeformationFieldType > DeformationFieldReaderType;</div>
<div><br></div><div>typedef itk::WarpImageFilter< ImageType, ImageType, DeformationFieldType > FilterType;</div><div><br></div><div>typedef itk::LinearInterpolateImageFunction< ImageType, double > InterpolaterType;</div>
<div><br></div><div>typedef itk::Point< double, Dimension> 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 deformationFieldReader;</div><div><br></div><div>InterpolaterType::Pointer 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 << " Starting....... " << std::endl;</div><div><br></div>
<div><span style="white-space:pre">        </span>if( argc < 1 ) {</div><div><span style="white-space:pre">                </span>std::cerr << "Missing Parameters " << std::endl;</div><div><span style="white-space:pre">                </span>std::cerr << "Usage: " << argv[0];</div>
<div><span style="white-space:pre">                </span>std::cerr << "fixedImage ";</div><div><span style="white-space:pre">                </span>std::cerr << "contour " << 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 = 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->SetFileName( argv[1] );</div>
<div><br></div><div><span style="white-space:pre">        </span>try {</div><div><span style="white-space:pre">                </span>contourReader->Update();</div><div><span style="white-space:pre">        </span>}</div><div><span style="white-space:pre">        </span>catch( itk::ExceptionObject & excp_poly ) {</div>
<div><span style="white-space:pre">                </span>std::cerr << "Exception thrown " << std::endl;</div><div><span style="white-space:pre">                </span>std::cerr << excp_poly << 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->DeepCopy( contourReader->GetOutput() );</div><div><span style="white-space:pre">        </span>contourReader->Delete();</div><div><br></div><div><span style="white-space:pre">        </span>vtkPoints *points = poly->GetPoints();</div>
<div><span style="white-space:pre">        </span></div><div><span style="white-space:pre">        </span>//vtkFloatArray *array = vtkFloatArray::New();</div><div><span style="white-space:pre">        </span>//array->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->GetNumberOfPoints();</div><div><br></div><div>
<span style="white-space:pre">        </span>std::cout << "total number of points = " << NumberOfTotalPoints << 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></div></div>_______________________________________________<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>
</blockquote></div><br></div></div></div>