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()
36 _transformOrientation = NULL;
39 //-------------------------------------------------------------------
40 vtkMPRBaseData::~vtkMPRBaseData()
42 if (_marImageData) delete _marImageData;
43 if (_transformOrientation) _transformOrientation ->Delete();
45 //-------------------------------------------------------------------
46 void vtkMPRBaseData::Configure()
48 vtkImageData* img = _marImageData->GetImageData();
50 img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2);
51 //std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<<std::endl;
54 if(_transformOrientation==NULL){
55 _transformOrientation=vtkTransform::New();
57 _transformOrientation->Identity();
59 //-------------------------------------------------------------------
60 void vtkMPRBaseData::GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2)
71 //------------------------------------------------------------------------
72 int vtkMPRBaseData::GetMaxPositionX( )
76 //------------------------------------------------------------------------
77 int vtkMPRBaseData::GetMaxPositionY( )
81 //------------------------------------------------------------------------
82 int vtkMPRBaseData::GetMaxPositionZ( )
86 //-------------------------------------------------------------------
87 double vtkMPRBaseData::GetX()
92 //-------------------------------------------------------------------
93 double vtkMPRBaseData::GetY()
97 //-------------------------------------------------------------------
99 ** Calculates the value of the slider and the layer in the image that is spouse to show
101 void vtkMPRBaseData::SetX(double x)
106 vtkImageData* img = _marImageData->GetImageData();
108 /*img->GetDimensions(dim);
119 origin = img->GetOrigin();
122 x=ext[0] + origin[0];
126 x=ext[1] + origin[0];
132 //-------------------------------------------------------------------
134 ** Calculates the value of the slider and the layer in the image that is spouse to show
136 void vtkMPRBaseData::SetY(double y)
141 vtkImageData* img = _marImageData->GetImageData();
143 /*img->GetDimensions(dim);
154 origin = img->GetOrigin();
157 y=ext[2] + origin[1];
161 y=ext[3] + origin[1];
166 //-------------------------------------------------------------------
167 vtkTransform *vtkMPRBaseData::GetTransformOrientation()
169 return _transformOrientation;
171 //-------------------------------------------------------------------
172 void vtkMPRBaseData::SetNormal(double nx, double ny, double nz)
174 double alfa = atan2(ny,nx) * 180.0 / 3.1416;
175 double beta = atan2( nz, sqrt( nx*nx + ny*ny ) ) * 180.0 / 3.1416;
176 _transformOrientation->Identity();
177 _transformOrientation->RotateWXYZ(alfa,0,0,1);
178 _transformOrientation->RotateWXYZ(-beta,0,1,0);
180 //-------------------------------------------------------------------
181 void vtkMPRBaseData::InitTransformOrientation(vtkTransform *trans)
183 _transformOrientation->SetMatrix( trans->GetMatrix() );
188 //-------------------------------------------------------------------
189 //-------------------------------------------------------------------
190 //-------------------------------------------------------------------