[Insight-users] Display itkVoronoiDiagram2D
Steffan
ulysse.rigaud at gmail.com
Sun Jun 26 23:04:10 EDT 2011
Hello everyone,
I've discover that itk has an implementation of Voronoi, which is quite great for me:
itkVoronoiDiagram2D
itkVoronoiDiagram2DGenerator
Where itkVoronoiDiagram2DGenerator generates an itkVoronoiDiagram2D which inherit from itkMesh.
I'm trying to make it simple for now by giving 3 inputs points (Point1,Point2,Point3), and write the output Mesh in a vtkPolyData.
typedef itk::VoronoiDiagram2DGenerator<float> VoronoiDiagram2DGeneratorType;
typedef VoronoiDiagram2DGeneratorType::PointType PointType;
typedef VoronoiDiagram2DGeneratorType::VDMesh VoronoiMeshType;
typedef itk::VTKPolyDataWriter<VoronoiMeshType> PolyDataWriterType;
PointType Point1;
Point1[0] = -1; Point1[1] = 1;
PointType Point2;
Point2[0] = 1; Point2[1] = 1;
PointType Point3;
Point3[0] = 0; Point2[1] = -1;
VoronoiDiagram2DGeneratorType::Pointer voronoiGenerator = VoronoiDiagram2DGeneratorType::New();
voronoiGenerator->AddOneSeed( Point1 );
voronoiGenerator->AddOneSeed( Point2 );
voronoiGenerator->AddOneSeed( Point3 );
PolyDataWriterType::Pointer writer = PolyDataWriterType::New();
writer->SetFileName("voronoiMesh.vtk");
writer->SetInput(voronoiGenerator->GetOutput());
writer->Update();
That's give me 3 errors inside the VTKPolyDataWriter.txx:
/../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:65:0 /../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:65: instantiated from 'void itk::VTKPolyDataWriter<TInputMesh>::Update() [with TInputMesh = itk::VoronoiDiagram2D<float>]'
/../Voronoi/main.cxx:42:0 /../Voronoi/main.cxx:42: instantiated from here
/../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:191:0 /../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:191: error: invalid conversion from 'itk::CellInterface<float, itk::CellTraitsInfo<2, float, float, long unsigned int, long unsigned int, long unsigned int, itk::Point<float, 2u>, itk::MapContainer<long unsigned int, itk::Point<float, 2u> >, std::set<long unsigned int, std::less<long unsigned int>, std::allocator<long unsigned int> > > >* const' to 'itk::PolygonCell<itk::CellInterface<float, itk::CellTraitsInfo<2, float, float, long unsigned int, long unsigned int, long unsigned int, itk::Point<float, 2u>, itk::MapContainer<long unsigned int, itk::Point<float, 2u> >, std::set<long unsigned int, std::less<long unsigned int>, std::allocator<long unsigned int> > > > >*'
/../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:65:0 /../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:65: instantiated from 'void itk::VTKPolyDataWriter<TInputMesh>::Update() [with TInputMesh = itk::VoronoiDiagram2D<float>]'
/../Voronoi/main.cxx:42:0 /../Voronoi/main.cxx:42: instantiated from here
/../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:225:0 /../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:225: error: invalid conversion from 'itk::CellInterface<float, itk::CellTraitsInfo<2, float, float, long unsigned int, long unsigned int, long unsigned int, itk::Point<float, 2u>, itk::MapContainer<long unsigned int, itk::Point<float, 2u> >, std::set<long unsigned int, std::less<long unsigned int>, std::allocator<long unsigned int> > > >* const' to 'itk::PolygonCell<itk::CellInterface<float, itk::CellTraitsInfo<2, float, float, long unsigned int, long unsigned int, long unsigned int, itk::Point<float, 2u>, itk::MapContainer<long unsigned int, itk::Point<float, 2u> >, std::set<long unsigned int, std::less<long unsigned int>, std::allocator<long unsigned int> > > > >*'
/../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:65:0 /../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:65: instantiated from 'void itk::VTKPolyDataWriter<TInputMesh>::Update() [with TInputMesh = itk::VoronoiDiagram2D<float>]'
/../Voronoi/main.cxx:42:0 /../Voronoi/main.cxx:42: instantiated from here
/../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:240:0 /../ITKsources/Modules/Core/Mesh/include/itkVTKPolyDataWriter.txx:240: error: invalid conversion from 'itk::CellInterface<float, itk::CellTraitsInfo<2, float, float, long unsigned int, long unsigned int, long unsigned int, itk::Point<float, 2u>, itk::MapContainer<long unsigned int, itk::Point<float, 2u> >, std::set<long unsigned int, std::less<long unsigned int>, std::allocator<long unsigned int> > > >* const' to 'itk::PolygonCell<itk::CellInterface<float, itk::CellTraitsInfo<2, float, float, long unsigned int, long unsigned int, long unsigned int, itk::Point<float, 2u>, itk::MapContainer<long unsigned int, itk::Point<float, 2u> >, std::set<long unsigned int, std::less<long unsigned int>, std::allocator<long unsigned int> > > > >*'
Well, I'm stuck there, I don't know how to display an itkVoronoiDiagram2D, except using the PolyDataWriter but that doesn't seem to work.
If you have any idea that could help be on how to generate the VoronoiDiagram and to display, I would be grateful.
Thanks in advance.
--
Steffan Ulysse Rigaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110627/cb380a4f/attachment.htm>
More information about the Insight-users
mailing list