[Insight-users] questions about generate and display sparse point
cloud
Luis Ibanez
luis . ibanez at kitware . com
Thu, 02 Oct 2003 17:33:04 -0400
Hi Shaohua
You will have to post the code of the VTK pipeline
that you are using for visualization if you want to
get some guidance on it.
Without lookit at the code it is quite hard to figure
out why you see are seeing a mesh and not a set of
points. :-)
Your attached program only contains the ITK code
related to the generation of the sparse points.
---
Why do you want to visualize the spare points as an image ?
You probably will get better performance by saving
the coordinates of the spare points and loading them in a
vtkPolyData
http://www . vtk . org/doc/nightly/html/classvtkPolyData . html
then pass them to a Glyp filter
http://www . vtk . org/doc/nightly/html/classvtkGlyph3D . html
Some lateral advice:
in lines 177 to 190 you are initializing the image
to a value using three nested for-loops and SetPixel().
This is very, very inefficient. You can simple invoke
image->FillBuffer( value );
or,
use an ImageRegioniterator and a single while loop.
(FillBuffer will be faster anyways).
You will get a better interface to VTK if you
save the image in VTK format instead of RAW.
You can save in VTK format by simply using the
extension ".vtk" in the filename. You don't
even need to explicitly instantiate a VTKImageIO
class.
Regards,
Luis
------------------
Shaohua Fan wrote:
> Hello,
>
> I am playing with some samples in ITK, and trying to
> generate a set of sparse points and display it. I got
> it run somehow, but have two questions:
>
> 1. When I displayed the 3D images in raw format with
> VTK, it was automatically display with mesh instead of
> just points. Can I turn the mesh display off? Or
> should I output those points into a different format?
>
> 2. In the code(attached, line 199), if I initialize
> the whole 3D volume with value -1.0, the generated
> semi-sphere would show up. However, when I initialize
> it with value 0, the whole image is black. Why it
> makes difference?
>
> Anyone could help and have a quick look and point out
> the problem? Honestly, I am not sure whether I am
> generating/outputing the sparse points in a good way.
> It would be appreciated if someone point me to some
> sample codes or how to do this.
>
> Thanks a lot,
>
> Shaohua
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping . yahoo . com