[vtkusers] VTKImageActor->SetZSlice (z) fails to update

Dr. Philip Julian Broser philip.broser at doctors.net.uk
Mon Mar 29 10:07:28 EDT 2010


Dear VTK Users,

I am still struggling with updating the zslice in the vtkImageActor


I am visualising 3D Volume Data (tiff) using an vtkImageActor:

vtkImageData *FaImage = (correctly loaded 3d volume data, see down  
below)

vtkImageActor *ImageActor = vtkImageActor::New();
ImageActor->SetInput (FaImage);
ImageActor->SetZSlice (2);

The visualisation of the first Zslice works very well.

However my program visualizes 3D Volume MRI data and overlays it with  
vtk meshes of brain structures i.e. the thalmus.
To check that the structure in the vtk mesh was correctly segmented  
and localized I want to look at single z planes.
In order to be able to select different planes I have written a simple  
Event Class.
With every click of the mouse the image plane should shift by one  
pixel in z.
The first plane is always well visualised and the actor seems to be  
correctly initiated
but the plane is not updated when a event occurs even so the command  
SetZSlice is called with the new z value.

Does any body have an idea why the image actor is not updated?

Kind regards

Phil


class myEventClass : public vtkCommand
{
	


	virtual void Execute	( 	vtkObject * 	caller, unsigned long 	eventId,  
void * 	callData) 	
	{
	int max=ImageActor->GetWholeZMax	( );
	int min=ImageActor->GetWholeZMin	( );


	if (dir==0)
	{
	z=z+1;
	if (z>max ) {z=max;dir=1;}
	}
	else
	{
	z=z-1;
	if (z<min) {z=min;dir=0;}
	};
	
		
	ImageActor->SetZSlice (z);
	
		
	cout << "Current z Slice:" << z << endl;
	};
	
	public:
	myEventClass() {
	z=0;
	dir=0;
	}	
	
	void SetImageActor(vtkImageActor *iA) {ImageActor=iA;};
	
	
private:
	vtkImageActor *ImageActor;
	int z;
	int dir;
};


vtkImageData (0x101022350)
   Debug: Off
   Modified Time: 554
   Reference Count: 3
   Registered Events: (none)
   Source: (none)
   Information: 0x1010224b0
   Data Released: False
   Global Release Data: Off
   UpdateTime: 0
   Release Data: Off
   UpdateExtent: Not Initialized
   RequestExactExtent: Off
    Field Data:
     Debug: Off
     Modified Time: 456
     Reference Count: 1
     Registered Events: (none)
     Number Of Arrays: 0
     Number Of Components: 0
     Number Of Tuples: 0
   Number Of Points: 414720
   Number Of Cells: 397100
   Cell Data:
     Debug: Off
     Modified Time: 459
     Reference Count: 1
     Registered Events: (none)
     Number Of Arrays: 0
     Number Of Components: 0
     Number Of Tuples: 0
     Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
     Interpolate Flags: ( 1 1 1 1 1 0 0 )
     Pass Through Flags: ( 1 1 1 1 1 1 1 )
     Scalars: (none)
     Vectors: (none)
     Normals: (none)
     TCoords: (none)
     Tensors: (none)
     GlobalIds: (none)
     PedigreeIds: (none)
   Point Data:
     Debug: Off
     Modified Time: 552
     Reference Count: 1
     Registered Events: (none)
     Number Of Arrays: 1
     Array 0 name = NULL
     Number Of Components: 1
     Number Of Tuples: 414720
     Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
     Interpolate Flags: ( 1 1 1 1 1 0 0 )
     Pass Through Flags: ( 1 1 1 1 1 1 1 )
     Scalars:
       Debug: Off
       Modified Time: 452
       Reference Count: 2
       Registered Events: (none)
       Name: (none)
       Data type: unsigned char
       Size: 414720
       MaxId: 414719
       NumberOfComponents: 1
       Information: 0
       Name: (none)
       Number Of Components: 1
       Number Of Tuples: 414720
       Size: 414720
       MaxId: 414719
       LookupTable: (none)
       Array: 0x101100000
     Vectors: (none)
     Normals: (none)
     TCoords: (none)
     Tensors: (none)
     GlobalIds: (none)
     PedigreeIds: (none)
   Bounds:
     Xmin,Xmax: (0, 237.5)
     Ymin,Ymax: (0, 237.5)
     Zmin,Zmax: (0, 110)
   Compute Time: 0
   ScalarType: 3
   NumberOfScalarComponents: 1
   Spacing: (2.5, 2.5, 2.5)
   Origin: (0, 0, 0)
   Dimensions: (96, 96, 45)
   Increments: (0, 0, 0)
   Extent: (0, 95, 0, 95, 0, 44)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100329/203251d0/attachment.htm>


More information about the vtkusers mailing list