[vtkusers] How to visualise 3d array of data

Shashwath T.R. trshash at gmail.com
Tue Mar 15 06:24:32 EDT 2011


This particular method _will_ duplicate memory. As you can see, there's a
line that says

        grid->SetScalarComponentFromDouble(x,y,z,0,d);

Look at the documentation (
http://www.vtk.org/doc/nightly/html/classvtkImageData.html#ac65fb626222096573dea74dcb71572ef)
for SetScalarComponentFromDouble; you'll see that it takes the x, y and z
indices in the vtkImageData, and the _value_ of the scalar component. In
this particular usage, the scalars array is allocated within the
vtkImageData instance, which should be blanked and then set from outside.

If you want to share the input array, I'd suggest vtkImageImport (I recall
that it was discussed on the list recently).

Incidentally, Jeff, I don't see an AllocateScalars() call anywhere in your
example. From what I know, this will cause a segfault, because the array
isn't allocated without that call. I suppose that as a debug-mode run, it
would work, but that's not safe. Unless it was changed recently, and I
didn't hear about it!

Regards,
Shash

On Tue, Mar 15, 2011 at 2:19 PM, sara.saeed <sosca7 at hotmail.com> wrote:

> Thanks Jeff, but i want to know if it duplicates the memory or just share
> the
> same volume ?
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/How-to-visualise-3d-array-of-data-tp1246794p3690617.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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
>
> 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/20110315/ad26b385/attachment.htm>


More information about the vtkusers mailing list