[vtkusers] How to display contents of vtkImageData

Elvis Dowson elvis.dowson at mac.com
Fri Nov 14 08:28:44 EST 2008


Hi,
	Could someone help me convert the following C++ code snippet to tcl?  
I want to initialize vtkImageData with zeros and I'm not sure how to  
use pointer variables with tcl

Here is the C++ code snippet

   for (int y=extent1[2]; y <= extent1[3]; y++)
     {
     unsigned char *ptr=static_cast<unsigned char *>(
       image->GetScalarPointer(extent1[0], y, extent1[4] ));
     for (int x=extent1[0]; x <= extent1[1]; x++)
       {
       *ptr = 0;  ++ptr;
       *ptr = 0;  ++ptr;
       *ptr = 0;  ++ptr;
       }
     }


I just got this far with the tcl code and I'm not sure how to obtain  
the unsigned char* and manipulate it in the inner loop, not sure if  
I'm getting the pointer variable right.

Would appreciate it if someone could help me out...

# Fill image with zeroes
for {set y 0} {$y <= 10} {incr y 1}
{
   set &ptr = imageData GetScalarPointer 0 $y 0

}


Best regards,

Elvis Dowson



On Nov 13, 2008, at 10:20 PM, David Cole wrote:

> By calling SetInput on a vtkImageActor and adding that actor to your  
> vtkRenderer...
>
> http://www.vtk.org/doc/nightly/html/classvtkImageActor.html#12bddf9fcf6e6b877116a3c552d05b39
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081114/dcd436e8/attachment.htm>


More information about the vtkusers mailing list