X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxMPRBaseData.cxx;h=9ec150285bf768281eb8bf1911601030e3b22724;hb=96facb2168314bc57826afc4342abd43e27f0ff7;hp=16fb79782276dcd984a004d5e7c777d922273aee;hpb=3948b92b07a8992a6d04081c9649ba63e3e7d613;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx index 16fb797..9ec1502 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx @@ -18,104 +18,6 @@ //------------------------------------------------------------------- //------------------------------------------------------------------- -vtkBaseData::vtkBaseData() -{ - - _z = 0; - _t = 0; - _marImageData = NULL; -} - -//------------------------------------------------------------------- -vtkBaseData::~vtkBaseData() -{ -} - -//------------------------------------------------------------------- -void vtkBaseData::SetMarImageData(marImageData *marimagedata) -{ - _marImageData = marimagedata; - //Configure(); -} - -//------------------------------------------------------------------- -vtkImageData* vtkBaseData::GetImageData() -{ - return _marImageData->GetImageDataT(_t); -} -//------------------------------------------------------------------- -marImageData* vtkBaseData::GetMarImageData() -{ - return _marImageData; -} - -//------------------------------------------------------------------- - -void vtkBaseData::Configure() // virtual -{ -} - -//------------------------------------------------------------------- -void vtkBaseData::SetZ(double z){ - //int maxZ; - -// int dim[3]; -// _marImageData->GetDimensions(dim); -// maxZ=dim[2]; - - int ext[6]; - 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; - } - - _z=z;*/ - img->GetExtent(ext); - if (z > ext[5]) - { - z = ext[5]; - } - if (z < ext[4]) - { - z = ext[4]; - } - - _z=z; - } -} -//------------------------------------------------------------------- -double vtkBaseData::GetZ() -{ - return _z; -} -//------------------------------------------------------------------- -int vtkBaseData::GetT() -{ - return _t; -} -//------------------------------------------------------------------- -void vtkBaseData::SetT(double t) -{ - int maxT = _marImageData->GetMaxT(); - if (t>=maxT) - { - t=maxT-1; - } - if (t<=0) - { - t=0; - } - _t=(int)t; -} //------------------------------------------------------------------- //------------------------------------------------------------------- @@ -126,6 +28,7 @@ vtkMPRBaseData::vtkMPRBaseData() _y=0; _z=0; _transformOrientation = NULL; + _marImageData = NULL; } //------------------------------------------------------------------- vtkMPRBaseData::~vtkMPRBaseData() @@ -275,959 +178,3 @@ void vtkMPRBaseData::InitTransformOrientation(vtkTransform *trans) //------------------------------------------------------------------- //------------------------------------------------------------------- - -vtkMPR3DDataViewer::vtkMPR3DDataViewer() -{ - _visiblePosition[0]=false; - _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() -{ - _outlineData -> Delete(); - _mapOutline -> Delete(); - _outline -> Delete(); - -// if (_bwLut) _bwLut -> Delete(); -// if (_hueLut) _hueLut -> Delete(); -// if (_satLut) _satLut -> Delete(); - if (_ctfun) _ctfun -> Delete(); - if (_saggitalColors) _saggitalColors -> Delete(); - if (_saggital) _saggital -> Delete(); - if (_axialColors) _axialColors -> Delete(); - if (_axial) _axial -> Delete(); - if (_coronalColors) _coronalColors -> Delete(); - if (_coronal) _coronal -> Delete(); - -} -//------------------------------------------------------------------- -vtkActor* vtkMPR3DDataViewer::GetOutlineActor() -{ - return _outline; -} -//------------------------------------------------------------------- -vtkImageActor* vtkMPR3DDataViewer::GetImageActor(int id) -{ - vtkImageActor *tmpVtkActor=NULL; - if (id==0){ - tmpVtkActor = GetvtkActor_saggital(); - } - if (id==1){ - tmpVtkActor = GetvtkActor_coronal(); - } - if (id==2){ - tmpVtkActor = GetvtkActor_axial(); - } - return tmpVtkActor; -} -//------------------------------------------------------------------- -void vtkMPR3DDataViewer::Refresh() -{ - int x = (int)(_vtkmprbasedata->GetX()); - int y = (int)(_vtkmprbasedata->GetY()); - int z = (int)(_vtkmprbasedata->GetZ()); - std::cout<<" vtkMPR3DDataViewer::Refresh() x="<greyValuesTransferenceFVector.size(); - if(tfSize>0) - { - int i=0,y; - hDlg->erasePointsTransferenceFunction(); - while(iaddPointToTransferenceFunction(g,in*100); - i++; - } - - } - - int ctfSize=this->redColorsOfColorTransferenceFVector.size(); - if(ctfSize>0) - { - int i=0,y; - while(iaddColorPoint(gr,r*255,g*255,b*255); - i++; - } - } - //If it is smooth activate next line - //hDlg->updatePlotter(); - //setting variables if the user wants to do refresh - hDlg->setCTF(_ctfun); - hDlg->setTF(_tfun); - - // - // when the user had changed the transference Function - // - if(hDlg->ShowModal()== wxID_OK ) - { - // -- vtkPiecewiseFunction -- - this->_tfun->RemoveAllPoints(); - greyValuesTransferenceFVector.clear(); - intensityValuesTransferenceFVector.clear(); - - int nTFPoints=hDlg->getSizeTransferenceFunction(); - i=0; - while(igetTransferenceFunctionPoint(i,xi,yi); - this->_tfun->AddPoint( xi , yi/100.0 ); - greyValuesTransferenceFVector.push_back(xi); - intensityValuesTransferenceFVector.push_back(yi/100.0); - i++; - } - // -- vtkColorTransferFunction -- - this->_ctfun->RemoveAllPoints (); - //clean colors - redColorsOfColorTransferenceFVector.clear(); - greenColorsOfColorTransferenceFVector.clear(); - blueColorsOfColorTransferenceFVector.clear(); - greyValueColorsOfColorTransferenceFVector.clear(); - - int nCTFpoints=hDlg->getSizeBarColor(); - i=0; - while(igetDataBarColorPoint(i,xi,r,g,b); - this->_ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 ); - redColorsOfColorTransferenceFVector.push_back(r/255.0); - greenColorsOfColorTransferenceFVector.push_back(g/255.0); - blueColorsOfColorTransferenceFVector.push_back(b/255.0); - greyValueColorsOfColorTransferenceFVector.push_back(xi); - i++; - } - - this->_volumeMapper->Update(); - this->_newvol->Update(); - } - - else - { - - if(hDlg->getRefreshed()) - { - int i=0,size; - //--Transference Function---- - this->_tfun->RemoveAllPoints(); - i=0; - size=greyValuesTransferenceFVector.size(); - for(i=0;i_tfun->AddPoint( grey1 , in2 ); - } - - // -- vtkColorTransferFunction -- - _ctfun->RemoveAllPoints (); - - i=0; - size=greyValueColorsOfColorTransferenceFVector.size(); - for(i=0;iAddRGBPoint(grey2,red,green,blue); - } - this->_volumeMapper->Update(); - this->_newvol->Update(); - } - - } - hDlg->Destroy(); -*/ -} -/* -void vtkClipping3DDataViewer::ReadVolumeFunctions(char *namefile) -{ - char tmp[256]; - short int max; - double range[2]; - double x,val,r,g,b; - - FILE *ff = fopen ( namefile ,"r"); - - // -- MAX -- - fscanf(ff,"%s",tmp); - if (strcmp(tmp,"MAX")==0) - { - vtkImageData *vtkimagedata = this->_vtkmprbasedata->GetImageData(); - vtkimagedata->GetScalarRange(range); - max = (int) (range[1]); - } else { - max = atoi(tmp); - } - - fscanf(ff,"%s",tmp); // -- - - // -- vtkPiecewiseFunction -- - this->_tfun->RemoveAllPoints(); - fscanf(ff,"%s",tmp); - while ( strcmp(tmp,"--")!=0 ) - { - x=atof(tmp); - fscanf(ff,"%s",tmp); - val=atof(tmp); - this->_tfun->AddPoint( x*max , val ); - fscanf(ff,"%s",tmp); - } - - this->_ctfun->RemoveAllPoints (); - // -- vtkColorTransferFunction -- - while ( !feof(ff)) - { - fscanf(ff,"%s",tmp); - x=atof(tmp); - fscanf(ff,"%s",tmp); - r=atof(tmp); - fscanf(ff,"%s",tmp); - g=atof(tmp); - fscanf(ff,"%s",tmp); - b=atof(tmp); - this->_ctfun->AddRGBPoint( x*max , r,g,b ); - } - - - this->_volumeMapper->Update(); - this->_newvol->Update(); - - - fclose(ff); -} -*/ - -//------------------------------------------------------------------- -// EED 23 Mai 2007 -void vtkClipping3DDataViewer::ReadMeshVTK(char *namefile) -{ - vtkDataSetReader *reader = vtkDataSetReader::New(); - reader->SetFileName(namefile); - reader->Update(); - _tissueStripper[3]->SetInput( reader->GetPolyDataOutput() ); -}