[vtkusers] Mapping of the coordinates

cyros at tiscali.it cyros at tiscali.it
Fri Dec 1 09:51:59 EST 2006


As I make mapping between the coordinates vtkRenderWindow.GetEventPosition () and the coordinates of data into render? 
That is, which it is the index in the vtkDataArray of the point that it has coordinated vtkRenderWindow.GetEventPosition () ?
This is my code:

vtkRenderer aRenderer = new vtk.vtkRenderer();

vtkRenderWindowInteractor iren = new vtk.vtkRenderWindowInteractor();

vtkVolume16Reader v16 = new vtk.vtkVolume16Reader();


vtkTransform tr = new vtkTransform();

vtkImageGaussianSmooth gs = new vtkImageGaussianSmooth();

vtkImageMagnify magnify = new vtkImageMagnify();

vtkPiecewiseFunction opacityTransferFunction = new vtkPiecewiseFunction();

vtkColorTransferFunction colorTransferFunction = new vtkColorTransferFunction();

vtkVolumeProperty volumeProperty = new vtkVolumeProperty();

vtkVolumeRayCastCompositeFunction compositeFunction = new vtkVolumeRayCastCompositeFunction();

vtkVolumeRayCastMapper myMapper = new vtkVolumeRayCastMapper();

vtkVolume volume = new vtkVolume();

vtkDataArray da;

vtkCamera camera = new vtkCamera();

vtkInteractorStyleUser stileIren = new vtkInteractorStyleUser();



renWin.AddRenderer(aRenderer);


iren.SetRenderWindow(renWin);




v16.SetDataDimensions(256, 256);

v16.SetDataByteOrderToBigEndian();

v16.SetFilePrefix("C:/Documents and Settings/Andrea/Desktop/vtkWindowsApplication/CThead/CThead");

v16.SetImageRange(1, 113);

v16.SetDataSpacing(1, 1,2);

di = v16.GetOutput(); 

tr.RotateY(180);

tr.RotateX(90);






gs.SetInput(v16.GetOutput());

gs.SetDimensionality (2);

gs.SetRadiusFactors (1 ,1, 0);



magnify.SetInput (gs.GetOutput ());

magnify.SetMagnificationFactors (3,3,3);



di.Update();

da = di.GetPointData ().GetScalars ();

tr.RotateZ(180);



di.Update ();

volumeProperty.SetInterpolationTypeToLinear ();


myMapper.SetInput(di); 

myMapper.SetVolumeRayCastFunction (compositeFunction);




volume.SetMapper (myMapper);

volume.SetProperty (volumeProperty); 

volume.SetUserMatrix (tr.GetMatrix());



aRenderer.AddVolume (volume);






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


More information about the vtkusers mailing list