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

Eric E. Monson emonson at cs.duke.edu
Tue Mar 30 08:56:03 EDT 2010


Hey Phil,

Is your VTK on 10.6 built using Cocoa or Carbon? And, which VTK version are you using on each machine?

I don't know what the cause would be, but I know there are some differences and the info might be help the people who know more of the details track down the source of the inconsistent behavior.

Thanks,
-Eric

------------------------------------------------------
Eric E Monson
Duke Visualization Technology Group


On Mar 29, 2010, at 4:18 PM, Dr. Philip Julian Broser wrote:

> I tried that but it does not change the behavior of the program.
> 
> But interestingly when I am compiling and using the software on a machine running Mac OSX10.4 the slice updates without any problem,
> 
> but when I am using 10.6 the problems starts.
> 
> Does any body know anything about any buck on 10.6?
> 
> On Mar 29, 2010, at 5:19 PM, Jothybasu K Selvaraj wrote:
> 
>> You should be adding your Imageactor to some renderWindow. So, try RenderWindow->Render().
>> 
>> Jothy
>> 
>> On Mon, Mar 29, 2010 at 3:07 PM, Dr. Philip Julian Broser <philip.broser at doctors.net.uk> wrote:
>> 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)
>> 
>> 
>> _______________________________________________
>> 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
>> 
>> 
> 
> _______________________________________________
> 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/20100330/b936bfa2/attachment.htm>


More information about the vtkusers mailing list