4 #include <vtkProperty.h>
5 #include <vtkPolyData.h>
6 #include <vtkDataSet.h>
7 #include <vtkCellArray.h>
8 #include <vtkTransform.h>
9 #include <vtkTransformFilter.h>
10 #include <vtkDataSetReader.h>
12 #include "wxMPRBaseData.h"
13 #include "pPlotter/HistogramDialog.h"
17 //-------------------------------------------------------------------
18 //-------------------------------------------------------------------
19 //-------------------------------------------------------------------
22 //-------------------------------------------------------------------
23 //-------------------------------------------------------------------
24 //-------------------------------------------------------------------
25 vtkMPRBaseData::vtkMPRBaseData()
30 _transformOrientation = NULL;
33 //-------------------------------------------------------------------
34 vtkMPRBaseData::~vtkMPRBaseData()
36 if (_marImageData) delete _marImageData;
37 if (_transformOrientation) _transformOrientation ->Delete();
39 //-------------------------------------------------------------------
40 void vtkMPRBaseData::Configure()
42 vtkImageData* img = _marImageData->GetImageData();
44 img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2);
45 //std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<<std::endl;
46 if(_transformOrientation==NULL){
47 _transformOrientation=vtkTransform::New();
49 _transformOrientation->Identity();
52 //-------------------------------------------------------------------
53 void vtkMPRBaseData::GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2)
64 //------------------------------------------------------------------------
65 int vtkMPRBaseData::GetMaxPositionX( )
69 //------------------------------------------------------------------------
70 int vtkMPRBaseData::GetMaxPositionY( )
74 //------------------------------------------------------------------------
75 int vtkMPRBaseData::GetMaxPositionZ( )
79 //-------------------------------------------------------------------
80 double vtkMPRBaseData::GetX()
85 //-------------------------------------------------------------------
86 double vtkMPRBaseData::GetY()
90 //-------------------------------------------------------------------
92 ** Calculates the value of the slider and the layer in the image that is spouse to show
94 void vtkMPRBaseData::SetX(double x)
99 vtkImageData* img = _marImageData->GetImageData();
101 /*img->GetDimensions(dim);
123 //-------------------------------------------------------------------
125 ** Calculates the value of the slider and the layer in the image that is spouse to show
127 void vtkMPRBaseData::SetY(double y)
131 vtkImageData* img = _marImageData->GetImageData();
133 /*img->GetDimensions(dim);
155 //-------------------------------------------------------------------
156 vtkTransform *vtkMPRBaseData::GetTransformOrientation()
158 return _transformOrientation;
160 //-------------------------------------------------------------------
161 void vtkMPRBaseData::SetNormal(double nx, double ny, double nz)
163 double alfa = atan2(ny,nx) * 180.0 / 3.1416;
164 double beta = atan2( nz, sqrt( nx*nx + ny*ny ) ) * 180.0 / 3.1416;
165 _transformOrientation->Identity();
166 _transformOrientation->RotateWXYZ(alfa,0,0,1);
167 _transformOrientation->RotateWXYZ(-beta,0,1,0);
169 //-------------------------------------------------------------------
170 void vtkMPRBaseData::InitTransformOrientation(vtkTransform *trans)
172 _transformOrientation->SetMatrix( trans->GetMatrix() );
177 //-------------------------------------------------------------------
178 //-------------------------------------------------------------------
179 //-------------------------------------------------------------------