X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxMPRBaseData.cxx;h=a46feff5b49d41b2ac441a90eceff740b0c503f2;hb=5bdd0c13157e0b246fa5f391dd181b2012357c31;hp=9c86ffc4afd1cc37746ea8a17564d0924f61d9e4;hpb=e6b030ceb3ee4eea1f012e7d5c47503cf6322c61;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx index 9c86ffc..a46feff 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,7 +57,7 @@ void vtkBaseData::Configure() // virtual //------------------------------------------------------------------- void vtkBaseData::SetZ(double z){ - int maxZ; + //int maxZ; // int dim[3]; // _marImageData->GetDimensions(dim); @@ -66,18 +66,29 @@ void vtkBaseData::SetZ(double z){ int ext[6]; vtkImageData* img = _marImageData->GetImageData(); if(img!=NULL){ - img->GetWholeExtent(ext); + /*img->GetWholeExtent(ext); maxZ=ext[5]-ext[4]+1; if (z>=maxZ) { - z=maxZ-1; + //z=maxZ-1; } if (z<=0) { z=0; } + _z=z;*/ + img->GetExtent(ext); + if (z > ext[5]) + { + z = ext[5]; + } + if (z < ext[4]) + { + z = ext[4]; + } + _z=z; } } @@ -115,6 +126,7 @@ vtkMPRBaseData::vtkMPRBaseData() _y=0; _z=0; _transformOrientation = NULL; + _marImageData = NULL; } //------------------------------------------------------------------- vtkMPRBaseData::~vtkMPRBaseData() @@ -128,7 +140,10 @@ void vtkMPRBaseData::Configure() vtkImageData* img = _marImageData->GetImageData(); if(img !=NULL){ img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2); - _transformOrientation=vtkTransform::New(); + //std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<Identity(); } } @@ -162,6 +177,7 @@ int vtkMPRBaseData::GetMaxPositionZ( ) //------------------------------------------------------------------- double vtkMPRBaseData::GetX() { + return _x; } //------------------------------------------------------------------- @@ -170,12 +186,17 @@ 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]; + //int dim[3]; + int ext[6]; + vtkImageData* img = _marImageData->GetImageData(); if(img!=NULL){ - img->GetDimensions(dim); + /*img->GetDimensions(dim); if (x<0) { x=0; @@ -183,17 +204,31 @@ void vtkMPRBaseData::SetX(double x) 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; } } //------------------------------------------------------------------- +/** +** 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]; + //int dim[3]; + int ext[6]; vtkImageData* img = _marImageData->GetImageData(); if(img!=NULL){ - img->GetDimensions(dim); + /*img->GetDimensions(dim); if (y<0) { y=0; @@ -201,13 +236,23 @@ void vtkMPRBaseData::SetY(double y) if (y>=dim[1]) { y=dim[1]-1; - }; + } + _y=y;*/ + img->GetExtent(ext); + if (y ext[3]) + { + y=ext[3]; + } _y=y; } } //------------------------------------------------------------------- vtkTransform *vtkMPRBaseData::GetTransformOrientation() -{ +{ return _transformOrientation; } //------------------------------------------------------------------- @@ -238,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() @@ -284,7 +341,6 @@ void vtkMPR3DDataViewer::Refresh() int x = (int)(_vtkmprbasedata->GetX()); int y = (int)(_vtkmprbasedata->GetY()); int z = (int)(_vtkmprbasedata->GetZ()); - SetPositionX( x ); SetPositionY( y ); SetPositionZ( z ); @@ -362,25 +418,28 @@ void vtkMPR3DDataViewer::Configure() _vtkmprbasedata->GetImageData()->GetScalarRange(range); double max = range[1]; - + _ctFunVectorPoint.clear(); _ctFunVectorPoint.push_back(max*0/4); _ctFunVectorPoint.push_back(max*1/4); _ctFunVectorPoint.push_back(max*2/4); _ctFunVectorPoint.push_back(max*3/4); _ctFunVectorPoint.push_back(max*4/4); + _ctFunVectorRed.clear(); _ctFunVectorRed.push_back(0.0); _ctFunVectorRed.push_back(1.0); _ctFunVectorRed.push_back(0.0); _ctFunVectorRed.push_back(0.0); _ctFunVectorRed.push_back(0.0); + _ctFunVectorGreen.clear(); _ctFunVectorGreen.push_back(0.0); _ctFunVectorGreen.push_back(0.0); _ctFunVectorGreen.push_back(0.0); _ctFunVectorGreen.push_back(1.0); _ctFunVectorGreen.push_back(0.2); + _ctFunVectorBlue.clear(); _ctFunVectorBlue.push_back(0.0); _ctFunVectorBlue.push_back(0.0); _ctFunVectorBlue.push_back(1.0); @@ -388,7 +447,10 @@ void vtkMPR3DDataViewer::Configure() _ctFunVectorBlue.push_back(0.0); - _ctfun = vtkColorTransferFunction::New(); + if(_ctfun==NULL){ + _ctfun = vtkColorTransferFunction::New(); + } + _ctfun->RemoveAllPoints(); int i,size=_ctFunVectorPoint.size(); for (i=0;iRemoveAllInputs(); + _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() ); // _saggitalColors->SetLookupTable(_bwLut); + _saggitalColors->SetLookupTable(_ctfun); - _saggital = vtkImageActor::New(); - _saggital->SetInput(_saggitalColors->GetOutput()); + + + + if(_saggital==NULL){ + _saggital = vtkImageActor::New(); + _saggital->SetInput(_saggitalColors->GetOutput()); + } + //_saggitalColors->Update(); + // Create the second (axial) plane of the three planes. We use the // same approach as before except that the extent differs. - _axialColors = vtkImageMapToColors::New(); + + + if(_axialColors==NULL){ + _axialColors = vtkImageMapToColors::New(); + } + + _axialColors->RemoveAllInputs(); _axialColors->SetInput( _vtkmprbasedata->GetImageData() ); // _axialColors->SetLookupTable(_hueLut); _axialColors->SetLookupTable(_ctfun); - _axial = vtkImageActor::New(); - _axial->SetInput(_axialColors->GetOutput()); + + if(_axial==NULL){ + _axial = vtkImageActor::New(); + _axial->SetInput(_axialColors->GetOutput()); + } + + //_axialColors->Update(); + // Create the third (coronal) plane of the three planes. We use // the same approach as before except that the extent differs. - _coronalColors = vtkImageMapToColors::New(); + if(_coronalColors==NULL){ + _coronalColors = vtkImageMapToColors::New(); + } + _coronalColors->RemoveAllInputs(); _coronalColors->SetInput( _vtkmprbasedata->GetImageData() ); // _coronalColors->SetLookupTable(_satLut); _coronalColors->SetLookupTable(_ctfun); - _coronal = vtkImageActor::New(); - _coronal->SetInput(_coronalColors->GetOutput()); + + if(_coronal==NULL){ + _coronal = vtkImageActor::New(); + _coronal->SetInput(_coronalColors->GetOutput()); + } + + // An outline provides context around the data. // - _outlineData = vtkOutlineFilter::New(); + if(_outlineData==NULL){ + _outlineData = vtkOutlineFilter::New(); + } + _outlineData->RemoveAllInputs(); _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() ); - _mapOutline = vtkPolyDataMapper::New(); - _mapOutline->SetInput(_outlineData->GetOutput()); - _outline = vtkActor::New(); - _outline->SetMapper(_mapOutline); - _outline->GetProperty()->SetColor(0,0,0); + + if(_mapOutline==NULL){ + _mapOutline = vtkPolyDataMapper::New(); + _mapOutline->SetInput(_outlineData->GetOutput()); + } + _mapOutline->Update(); + //_mapOutline->RemoveAllInputs(); + + if(_outline==NULL){ + _outline = vtkActor::New(); + _outline->SetMapper(_mapOutline); + _outline->GetProperty()->SetColor(0,0,0); + } + + int ext[6]; _vtkmprbasedata->GetImageData()->GetExtent(ext); + }