[vtkusers] GetNumberOfPoints error when using vtkPoints

Ming Chao mingchao2005 at gmail.com
Mon Oct 13 11:53:37 EDT 2008


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
#else  /* _WINMAIN_ */

#ifdef WPRFLAG
            __winitenv = envp;
            mainret = wmain(argc, argv, envp);
#else  /* WPRFLAG */
            __initenv = envp;
            mainret = main(argc, argv, envp);      <============== problem
happens!
#endif  /* WPRFLAG */

#endif  /* _WINMAIN_ */

            if ( !managedapp )
                exit(mainret);

            _cexit();


in crtexe.c file....No number of points reported at all.




On Mon, Oct 13, 2008 at 10:37 AM, David Cole <david.cole at kitware.com> wrote:

> What input data do you pass to this code?
> What is the error message you get?
> What is the number of points reported? What is the number you expect?
>
>
> On Mon, Oct 13, 2008 at 11:23 AM, Ming Chao <mingchao2005 at gmail.com>wrote:
>
>> Recently I updated my VTK to Release 5.2.0. 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.
>> The sample code is shown below:
>>
>> #include "itkImage.h"
>>
>> #include "itkImageFileReader.h"
>> #include "itkImageFileWriter.h"
>>
>> #include "vtkCellArray.h"
>> #include "vtkPoints.h"
>> #include "vtkPolyData.h"
>> #include "vtkPolyDataWriter.h"
>> #include "vtkPolyDataReader.h"
>> #include "vtkDoubleArray.h"
>> #include "vtkPointData.h"
>>
>> #include <fstream>
>>
>> // ------ end of header files  ------
>>
>>
>>
>> const   unsigned int   Dimension = 3;
>> typedef float VectorComponentType;
>>
>> typedef itk::Vector< VectorComponentType, Dimension >   VectorType;
>> typedef itk::Image< VectorType,  Dimension >   DeformationFieldType;
>> typedef itk::DeformationFieldSource< DeformationFieldType >
>>   DeformationSourceType;
>>
>> typedef float PixelType;
>> typedef itk::Image< PixelType, Dimension >   ImageType;
>> //typedef itk::ImageFileReader<  ImageType >   ReaderType;
>> typedef itk::ImageFileWriter<  ImageType >   WriterType;
>>
>> typedef itk::ImageFileReader< DeformationFieldType >
>>  DeformationFieldReaderType;
>>
>> typedef itk::WarpImageFilter< ImageType, ImageType, DeformationFieldType >
>> FilterType;
>>
>> typedef itk::LinearInterpolateImageFunction< ImageType, double >
>> InterpolaterType;
>>
>> typedef itk::Point< double, Dimension> PointType;
>>
>> //ReaderType::Pointer fixedReader;
>> WriterType::Pointer outputWriter;
>>
>> DeformationFieldReaderType::Pointer  deformationFieldReader;
>>
>> InterpolaterType::Pointer   interpolator;
>>
>> //PointType point;
>>
>>
>> //---------------------------------------------------------------------------------------
>>
>> int main( int argc, char * argv[] )
>> {
>>
>> std::cout << " Starting....... " << std::endl;
>>
>>  if( argc < 1 ) {
>> std::cerr << "Missing Parameters " << std::endl;
>> std::cerr << "Usage: " << argv[0];
>>  std::cerr << "fixedImage ";
>> std::cerr << "contour " << std::endl;
>> return 1;
>>  }
>>
>> outputWriter = WriterType::New();
>>
>> interpolator    = InterpolaterType::New();
>>
>> // read in the original contour
>> vtkPolyDataReader *contourReader = vtkPolyDataReader::New();
>> contourReader->SetFileName( argv[1] );
>>
>> try {
>> contourReader->Update();
>> }
>> catch( itk::ExceptionObject & excp_poly ) {
>>  std::cerr << "Exception thrown " << std::endl;
>> std::cerr << excp_poly << std::endl;
>>  return EXIT_FAILURE;
>> }
>>
>> vtkPolyData *poly = vtkPolyData::New();
>>  poly->DeepCopy( contourReader->GetOutput() );
>> contourReader->Delete();
>>
>> vtkPoints *points = poly->GetPoints();
>>  //vtkFloatArray *array =  vtkFloatArray::New();
>> //array->SetNumberOfComponents(3);
>>
>> //return 0;
>>
>> int NumberOfTotalPoints = points->GetNumberOfPoints();
>>
>>  std::cout << "total number of points = " << NumberOfTotalPoints <<
>> std::endl;
>>
>>
>>
>> return 0;
>>
>> }
>>
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081013/318e09ce/attachment.htm>


More information about the vtkusers mailing list