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"
19 //-------------------------------------------------------------------
20 //-------------------------------------------------------------------
21 //-------------------------------------------------------------------
24 //-------------------------------------------------------------------
25 //-------------------------------------------------------------------
26 //-------------------------------------------------------------------
27 vtkMPRBaseData::vtkMPRBaseData()
38 _transformOrientation = NULL;
42 //-------------------------------------------------------------------
43 vtkMPRBaseData::~vtkMPRBaseData()
45 if (_marImageData) delete _marImageData;
46 if (_transformOrientation) _transformOrientation ->Delete();
49 //-------------------------------------------------------------------
50 void vtkMPRBaseData::Configure()
53 vtkBaseData::Configure();
55 vtkImageData* img = _marImageData->GetImageData();
58 img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2);
59 //std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<<std::endl;
62 if(_transformOrientation==NULL)
64 _transformOrientation=vtkTransform::New();
67 _transformOrientation->Identity();
70 //-------------------------------------------------------------------
71 void vtkMPRBaseData::GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2)
82 //------------------------------------------------------------------------
83 int vtkMPRBaseData::GetMaxPositionX( )
87 //------------------------------------------------------------------------
88 int vtkMPRBaseData::GetMaxPositionY( )
92 //------------------------------------------------------------------------
93 int vtkMPRBaseData::GetMaxPositionZ( )
97 //-------------------------------------------------------------------
98 double vtkMPRBaseData::GetX()
103 //-------------------------------------------------------------------
104 double vtkMPRBaseData::GetY()
108 //-------------------------------------------------------------------
110 ** Calculates the value of the slider and the layer in the image that is spouse to show
112 void vtkMPRBaseData::SetX(double x)
117 vtkImageData* img = _marImageData->GetImageData();
119 /*img->GetDimensions(dim);
130 origin = img->GetOrigin();
133 x=ext[0] + origin[0];
137 x=ext[1] + origin[0];
143 //-------------------------------------------------------------------
145 ** Calculates the value of the slider and the layer in the image that is spouse to show
147 void vtkMPRBaseData::SetY(double y)
152 vtkImageData* img = _marImageData->GetImageData();
154 /*img->GetDimensions(dim);
165 origin = img->GetOrigin();
168 y=ext[2] + origin[1];
172 y=ext[3] + origin[1];
177 //-------------------------------------------------------------------
178 vtkTransform *vtkMPRBaseData::GetTransformOrientation()
180 return _transformOrientation;
182 //-------------------------------------------------------------------
183 void vtkMPRBaseData::SetNormal(double nx, double ny, double nz)
185 double alfa = atan2(ny,nx) * 180.0 / 3.1416;
186 double beta = atan2( nz, sqrt( nx*nx + ny*ny ) ) * 180.0 / 3.1416;
187 _transformOrientation->Identity();
188 _transformOrientation->RotateWXYZ(alfa,0,0,1);
189 _transformOrientation->RotateWXYZ(-beta,0,1,0);
191 //-------------------------------------------------------------------
192 void vtkMPRBaseData::InitTransformOrientation(vtkTransform *trans)
194 _transformOrientation->SetMatrix( trans->GetMatrix() );
199 //-------------------------------------------------------------------
200 //-------------------------------------------------------------------
201 //-------------------------------------------------------------------