[vtkusers] casting?? (vtkImageData* -> vtkDataSet*)

oliveira at alumni.deec.uc.pt oliveira at alumni.deec.uc.pt
Fri Jul 11 04:36:43 EDT 2003


I'm not sure but I think you must pass your data through the
vtktrianglefilter before vtkPolyDataNormals because the vtkPolyDataNormals
only accepts triangles as input.

hope this help.



> hi guys
>
> i am getting a compilation error at the following block of code:
>
>  //read the data from the files
>  vtkImageReader2 *reader1 = vtkImageReader2::New();
>
>  reader1->SetFileDimensionality(2);
>  reader1->SetNumberOfScalarComponents(1);
>  reader1->SetFilePrefix("/home/christos/VIVE02/data/countour1/ABDL
> 15436 one contour");
>  //reader1->SetFilePrefix("/home/christos/VIVE02/data/data1/ABDL 14427
> binary.lhd/ABDL14427");
>  reader1->SetFilePattern("%s.l%.2d");
>  //reader1->SetFilePattern("%s.L%.2d");
>  reader1->SetDataByteOrderToBigEndian();
>
> reader1->SetDataScalarTypeToUnsignedChar();
>
>  reader1->SetDataExtent(0,245,0,245,0,78);
>  reader1->SetDataSpacing(1.1211,1.1211,2.5);
>  reader1->SetDataOrigin(0, 0, 0);
>
>  //rendering stuff
>  vtkContourFilter *dataExtractor = vtkContourFilter::New();
>  dataExtractor->SetInput(reader1->GetOutput());
>
>  vtkPolyDataNormals *dataNormals = vtkPolyDataNormals::New();
>  dataNormals-> SetInput(dataExtractor->GetOutput());
>  dataNormals->SetFeatureAngle(60.0);
>
>  vtkPolyDataMapper *dataMapper = vtkPolyDataMapper::New(); *//LINE 88*
>  dataMapper->SetInput(dataNormals->GetOutput());
>  dataMapper->ScalarVisibilityOff();
>
>
>
> the compilation error is the following:
>
>
> asm3d_rawloader.cpp: In member function `void
> asm3D_RawLoader::reader()': asm3d_rawloader.cpp:81: no matching
> function for call to
> `vtkContourFilter::
> SetInput(vtkImageData*)'
> /usr/include/vtk/vtkDataSetToPolyDataFilter.h:44: candidates are:
> virtual void
> vtkDataSetToPolyDataFilter::SetInput(vtkDataSet*)
>
> do I have to cast the reader1->GetOutput() to type vtkImageData*?
> is there another way to do this?
> i ve tried casting... it compiled but then it has thrown an error at
> the  next block of code during run time
> (error follows)
>
> runtime error:
>
> ERROR: In /home/bellet/rpm/BUILD/VTK/Graphics/vtkPolyDataNormals.cxx,
> line 88
> vtkPolyDataNormals (0x80c2710): No data to generate normals for!
>
> so i am thinking if by casting the vtkImageData* to vtkDataSet its
> causing it to throw this error...
> i would appreciate any help
> christos
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> <http://public.kitware.com/cgi-bin/vtkfaq> Follow this link to
> subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers






More information about the vtkusers mailing list