X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxMPRBaseData.cxx;h=f3217a2e5b2f801419ea11328f6f542898987425;hb=a4ee3758aa0477f677fb981e2c4d6e29995e8db8;hp=67dfe61647d14e761ac2cd68ea7c8f2871521e1c;hpb=c5feadbb145eecf6d73f793535b7e23eb18db2cb;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx index 67dfe61..f3217a2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx @@ -35,7 +35,7 @@ vtkBaseData::~vtkBaseData() void vtkBaseData::SetMarImageData(marImageData *marimagedata) { _marImageData = marimagedata; - Configure(); + //Configure(); } //------------------------------------------------------------------- @@ -57,26 +57,40 @@ void vtkBaseData::Configure() // virtual //------------------------------------------------------------------- void vtkBaseData::SetZ(double z){ - int maxZ; + //int maxZ; // int dim[3]; // _marImageData->GetDimensions(dim); // maxZ=dim[2]; int ext[6]; - _marImageData->GetImageData()->GetWholeExtent(ext); - maxZ=ext[5]-ext[4]+1; + vtkImageData* img = _marImageData->GetImageData(); + if(img!=NULL){ + /*img->GetWholeExtent(ext); + maxZ=ext[5]-ext[4]+1; - if (z>=maxZ) - { - z=maxZ-1; - } - if (z<=0) - { - z=0; - } + if (z>=maxZ) + { + //z=maxZ-1; + } + if (z<=0) + { + z=0; + } - _z=z; + _z=z;*/ + img->GetExtent(ext); + if (z > ext[5]) + { + z = ext[5]; + } + if (z < ext[4]) + { + z = ext[4]; + } + + _z=z; + } } //------------------------------------------------------------------- double vtkBaseData::GetZ() @@ -100,7 +114,7 @@ void vtkBaseData::SetT(double t) { t=0; } - _t=t; + _t=(int)t; } //------------------------------------------------------------------- @@ -112,6 +126,7 @@ vtkMPRBaseData::vtkMPRBaseData() _y=0; _z=0; _transformOrientation = NULL; + _marImageData = NULL; } //------------------------------------------------------------------- vtkMPRBaseData::~vtkMPRBaseData() @@ -122,9 +137,15 @@ vtkMPRBaseData::~vtkMPRBaseData() //------------------------------------------------------------------- void vtkMPRBaseData::Configure() { - _marImageData->GetImageData()->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2); - _transformOrientation=vtkTransform::New(); - _transformOrientation->Identity(); + vtkImageData* img = _marImageData->GetImageData(); + if(img !=NULL){ + img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2); + //std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<Identity(); + } } //------------------------------------------------------------------- void vtkMPRBaseData::GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2) @@ -156,6 +177,7 @@ int vtkMPRBaseData::GetMaxPositionZ( ) //------------------------------------------------------------------- double vtkMPRBaseData::GetX() { + return _x; } //------------------------------------------------------------------- @@ -164,38 +186,73 @@ double vtkMPRBaseData::GetY() return _y; } //------------------------------------------------------------------- +/** +** Calculates the value of the slider and the layer in the image that is spouse to show +**/ void vtkMPRBaseData::SetX(double x) { - int dim[3]; - _marImageData->GetImageData()->GetDimensions(dim); - if (x<0) - { - x=0; + //int dim[3]; + int ext[6]; + + vtkImageData* img = _marImageData->GetImageData(); + if(img!=NULL){ + /*img->GetDimensions(dim); + if (x<0) + { + x=0; + } + if (x>=dim[0]) + { + x=dim[0]-1; + } + _x=x;*/ + img->GetExtent(ext); + if (x < ext[0]) + { + x=ext[0]; + } + if (x > ext[1]) + { + x=ext[1]; + } + _x=x; } - if (x>=dim[0]) - { - x=dim[0]-1; - }; - _x=x; } //------------------------------------------------------------------- +/** +** Calculates the value of the slider and the layer in the image that is spouse to show +**/ void vtkMPRBaseData::SetY(double y) { - int dim[3]; - _marImageData->GetImageData()->GetDimensions(dim); - if (y<0) - { - y=0; + //int dim[3]; + int ext[6]; + vtkImageData* img = _marImageData->GetImageData(); + if(img!=NULL){ + /*img->GetDimensions(dim); + if (y<0) + { + y=0; + } + if (y>=dim[1]) + { + y=dim[1]-1; + } + _y=y;*/ + img->GetExtent(ext); + if (y ext[3]) + { + y=ext[3]; + } + _y=y; } - if (y>=dim[1]) - { - y=dim[1]-1; - }; - _y=y; } //------------------------------------------------------------------- vtkTransform *vtkMPRBaseData::GetTransformOrientation() -{ +{ return _transformOrientation; } //------------------------------------------------------------------- @@ -226,6 +283,18 @@ vtkMPR3DDataViewer::vtkMPR3DDataViewer() _visiblePosition[1]=false; _visiblePosition[2]=false; _ctfun = NULL; + _vtkmprbasedata=NULL; + + _ctfun=NULL; + _saggitalColors=NULL; + _saggital=NULL; + _axialColors=NULL; + _axial=NULL; + _coronalColors=NULL; + _coronal=NULL; + _mapOutline=NULL; + _outline=NULL; + _outlineData=NULL; } //------------------------------------------------------------------- vtkMPR3DDataViewer::~vtkMPR3DDataViewer() @@ -272,7 +341,7 @@ void vtkMPR3DDataViewer::Refresh() int x = (int)(_vtkmprbasedata->GetX()); int y = (int)(_vtkmprbasedata->GetY()); int z = (int)(_vtkmprbasedata->GetZ()); - + std::cout<<" vtkMPR3DDataViewer::Refresh() x="<