[vtkusers] 3D image as N cubes
Francisco Lopez de la Franca
franciscolopezdelafranca at gmail.com
Wed Jun 3 11:42:45 EDT 2015
Thanks a lot.
And is there an example on how to traverse the whole octree? I mean, i
would like to know how many points there are per octant.
And finally, independently on the image, if i create an octree with a fixed
level, will the representation be the same? I mean, the same number of
octants with the same distribution independently on the image?
Thank you very much.
My best regards.
El 03/06/2015 15:36, "Bill Lorensen" <bill.lorensen at gmail.com> escribió:
> This example may help:
> On Wed, Jun 3, 2015 at 8:48 AM, Francisco Lopez de la Franca
> <franciscolopezdelafranca at gmail.com> wrote:
> > Hi.
> > I've created an example (see below) but everything is OK except that the
> > output image is not created. I'd be very pleased if someone can help me
> > (maybe with an explanatory example or whatever).
> > char* filename = new char;
> > strcpy(filename, "nifti_image.nii");
> > vtkSmartPointer<vtkNIFTIImageReader> reader =
> > vtkSmartPointer<vtkNIFTIImageReader>::New();
> > reader->SetFileName(filename);
> > reader->Update();
> > //Create the octree
> > vtkSmartPointer<vtkOctreePointLocator> octree =
> > vtkSmartPointer<vtkOctreePointLocator>::New();
> > octree->SetDataSet((vtkDataSet*) reader->GetOutput());
> > octree->BuildLocator();
> > std::cout << "Number of cells in tree: " <<
> > octree->GetDataSet()->GetNumberOfCells() << std::endl;
> > std::cout << "Number of points in tree: " <<
> > octree->GetDataSet()->GetNumberOfPoints() << std::endl;
> > char* outfile = new char;
> > strcpy(outfile, "OcTree.vtp");
> > vtkSmartPointer<vtkXMLPolyDataWriter> writer =
> > vtkSmartPointer<vtkXMLPolyDataWriter>::New();
> > writer->SetInputData((vtkPolyData*) octree->GetDataSet());
> > writer->SetFileName(outfile);
> > writer->Write();
> > 2015-05-29 12:40 GMT+02:00 Francisco Lopez de la Franca
> > <franciscolopezdelafranca at gmail.com>:
> >> Hi everybody,
> >> I'd like to represent a 3D image as a fixed number of cubes, I mean,
> >> something like a spatial occupancy matrix in 3D.
> >> Could you, please, recommend me a fast way to do it or does it exist a
> >> data structure in VTK to achieve this?
> >> I've found the OcTree structure but I donot know if it is valid for
> >> Thank you very much.
> >> My best regards.
> >> /Francisco
> > _______________________________________________
> > Powered by www.kitware.com
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> > Search the list archives at: http://markmail.org/search/?q=vtkusers
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/vtkusers
> Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers