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;
41 //-------------------------------------------------------------------
42 vtkMPRBaseData::~vtkMPRBaseData()
44 if (_marImageData) delete _marImageData;
45 if (_transformOrientation) _transformOrientation ->Delete();
47 //-------------------------------------------------------------------
48 void vtkMPRBaseData::Configure()
50 vtkImageData* img = _marImageData->GetImageData();
52 img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2);
53 //std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<<std::endl;
56 if(_transformOrientation==NULL){
57 _transformOrientation=vtkTransform::New();
59 _transformOrientation->Identity();
61 //-------------------------------------------------------------------
62 void vtkMPRBaseData::GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2)
73 //------------------------------------------------------------------------
74 int vtkMPRBaseData::GetMaxPositionX( )
78 //------------------------------------------------------------------------
79 int vtkMPRBaseData::GetMaxPositionY( )
83 //------------------------------------------------------------------------
84 int vtkMPRBaseData::GetMaxPositionZ( )
88 //-------------------------------------------------------------------
89 double vtkMPRBaseData::GetX()
94 //-------------------------------------------------------------------
95 double vtkMPRBaseData::GetY()
99 //-------------------------------------------------------------------
101 ** Calculates the value of the slider and the layer in the image that is spouse to show
103 void vtkMPRBaseData::SetX(double x)
108 vtkImageData* img = _marImageData->GetImageData();
110 /*img->GetDimensions(dim);
121 origin = img->GetOrigin();
124 x=ext[0] + origin[0];
128 x=ext[1] + origin[0];
134 //-------------------------------------------------------------------
136 ** Calculates the value of the slider and the layer in the image that is spouse to show
138 void vtkMPRBaseData::SetY(double y)
143 vtkImageData* img = _marImageData->GetImageData();
145 /*img->GetDimensions(dim);
156 origin = img->GetOrigin();
159 y=ext[2] + origin[1];
163 y=ext[3] + origin[1];
168 //-------------------------------------------------------------------
169 vtkTransform *vtkMPRBaseData::GetTransformOrientation()
171 return _transformOrientation;
173 //-------------------------------------------------------------------
174 void vtkMPRBaseData::SetNormal(double nx, double ny, double nz)
176 double alfa = atan2(ny,nx) * 180.0 / 3.1416;
177 double beta = atan2( nz, sqrt( nx*nx + ny*ny ) ) * 180.0 / 3.1416;
178 _transformOrientation->Identity();
179 _transformOrientation->RotateWXYZ(alfa,0,0,1);
180 _transformOrientation->RotateWXYZ(-beta,0,1,0);
182 //-------------------------------------------------------------------
183 void vtkMPRBaseData::InitTransformOrientation(vtkTransform *trans)
185 _transformOrientation->SetMatrix( trans->GetMatrix() );
190 //-------------------------------------------------------------------
191 //-------------------------------------------------------------------
192 //-------------------------------------------------------------------