]> Creatis software - creaMaracasVisu.git/commitdiff
Undo Redo
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Tue, 8 Sep 2009 08:14:23 +0000 (08:14 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Tue, 8 Sep 2009 08:14:23 +0000 (08:14 +0000)
23 files changed:
bbtk/src/bbcreaMaracasVisuCutModule.cxx
bbtk/src/bbmaracasvisuTransferFunctionView.cxx
data/colorsfunction.txt [new file with mode: 0644]
lib/maracasVisuLib/src/CMakeLists.txt [new file with mode: 0644]
lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.cxx
lib/maracasVisuLib/src/CutModule/interface/CutModelMainPanel.h
lib/maracasVisuLib/src/CutModule/kernel/CutModelData.cxx
lib/maracasVisuLib/src/CutModule/kernel/CutModelData.h
lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.cxx
lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h
lib/maracasVisuLib/src/CutModule/kernel/CutModelSaveBinInfo.cxx [new file with mode: 0644]
lib/maracasVisuLib/src/CutModule/kernel/CutModelSaveBinInfo.h [new file with mode: 0644]
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClipping3DDataViewer.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx

index b5e9e2dafa2bd2e04e4f3d5d746d645fd8f00764..cc06cf6a541183e3bdaf5011614bcebde572eb6a 100644 (file)
@@ -1,5 +1,7 @@
 #include "bbcreaMaracasVisuCutModule.h"
 #include "bbcreaMaracasVisuPackage.h"
+#include "creaSystem.h"
+
 namespace bbcreaMaracasVisu
 {
 
@@ -28,8 +30,10 @@ void CutModule::Process()
 }
 void CutModule::CreateWidget(wxWindow* parent)
 {
-       _mainpanel = CutModelMainPanel::getInstance(parent);
+
+       std::string path = crea::System::GetDllAppPath("bbcreaMaracasVisu.dll");
+       _mainpanel = CutModelMainPanel::getInstance(parent, path);
+       
    bbSetOutputWidget( _mainpanel); 
    Process(); 
   
index 733b91dd07cf96e524947597a84f2f15dc1fe96e..4fab7db27fba1e394e13ffbaeefdaf4e909d6c89 100644 (file)
@@ -36,12 +36,12 @@ void TransferFunctionView::Process()
                _tfun->RemoveAllPoints();
                for(int i = 0; i < greylevel.size();i++){
                        _tfun->AddPoint(greylevel[i], value[i]);
-                       std::cout<<"TransferFunctionView::Process()transfer function "<<greylevel[i]<<" "<< value[i]<<std::endl;
+                       //std::cout<<"TransferFunctionView::Process()transfer function "<<greylevel[i]<<" "<< value[i]<<std::endl;
                }
                _ctfun->RemoveAllPoints();
                for(int i = 0; i < greylevelcolors.size();i++){
                        _ctfun->AddRGBPoint(greylevelcolors[i], red[i],green[i], blue[i]);
-               std::cout<<"TransferFunctionView::Process()transfer color function "<<greylevelcolors[i]<<" "<<red[i]<<" "<<green[i]<<" "<<blue[i]<<std::endl;
+               //std::cout<<"TransferFunctionView::Process()transfer color function "<<greylevelcolors[i]<<" "<<red[i]<<" "<<green[i]<<" "<<blue[i]<<std::endl;
                }               
 
 
diff --git a/data/colorsfunction.txt b/data/colorsfunction.txt
new file mode 100644 (file)
index 0000000..7512588
--- /dev/null
@@ -0,0 +1,110 @@
+<ComboBoxData>
+ <ComboBoxItem>
+ <TransferenceFunction>
+               <Transferencepoint>
+                       <greyValue>0</greyValue>
+                       <intensity>0</intensity> 
+               </Transferencepoint>
+               <Transferencepoint>
+                       <greyValue>0.5</greyValue>
+                       <intensity>1</intensity> 
+               </Transferencepoint>
+               <Transferencepoint>
+                       <greyValue>1</greyValue>
+                       <intensity>1</intensity> 
+               </Transferencepoint>
+ </TransferenceFunction>
+       <Colors>
+               <greyValueRGBpoint>
+                       <RGBgreyValue>0</RGBgreyValue>
+                       <red>0</red>
+                       <green>0</green>
+                       <blue>0</blue>
+               </greyValueRGBpoint>
+               <greyValueRGBpoint>
+                       <RGBgreyValue>0.25</RGBgreyValue>
+                       <red>1</red>
+                       <green>0</green>
+                       <blue>0</blue>
+               </greyValueRGBpoint>
+               <greyValueRGBpoint>
+                       <RGBgreyValue>0.5</RGBgreyValue>
+                       <red>0</red>
+                       <green>0</green>
+                       <blue>1</blue>
+               </greyValueRGBpoint>
+               <greyValueRGBpoint>
+                       <RGBgreyValue>0.75</RGBgreyValue>
+                       <red>0</red>
+                       <green>1</green>
+                       <blue>0</blue>
+               </greyValueRGBpoint>
+               <greyValueRGBpoint>
+                       <RGBgreyValue>1</RGBgreyValue>
+                       <red>0</red>
+                       <green>0</green>
+                       <blue>0.2</blue>
+               </greyValueRGBpoint>
+       </Colors>
+       </ComboBoxItem>
+ <ComboBoxItem>
+ <TransferenceFunction>
+               <Transferencepoint>
+                       <greyValue>0.0507602</greyValue>
+                       <intensity>0</intensity> 
+               </Transferencepoint>
+               <Transferencepoint>
+                       <greyValue>0.486513</greyValue>
+                       <intensity>1</intensity> 
+               </Transferencepoint>
+               <Transferencepoint>
+                       <greyValue>0.932075</greyValue>
+                       <intensity>1</intensity> 
+               </Transferencepoint>
+ </TransferenceFunction>
+       <Colors>
+               <greyValueRGBpoint>
+                       <RGBgreyValue>0</RGBgreyValue>
+                       <red>0</red>
+                       <green>0</green>
+                       <blue>0</blue>
+               </greyValueRGBpoint>
+               <greyValueRGBpoint>
+                       <RGBgreyValue>0.83693</RGBgreyValue>
+                       <red>1</red>
+                       <green>0</green>
+                       <blue>0</blue>
+               </greyValueRGBpoint>
+       </Colors>
+       </ComboBoxItem>
+ <ComboBoxItem>
+ <TransferenceFunction>
+               <Transferencepoint>
+                       <greyValue>0.0701324</greyValue>
+                       <intensity>1</intensity> 
+               </Transferencepoint>
+               <Transferencepoint>
+                       <greyValue>0.491417</greyValue>
+                       <intensity>1</intensity> 
+               </Transferencepoint>
+               <Transferencepoint>
+                       <greyValue>0.888426</greyValue>
+                       <intensity>1</intensity> 
+               </Transferencepoint>
+ </TransferenceFunction>
+       <Colors>
+               <greyValueRGBpoint>
+                       <RGBgreyValue>0.00465915</RGBgreyValue>
+                       <red>1</red>
+                       <green>1</green>
+                       <blue>1</blue>
+               </greyValueRGBpoint>
+               <greyValueRGBpoint>
+                       <RGBgreyValue>0.997548</RGBgreyValue>
+                       <red>0</red>
+                       <green>0</green>
+                       <blue>0</blue>
+               </greyValueRGBpoint>
+       </Colors>
+       </ComboBoxItem>
+</ComboBoxData>
diff --git a/lib/maracasVisuLib/src/CMakeLists.txt b/lib/maracasVisuLib/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b3b3a69
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS(CutModule)
index f29854d71a5f14001294134947cdf6778fdf0712..2991814153232b6e0f4aa64d6e9c9f253a093b6d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelMainPanel.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/09/01 14:01:34 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/09/08 08:14:25 $
+  Version:   $Revision: 1.3 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -20,7 +20,8 @@
 // EOF - wxMaracasMPR.cxx
 
 #include "CutModelMainPanel.h"
-
+#include "HistogramDialog.h"
+#include "creaSystem.h"
 
 #include <wx/colordlg.h>
 #include <wx/bmpbuttn.h>
 #include <Redo.xpm>
 #include <OkAll.xpm>
 
+
+
 CutModelMainPanel* CutModelMainPanel::instance=NULL;
 
-CutModelMainPanel::CutModelMainPanel( wxWindow* parent)
+CutModelMainPanel::CutModelMainPanel( wxWindow* parent, std::string path)
 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
 
        cutmanager=NULL;
 
-       initialize();
+       initialize(path);
 
 }
 CutModelMainPanel::~CutModelMainPanel( ){
        
-
+       delete cutmanager;
 }
 
-void CutModelMainPanel::initialize(){
-       cutmanager = new CutModelManager();
+void CutModelMainPanel::initialize(std::string path){
+       
+       cutmanager = new CutModelManager(path);
 
        _panelid = 0;
        _wxauimanager = new wxAuiManager(this); 
@@ -57,16 +61,19 @@ void CutModelMainPanel::initialize(){
        _wxauimanager->Update();
 }
 
-CutModelMainPanel* CutModelMainPanel::getInstance(wxWindow* parent){
+CutModelMainPanel* CutModelMainPanel::getInstance(wxWindow* parent, std::string path){
        if(instance==NULL){
-               instance = new CutModelMainPanel(parent);
+               if(parent == NULL){
+                       parent = new wxFrame();
+               }
+               instance = new CutModelMainPanel(parent, path);
        }
        return instance;
 }
 
-CutModelMainPanel* CutModelMainPanel::getInstance(){
+/*CutModelMainPanel* CutModelMainPanel::getInstance(){
        return instance;
-}
+}*/
 
 void CutModelMainPanel::setImageData(vtkImageData* img){
        try{
@@ -183,11 +190,26 @@ CutModelView* CutModelMainPanel::getModelView(int id)throw( CutModelException){
        return current;
 }
 void CutModelMainPanel::onUndo(){
+       try{
+               checkInvariant();               
+               int result = cutmanager->Undo();
 
+       }catch(CutModelException e){
+               showErrorDialog(e.getCause());
+       }
+       
 }
 
 void CutModelMainPanel::onRedo(){
 
+       try{
+               checkInvariant();               
+               int result = cutmanager->Redo();
+
+       }catch(CutModelException e){
+               showErrorDialog(e.getCause());
+       }
+       
 }
 
 void CutModelMainPanel::changeOpacity(int id,int opacity){
@@ -246,7 +268,8 @@ void CutModelMainPanel::updateActorDirection(int id){
 
 void CutModelMainPanel::ExecuteCut(int id, double* range, bool isinside){
        try{
-               checkInvariant();
+               checkInvariant();               
+
                cutmanager->ExecuteCut(id, range, isinside);
        }catch(CutModelException e){
                showErrorDialog(e.getCause());
@@ -270,7 +293,23 @@ vtkImageData* CutModelMainPanel::GetResultImage(){
 }
 
 void CutModelMainPanel::ShowStatistics(int id){
-    
+
+       checkInvariant();
+       HistogramDialog *histo = new HistogramDialog(this, _T("Statistics"));
+
+       histo->initializeHistogram(cutmanager->GetResultImage());
+
+       histo->ShowModal();
+
+       delete histo;
+}
+
+void CutModelMainPanel::SaveCutModelData(std::string filename){
+       cutmanager->SaveCutModelData(filename);
+}
+
+void CutModelMainPanel::LoadCutModelData(std::string filename){
+    cutmanager->LoadCutModelData(filename);
 }
 /**
 **
index 5caaa706488b4e819b7cef20853df1c30b9bc6c8..92f30cd5c9ac2d12b10cdd345a38ba08cda58fc8 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelMainPanel.h,v $
   Language:  C++
-  Date:      $Date: 2009/09/01 14:01:35 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/09/08 08:14:25 $
+  Version:   $Revision: 1.3 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -39,12 +39,12 @@ class  creaMaracasVisu_EXPORT  CutModelMainPanel : public wxPanel
 {
 
 public:
-       CutModelMainPanel( wxWindow* parent);
+       
     ~CutModelMainPanel( );
 
-       static CutModelMainPanel* getInstance(wxWindow* parent);
+       static CutModelMainPanel* getInstance(wxWindow* parent=NULL, std::string path ="");
 
-       static CutModelMainPanel* getInstance();
+       //static CutModelMainPanel* getInstance();
 
        void setImageData(vtkImageData* img);
 
@@ -52,7 +52,7 @@ public:
 
        void setRenderer(vtkRenderer* renderer);
 
-       void initialize();
+       void initialize(std::string path);
 
        void onAddCutModel();
 
@@ -83,7 +83,12 @@ public:
        void ShowPopUpMenu(int id);
 
        void ShowStatistics(int id);
+
+       
 private:
+
+       CutModelMainPanel( wxWindow* parent, std::string path);
+
        static CutModelMainPanel* instance;
 
        CutModelManager* cutmanager;    
@@ -92,6 +97,10 @@ private:
 
        void showErrorDialog(std::string str);
 
+       void SaveCutModelData(std::string filename);
+
+       void LoadCutModelData(std::string filename);
+
        std::vector<CutModelView*> viewpanels;
 
        wxAuiManager* _wxauimanager;
index d340ec69b3c1adc1aa56c70d5bd7114a3c746638..ef0806c93a90c03d3069a3cbebc776cc05a43a7c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelData.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/09/01 14:01:36 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/09/08 08:14:27 $
+  Version:   $Revision: 1.3 $
 
   Copyright: (c) 2002, 2003
   License:
 **     Start of the manager class
 **/
 CutModelData::CutModelData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img){
+       
+       initializeData(id, interactor, observer, img);
+       
+}
+CutModelData::CutModelData(){
+
+}
+void CutModelData::initializeData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img){
        _id = id;
        _currentshape=0;
        createBoxWidget(interactor, observer);
@@ -28,8 +36,6 @@ CutModelData::CutModelData(int id, vtkRenderWindowInteractor* interactor, vtkCom
        createShapes();
        ChangeShape(0);
        checkInvariant();
-
-       
 }
 CutModelData::~CutModelData(){
        checkInvariant();
@@ -50,9 +56,10 @@ void CutModelData::createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCom
 
        _boxWidgetVolume = vtkBoxWidget::New();
        _boxWidgetVolume->SetInteractor( interactor );
-       //_boxWidgetVolume->SetPlaceFactor(2);
+       //_boxWidgetVolume->SetPlaceFactor(1);
        //_boxWidgetVolume->SetInput( img );    
        //_boxWidgetVolume->PlaceWidget();
+
        _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent              , observer );
        _boxWidgetVolume->AddObserver( vtkCommand::StartInteractionEvent                 , observer );
        _boxWidgetVolume->AddObserver( vtkCommand::RightButtonReleaseEvent               , observer );
@@ -73,13 +80,20 @@ void CutModelData::setTransform(vtkImageData* img)throw( CutModelException){
        int *ext = img->GetExtent();
        double *spc = img->GetSpacing();
 
+       
        matrix->SetElement(0,0,(ext[1]-ext[0])/4*spc[0]);
        matrix->SetElement(1,1,(ext[3]-ext[2])/4*spc[1]);       
-       matrix->SetElement(2,2,(ext[5]-ext[4])/4*spc[2]);               
-       matrix->SetElement(0,3,(ext[1]-ext[0])/2*spc[0]);
-       matrix->SetElement(1,3,(ext[3]-ext[2])/2*spc[1]);
-       matrix->SetElement(2,3,(ext[5]-ext[4])/2*spc[2]);
+       matrix->SetElement(2,2,(ext[5]-ext[4])/4*spc[2]);
+
+       double orgx = (ext[1]-ext[0])/2*spc[0];
+       double orgy = (ext[3]-ext[2])/2*spc[1];
+       double orgz = (ext[5]-ext[4])/2*spc[2];
 
+       matrix->SetElement(0,3,orgx);
+       matrix->SetElement(1,3,orgy);
+       matrix->SetElement(2,3,orgz);
+
+       
        currentmatrix->SetMatrix(matrix);
        _boxWidgetVolume->SetTransform(currentmatrix);  
                
@@ -178,14 +192,16 @@ CutModelFigure* CutModelData::getCurentCuttingModel(){
                throw CutModelException("Shape type not found");
        }       
 }
-void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)
+void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException)
 {
 
        wxBusyCursor wait;
 
        CutModelFigure* actualCuttingModel = getCurentCuttingModel();
 
+       //_boxWidgetVolume->GetTransform(currentmatrix);        
        actualCuttingModel->SetVtkTransform(getModelTransform(copyimage));
+       //actualCuttingModel->SetVtkTransform(currentmatrix);
        actualCuttingModel->SetInversVtkTransform(getModelTransformInvers());   
 
        bool                    inside;
@@ -229,25 +245,59 @@ void CutModelData::ExecuteCut( double* range, bool isinside, vtkImageData* copyi
        
 }
 
-vtkTransform* CutModelData::getModelTransform(vtkImageData* copyimage){
+void CutModelData::ExecuteUnCut(bool isinside, vtkImageData* image, vtkImageData* copyimage)throw( CutModelException)
+{
 
-       vtkMatrix4x4* matrix = currentmatrix->GetMatrix();
-       vtkMatrix4x4* matrixmodel = modeltransform->GetMatrix();
+       wxBusyCursor wait;
 
-       double *spc = copyimage->GetSpacing();
+       CutModelFigure* actualCuttingModel = getCurentCuttingModel();
+       
+       actualCuttingModel->SetVtkTransform(getModelTransform(copyimage));
+       
+       actualCuttingModel->SetInversVtkTransform(getModelTransformInvers());   
 
-       modeltransform->Identity();
+       bool                    inside;
+       bool                    volInt, volExt;
+       int                             xx,yy,zz;
+       unsigned short* pOrg;   
+       int                             ext[6];
+       double                  spc[3];
+       long int                contAfter = 0;
+       long int                contBefor = 0;  
+       
+       double value;
+       
 
-       double* orient = currentmatrix->GetOrientationWXYZ();
-       modeltransform->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]);    
+               
+       copyimage->GetExtent(ext);        
+       
+       for (xx=ext[0];xx<ext[1]; xx++)
+       {
+               for (yy=ext[2];yy<ext[3]; yy++)
+               {
+                       for (zz=ext[4];zz<ext[5];zz++)
+                       {
+                               inside=actualCuttingModel->IfPointInside(xx,yy,zz);
+                               if (  ((inside==true)&&(isinside==true)) || ((!inside==true)&&(!isinside)) )
+                               {
+                                       value = *((unsigned short*)image->GetScalarPointer (xx,yy,zz));
+                                       pOrg=(unsigned short*)copyimage->GetScalarPointer (xx,yy,zz); 
+                                       //std::cout<<"CutModelData::ExecuteUnCut() "<<value<<" "<<*pOrg<<std::endl;
+                                       *pOrg=(unsigned short)value;
+                               } // if inside
+                       } // for zz
+               } // for yy
+       } // for xx
+       
+}
 
-       double* pos = currentmatrix->GetPosition();
-       modeltransform->Translate(pos[0]/spc[0],pos[1]/spc[1],pos[2]/spc[2]);
+vtkTransform* CutModelData::getModelTransform(vtkImageData* copyimage){
 
-       double* scal = currentmatrix->GetScale();       
-       modeltransform->Scale(scal[0]/spc[0],scal[1]/spc[1],scal[2]/spc[2]);
+       double *spc = copyimage->GetSpacing();
+       modeltransform->Identity();
 
-       /*matrixmodel->Identity();      
+    vtkMatrix4x4* matrix = currentmatrix->GetMatrix();
+       vtkMatrix4x4* matrixmodel = modeltransform->GetMatrix();
        matrixmodel->SetElement(0,0,matrix->GetElement(0,0)/spc[0]);
        matrixmodel->SetElement(1,0,matrix->GetElement(1,0)/spc[0]);
        matrixmodel->SetElement(2,0,matrix->GetElement(2,0)/spc[0]);
@@ -259,20 +309,79 @@ vtkTransform* CutModelData::getModelTransform(vtkImageData* copyimage){
        matrixmodel->SetElement(2,2,matrix->GetElement(2,2)/spc[2]);            
        matrixmodel->SetElement(0,3,matrix->GetElement(0,3)/spc[0]);
        matrixmodel->SetElement(1,3,matrix->GetElement(1,3)/spc[1]);
-       matrixmodel->SetElement(2,3,matrix->GetElement(2,3)/spc[2]);*/
+       matrixmodel->SetElement(2,3,matrix->GetElement(2,3)/spc[2]);    
+
+       /*
+       
+       double* pos = currentmatrix->GetPosition();
+       modeltransform->Translate(pos[0]/spc[0],pos[1]/spc[1],pos[2]/spc[2]);   
 
-       //modeltransform->SetMatrix(matrixmodel);
+       double* scal = currentmatrix->GetScale();       
+       modeltransform->Scale(scal[0]/spc[0],scal[1]/spc[1],scal[2]/spc[2]);
 
+       //double* orient = currentmatrix->GetOrientation();
+       //modeltransform->RotateZ(orient[2]);   
+       //modeltransform->RotateY(orient[1]);   
+       //modeltransform->RotateX(orient[0]);   
+       double* orient = currentmatrix->GetOrientationWXYZ();   
+       modeltransform->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]);    
+       
+       */
+               
 
        modeltransform->Update();
 
        return modeltransform;
 
        
+}
+void CutModelData::setTransform(vtkTransform* transform, vtkImageData* img)throw( CutModelException){
+               
+
+       double *spc = img->GetSpacing();
+
+       currentmatrix->Identity();      
+
+       /*double* orient = transform->GetOrientationWXYZ();
+       currentmatrix->RotateWXYZ(orient[0],orient[1],orient[2],orient[3]);     
+
+       double* pos = transform->GetPosition();
+       currentmatrix->Translate(pos[0]/spc[0],pos[1]/spc[1],pos[2]/spc[2]);
+
+       double* scal = transform->GetScale();   
+       currentmatrix->Scale(scal[0]/spc[0],scal[1]/spc[1],scal[2]/spc[2]);
+
+       currentmatrix->Update();        */
+               
+       _boxWidgetVolume->SetTransform(transform);
+
+    /*vtkMatrix4x4* matrix = transform->GetMatrix();
+       vtkMatrix4x4* matrixcurrent = currentmatrix->GetMatrix();
+       matrixcurrent->SetElement(0,0,matrix->GetElement(0,0)/spc[0]);
+       matrixcurrent->SetElement(1,0,matrix->GetElement(1,0)/spc[0]);
+       matrixcurrent->SetElement(2,0,matrix->GetElement(2,0)/spc[0]);
+       matrixcurrent->SetElement(0,1,matrix->GetElement(0,1)/spc[1]);
+       matrixcurrent->SetElement(1,1,matrix->GetElement(1,1)/spc[1]);
+       matrixcurrent->SetElement(2,1,matrix->GetElement(2,1)/spc[1]);
+       matrixcurrent->SetElement(0,2,matrix->GetElement(0,2)/spc[2]);
+       matrixcurrent->SetElement(1,2,matrix->GetElement(1,2)/spc[2]);
+       matrixcurrent->SetElement(2,2,matrix->GetElement(2,2)/spc[2]);          
+       matrixcurrent->SetElement(0,3,matrix->GetElement(0,3)/spc[0]);
+       matrixcurrent->SetElement(1,3,matrix->GetElement(1,3)/spc[1]);
+       matrixcurrent->SetElement(2,3,matrix->GetElement(2,3)/spc[2]);  */
+
+
+       udapteActorDirection();
+       getModelTransform(img);
+
 }
 vtkTransform* CutModelData::getModelTransformInvers(){
        inversModel->Identity ();
        inversModel->Concatenate ( modeltransform );
        inversModel->Inverse(); 
        return inversModel;
+}
+
+vtkPolyData* CutModelData::getPolyData()throw( CutModelException){
+       return _Mapper->GetInput();
 }
\ No newline at end of file
index 84d4e0bd1b8477eb2cdc06caf63bc165ec72673c..eb82e8dc4a584b76500e2f99d4c7b0de352b16e9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelData.h,v $
   Language:  C++
-  Date:      $Date: 2009/09/01 14:01:36 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/09/08 08:14:27 $
+  Version:   $Revision: 1.3 $
 
   Copyright: (c) 2002, 2003
   License:
 class CutModelData  {
 
 public:
+       CutModelData();
        CutModelData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img);
        ~CutModelData();
+       void initializeData(int id, vtkRenderWindowInteractor* interactor, vtkCommand* observer, vtkImageData* img);
+
 
        int getId(){
                return _id;
@@ -56,6 +59,8 @@ public:
        void ChangeShape(int selection)throw( CutModelException);
 
        vtkActor* getActor()throw( CutModelException);
+
+       vtkPolyData* getPolyData()throw( CutModelException);
        
        void changeColor(double r,double g,double b)throw( CutModelException);
 
@@ -63,7 +68,23 @@ public:
 
        void ExecuteCut( double* range, bool isinside, vtkImageData* copyimage)throw( CutModelException);
 
+       void ExecuteUnCut(  bool isinside, vtkImageData* image, vtkImageData* copyimage)throw( CutModelException);
+
        void RefreshViewBox();
+
+       vtkTransform* getCurrentMatrix(){
+               return currentmatrix;
+       }
+
+       int getCurrentShape(){
+               return _currentshape;
+       }
+
+       void setCurrentShape(int currentshape){
+               _currentshape = currentshape;
+       }
+
+       void setTransform(vtkTransform* transform,vtkImageData* img)throw( CutModelException);
 private:       
        
        void checkInvariant()throw( CutModelException);
@@ -71,7 +92,7 @@ private:
        void createBoxWidget(vtkRenderWindowInteractor* interactor, vtkCommand* observer);
        void createActor();
        void setTransform(vtkImageData* img)throw( CutModelException);
-       void createShapes();
+       void createShapes();    
 
        vtkBoxWidget* _boxWidgetVolume;
        vtkPolyDataMapper* _Mapper;     
@@ -87,6 +108,7 @@ private:
        vtkTransform* modeltransform;
        vtkTransform* inversModel;
 
+
        CutModelFigure* getCurentCuttingModel();
 
        vtkTransform* getModelTransform(vtkImageData* copyimage);
index 796932d38addab8292b0b252313cb403e63b79f0..652faa7d6d2d1c2efe72b7a52273ae54e8174aaf 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelManager.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/09/01 14:01:36 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/09/08 08:14:27 $
+  Version:   $Revision: 1.3 $
 
   Copyright: (c) 2002, 2003
   License:
 /**
 **     Start of the manager class
 **/
-CutModelManager::CutModelManager(){
+CutModelManager::CutModelManager(std::string path){
+       _path = path;
        _img = NULL;
        _copyimg = NULL;
        _interactor = NULL;     
        _render = NULL;
+       _currentaction=0;
 }
 CutModelManager::~CutModelManager(){
+       std::string files = _path;
+    files+="/infounrd_0_fig_0.info";   
+       remove(files.c_str());
 }
 
 
@@ -156,9 +161,18 @@ void CutModelManager::RemoveActor(int id)throw( CutModelException){
 
 void CutModelManager::ExecuteCut(int id, double* range, bool isinside)throw( CutModelException){
     checkInvariant();
+               
        CutModelData* current = getCutModelData(id);
        current->ExecuteCut(range, isinside,_copyimg);
 
+
+       /*
+       Setting extra information for the undo
+       */
+       CutModelSaveBinInfo* undoaction = this->AddActionUndo(id, CUTMODEL_CUT);
+       undoaction->setRange(range);
+       undoaction->setIsInside(isinside);
+
 }
 
 vtkImageData* CutModelManager::GetResultImage(){
@@ -173,4 +187,94 @@ void CutModelManager::RefreshActor(int id){
        _render->AddActor(current->getActor()); 
        current->RefreshViewBox();
        _render->Render();
+}
+
+void CutModelManager::SaveCutModelData(std::string filename)throw( CutModelException){ 
+
+       
+       throw CutModelException("not implemented");
+       
+       
+       
+       
+}
+
+
+
+void CutModelManager::LoadCutModelData(std::string filename)throw( CutModelException){
+       
+       throw CutModelException("not implemented");
+       
+}
+
+CutModelSaveBinInfo* CutModelManager::AddActionUndo(int idc, UNDOTYPE type)throw( CutModelException){
+       
+       for(int i = _undoredo.size()-1; i > _currentaction;i--){
+               delete _undoredo[i];
+               _undoredo.pop_back();           
+       }
+
+       CutModelSaveBinInfo* cutmodel = new CutModelSaveBinInfo(idc, _currentaction, type, _path);
+       if(type == CUTMODEL_CUT){
+               cutmodel->saveMatrix4x4(this->getCutModelData(idc)->getCurrentMatrix()->GetMatrix());
+               cutmodel->setCurrentShape(this->getCutModelData(idc)->getCurrentShape());
+       }
+
+       _undoredo.push_back(cutmodel);
+
+       _currentaction++;// = _undoredo.size();
+       //std::cout<<"current index "<<_currentaction;
+               
+       return cutmodel;
+}
+
+int CutModelManager::Undo()    throw( CutModelException){
+ //&& _currentaction < _undoredo.size()
+       if(_currentaction > 0){
+               int tempaction = _currentaction-1;
+               CutModelSaveBinInfo* currentundo = _undoredo[tempaction];
+               CutModelData* currentmodel;
+
+               if(currentundo->getActionType()==CUTMODEL_CUT){
+                       //Undo the cut
+                       vtkTransform* transform = currentundo->getTransformFromMatrixFile();
+
+                       currentmodel = getCutModelData(currentundo->getId());
+
+                       currentmodel->setTransform(transform, _copyimg);
+
+                       currentmodel->setCurrentShape(currentundo->getCurrentShape());
+
+                       currentmodel->ExecuteUnCut(currentundo->getIsInside(), _img, _copyimg);
+
+               }
+               //Every thing ok
+               _currentaction--;
+               return 0;
+       }
+       return -1;
+}
+
+int CutModelManager::Redo()    throw( CutModelException){
+
+       if(_currentaction >= 0 && _currentaction < _undoredo.size()){
+               
+
+               CutModelSaveBinInfo* currentundo = _undoredo[_currentaction];
+               CutModelData* currentmodel;
+
+               if(currentundo->getActionType()==CUTMODEL_CUT){
+                       //Redo the cut
+                       vtkTransform* transform = currentundo->getTransformFromMatrixFile();
+                       currentmodel = getCutModelData(currentundo->getId());
+                       currentmodel->setTransform(transform, _copyimg);
+                       currentmodel->setCurrentShape(currentundo->getCurrentShape());
+                       currentmodel->ExecuteCut(currentundo->getRange(), currentundo->getIsInside(), _copyimg);
+               }
+
+               _currentaction++;
+
+               return 0;
+       }
+       return -1;
 }
\ No newline at end of file
index 280e85ca4ba4cdbb2b7e01908764d6ba03122a62..14907c523c3ce70071cdbb9d15818d65d7d22013 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: CutModelManager.h,v $
   Language:  C++
-  Date:      $Date: 2009/09/01 14:01:36 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2009/09/08 08:14:27 $
+  Version:   $Revision: 1.3 $
 
   Copyright: (c) 2002, 2003
   License:
 #define __CutModelManagerH__
 
 #include <iostream>
+#include <stdio.h>
 #include <vector>
 
 #include "vtkImageData.h"
 #include "vtkRenderWindowInteractor.h"
 #include "vtkRenderer.h"
+#include <vtkPolyDataWriter.h>
 
 #include "CutModelException.h"
 #include "CutModelData.h"
+#include "CutModelSaveBinInfo.h"
+
+
 
 class CutModelManager  {
 
 public:
-       CutModelManager();
+       CutModelManager(std::string path);
        ~CutModelManager();
 
        void setImageData(vtkImageData* img);
@@ -64,14 +69,29 @@ public:
        vtkImageData* GetResultImage();
 
        void RefreshActor(int id);
-private:       
+
+       void SaveCutModelData(std::string filename)throw( CutModelException);
+
+       void LoadCutModelData(std::string filename)throw( CutModelException);
+
+       CutModelSaveBinInfo* AddActionUndo(int id, UNDOTYPE type)throw( CutModelException);
+
+       int Undo()throw( CutModelException);
+
+       int Redo()throw( CutModelException);
+private:
+       
+       int _currentaction;
+
        void checkInvariant() throw( CutModelException);
+       std::string _path;
        vtkImageData* _img;
        vtkImageData* _copyimg;
        vtkRenderer* _render;
        vtkRenderWindowInteractor* _interactor;
 
        std::vector<CutModelData*> _vectordata;
+       std::vector<CutModelSaveBinInfo*> _undoredo;
        CutModelData* getCutModelData(int id)throw( CutModelException);
        
 };
diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelSaveBinInfo.cxx b/lib/maracasVisuLib/src/CutModule/kernel/CutModelSaveBinInfo.cxx
new file mode 100644 (file)
index 0000000..75cc799
--- /dev/null
@@ -0,0 +1,111 @@
+/*=========================================================================
+
+  Program:   wxMaracas
+  Module:    $RCSfile: CutModelSaveBinInfo.cxx,v $
+  Language:  C++
+  Date:      $Date: 2009/09/08 08:14:27 $
+  Version:   $Revision: 1.1 $
+
+  Copyright: (c) 2002, 2003
+  License:
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+#include "CutModelSaveBinInfo.h"
+
+/**
+**     Start of the manager class
+**/
+CutModelSaveBinInfo::CutModelSaveBinInfo(int id, int currentaction, UNDOTYPE actiontype, std::string path){
+
+       _id = id;
+
+       char c[100];
+       sprintf(c,"/infounrd_%d_fig_%d.info",currentaction,id);
+
+       _stdFilename = path;    
+    _stdFilename+=c;
+       _stdFilename+=".poly";
+
+       _matrixFilename = path; 
+       _matrixFilename+=c;
+       _actiontype = actiontype;       
+
+       
+}
+CutModelSaveBinInfo::~CutModelSaveBinInfo(){
+       
+}
+void CutModelSaveBinInfo::savePolyData(vtkPolyData* polydata){
+       vtkPolyDataWriter * writer = vtkPolyDataWriter ::New();
+       writer->SetFileName(_stdFilename.c_str());      
+       writer->SetInput(polydata);
+       writer->SetFileTypeToBinary();
+       writer->Write();
+       writer->Delete();
+}
+
+vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()throw( CutModelException){
+       vtkPolyDataReader* reader = vtkPolyDataReader::New();
+       //std::cout<<"filename vtkTransform* CutModelSaveBinInfo::getPolyDataTransform()"<<this->getSTDFileName()<<std::endl;
+       reader->SetFileName(this->getSTDFileName().c_str());
+       vtkPolyData* poly = reader->GetOutput();
+
+       vtkPolyDataMapper* mapper       = vtkPolyDataMapper::New();     
+       mapper->SetInput(poly);
+       vtkActor* actor = vtkActor::New();
+       actor->SetMapper(mapper);
+       vtkMatrix4x4* actmatrix = actor->GetMatrix();
+
+       std::cout<<"tkTransform* CutModelSaveBinInfo::getPolyDataTransform() Actor "<<actor<<std::endl;
+       std::cout<<"tkTransform* CutModelSaveBinInfo::getPolyDataTransform() Actor Matrix "<<actmatrix<<std::endl;
+
+       mapper->Update();
+
+       vtkTransform* transform = vtkTransform::New();
+
+       transform->Identity();
+
+       transform->GetMatrix()->SetElement(0,0,actmatrix->GetElement(0,0));
+       transform->GetMatrix()->SetElement(1,0,actmatrix->GetElement(1,0));
+       transform->GetMatrix()->SetElement(2,0,actmatrix->GetElement(2,0));
+       transform->GetMatrix()->SetElement(0,1,actmatrix->GetElement(0,1));
+       transform->GetMatrix()->SetElement(1,1,actmatrix->GetElement(1,1));
+       transform->GetMatrix()->SetElement(2,1,actmatrix->GetElement(2,1));
+       transform->GetMatrix()->SetElement(0,2,actmatrix->GetElement(0,2));
+       transform->GetMatrix()->SetElement(1,2,actmatrix->GetElement(1,2));
+       transform->GetMatrix()->SetElement(2,2,actmatrix->GetElement(2,2));             
+       transform->GetMatrix()->SetElement(0,3,actmatrix->GetElement(0,3));
+       transform->GetMatrix()->SetElement(1,3,actmatrix->GetElement(1,3));
+       transform->GetMatrix()->SetElement(2,3,actmatrix->GetElement(2,3));
+
+       actor->Delete();
+       mapper->Delete();
+       reader->Delete();
+       //poly->Delete();
+       
+
+       return transform;
+       
+}
+
+
+void CutModelSaveBinInfo::saveMatrix4x4(vtkMatrix4x4* matrix){
+       fstream binary_file(_matrixFilename.c_str(),ios::out|ios::binary);
+       binary_file.write(reinterpret_cast<char *>(matrix),sizeof(vtkMatrix4x4));
+       binary_file.close();
+}
+vtkTransform* CutModelSaveBinInfo::getTransformFromMatrixFile()throw( CutModelException){
+       vtkMatrix4x4* matrix = vtkMatrix4x4::New();
+       fstream binary_file(_matrixFilename.c_str(),ios::binary|ios::in);
+       binary_file.read(reinterpret_cast<char *>(matrix),sizeof(vtkMatrix4x4));
+       binary_file.close();
+
+       vtkTransform* transform = vtkTransform::New();
+       transform->SetMatrix(matrix);
+
+       return transform;
+}
\ No newline at end of file
diff --git a/lib/maracasVisuLib/src/CutModule/kernel/CutModelSaveBinInfo.h b/lib/maracasVisuLib/src/CutModule/kernel/CutModelSaveBinInfo.h
new file mode 100644 (file)
index 0000000..fa275aa
--- /dev/null
@@ -0,0 +1,111 @@
+/*=========================================================================
+
+  Program:   wxMaracas
+  Module:    $RCSfile: CutModelSaveBinInfo.h,v $
+  Language:  C++
+  Date:      $Date: 2009/09/08 08:14:27 $
+  Version:   $Revision: 1.1 $
+
+  Copyright: (c) 2002, 2003
+  License:
+  
+     This software is distributed WITHOUT ANY WARRANTY; without even 
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+     PURPOSE.  See the above copyright notice for more information.
+
+=========================================================================*/
+
+
+
+
+#ifndef __CutModelSaveBinInfoH__
+#define __CutModelSaveBinInfoH__
+
+#include <iostream>
+#include <vector>
+#include "CutModelException.h"
+
+#include <vtkPolyData.h>
+#include <vtkPolyDataWriter.h>
+#include <vtkPolyDataReader.h>
+#include <vtkPolyDataMapper.h>
+#include <vtkTransform.h>
+#include <vtkMatrix4x4.h>
+#include <vtkActor.h>
+
+enum UNDOTYPE
+{
+    CUTMODEL_ADD = 0,  
+       CUTMODEL_REMOVE = 10,
+       CUTMODEL_CUT= 20,
+       
+};
+
+class CutModelSaveBinInfo  {
+
+public:
+       
+       CutModelSaveBinInfo(int id, int currentaction,UNDOTYPE actiontype, std::string path);
+       ~CutModelSaveBinInfo();
+
+       int getId(){
+               return _id;
+       }       
+
+       UNDOTYPE getActionType(){
+               return _actiontype;
+       }
+       std::string getSTDFileName()throw( CutModelException){
+               if(_stdFilename==""){
+                       throw new CutModelException("Filename undoredo does not exists");
+               }
+               return _stdFilename;
+       }
+
+       /*void setSTDFileName(std::string filename){
+               _stdFilename = filename;
+       }*/
+
+       int getCurrentShape(){
+               return _currentshape;
+       }
+
+       void setCurrentShape(int currentshape){
+               _currentshape=currentshape;
+       }
+
+       void savePolyData(vtkPolyData* polydata);
+
+       vtkTransform* getPolyDataTransform()throw( CutModelException);  
+
+       void saveMatrix4x4(vtkMatrix4x4* matrix);
+       vtkTransform* getTransformFromMatrixFile()throw( CutModelException);
+
+       void setRange(double* range){
+               _range = range;
+       }
+       void setIsInside(bool isinside){
+               _isinside = isinside;
+       }
+
+       double* getRange(){
+               return _range;
+       }
+       bool getIsInside(){
+               return _isinside;
+       }
+       
+private:               
+       
+       int _id;
+       UNDOTYPE _actiontype;
+       int _currentshape;
+       double* _range;
+       bool _isinside;
+       std::string _stdFilename;               
+       std::string _matrixFilename;    
+};
+
+
+
+#endif 
index 2a23323b69f0651648ce21936f1952c33756d669..1a2c14093f0a03835514879350d6e7ee66f5a2af 100644 (file)
@@ -53,8 +53,8 @@ void HistogramDialog::initializeHistogramDialog(bool extracontrols){
        /*
        Pointers
        */
-       wxvtkmpr3Dview=NULL;
-       wxvtkclipping3Dview=NULL;
+       //wxvtkmpr3Dview=NULL;
+       //wxvtkclipping3Dview=NULL;
        
        /*
         Histogram
@@ -576,16 +576,16 @@ void HistogramDialog::OnRefreshBtn(wxCommandEvent &event)
         NOTE I NEED THE UPDATE
        */
        //if it was call from the clipping ctnrl panel
-       if(wxvtkclipping3Dview!=NULL)
-       {
-               wxvtkclipping3Dview->Refresh();
+       //if(wxvtkclipping3Dview!=NULL)
+       //{
+       //      wxvtkclipping3Dview->Refresh();
 
-       }
-       else if(wxvtkmpr3Dview!=NULL)
-       {
-               wxvtkmpr3Dview->Refresh();
+       //}
+       //else if(wxvtkmpr3Dview!=NULL)
+       //{
+       //      wxvtkmpr3Dview->Refresh();
 
-       }
+       //}
 }
 
 
@@ -708,14 +708,14 @@ void HistogramDialog::OnRefreshBtn(wxCommandEvent &event)
        {
                newvol=vol;     
        }
-       void HistogramDialog::setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1)
-       {
-               wxvtkmpr3Dview=wxvtkmpr3Dview1;
-       }
-       void HistogramDialog::setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1)
-       {
-               wxvtkclipping3Dview=wxvtkclipping3Dview1;
-       }
+       //void HistogramDialog::setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1)
+       //{
+       //      wxvtkmpr3Dview=wxvtkmpr3Dview1;
+       //}
+       //void HistogramDialog::setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1)
+       //{
+       //      wxvtkclipping3Dview=wxvtkclipping3Dview1;
+       //}
 
 
        void  HistogramDialog::setTransferenceFunctionHasPoints(bool hasPoints)
index 8e9ece3e656942c30c50be79ddd2d57782e91414..13f7f3d5a0d47d964ac9e14b12ca3e622e3c29c9 100644 (file)
@@ -25,7 +25,7 @@
  #include <vtkColorTransferFunction.h>
  #include <vtkVolumeRayCastMapper.h>
  #include <vtkVolume.h>
- #include "../wxMPRWidget.h"
//#include "../wxMPRWidget.h"
 
 #include "HistogramDialogComboBoxItem.h"
 #include <wx/checkbox.h>
@@ -118,8 +118,8 @@ public:
        void setTF(vtkPiecewiseFunction* tf);
        void setVolumeMapper(vtkVolumeRayCastMapper* volMapper);
        void setVolume(vtkVolume* vol);
-       void setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1);
-       void setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1);
+       //void setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1);
+       //void setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1);
 
        //--------------------
        // plotter Information
@@ -213,8 +213,8 @@ private:
        vtkVolume                                                       *newvol;
 
        //things to refresh
-       wxVtkMPR3DView                                          *wxvtkmpr3Dview;
-       wxVtkClipping3DView                                     *wxvtkclipping3Dview;
+       //wxVtkMPR3DView                                                *wxvtkmpr3Dview;
+       //wxVtkClipping3DView                                   *wxvtkclipping3Dview;
 
        
        wxSizer* getControls(bool extracontrols = false);
index d1104dff66740b5c9d6c5a473427dff93b4d1e90..2af7d109699a9b18f7d2b39866cccbba498c108a 100644 (file)
@@ -620,4 +620,10 @@ void vtkClipping3DDataViewer::ReadMeshVTK(char *namefile)
        reader->SetFileName(namefile);
        reader->Update();
        _tissueStripper[3]->SetInput( reader->GetPolyDataOutput()  );
+}
+
+void vtkClipping3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
+       
+       _volumeProperty->SetColor(colortable);
+       
 }
\ No newline at end of file
index 55c27d9541870d5b12c60e0c5586df6c7729544e..8a54048f12789f0c81e7c438597ad5f2f6494764 100644 (file)
@@ -84,6 +84,8 @@ public:
        std::vector<double>*                                    GetBlueColorsOfColorTransferenceFVector();
        std::vector<double>*                                    GetGreyValueColorsOfColorTransferenceFVector();
 
+       void setColorTransferFunction(vtkColorTransferFunction* colortable);
+
        //--------------------------------------
        //Getters transference function
        //and color of the transference function
index acbeb2fbab85102c475d0373251833fbe3f05912..9e0daaf7f8a3b0bbbdab9af5649ff8279eff4003 100644 (file)
@@ -209,7 +209,6 @@ void vtkMPR3DDataViewer::Configure()
 //    _saggitalColors->SetLookupTable(_bwLut);
        
     _saggitalColors->SetLookupTable(_ctfun);
-
        
 
        if(_saggital==NULL){
@@ -332,4 +331,11 @@ void vtkMPR3DDataViewer::SetVisiblePosition(int idPosition, bool visible)
 bool vtkMPR3DDataViewer::GetVisiblePosition(int idPosition)
 {
        return _visiblePosition[idPosition];
-}
\ No newline at end of file
+}
+
+void vtkMPR3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
+       _saggitalColors->SetLookupTable(colortable);
+        _coronalColors->SetLookupTable(colortable);
+       _axialColors->SetLookupTable(colortable);
+}
\ No newline at end of file
index 3eb02167efe150c8d331db2af7fe4af2f8cd7dd8..ebb313238d38bcf54911a4f0d5b55b49c069f20e 100644 (file)
@@ -35,6 +35,8 @@ public:
        std::vector<double >       *GetctFunVectorGreen();
        std::vector<double >       *GetctFunVectorBlue();
 
+       void setColorTransferFunction(vtkColorTransferFunction* colortable);
+
 private:
        
        bool                                                            _visiblePosition[3];
index 7e68a7575230282ded95bc99735d6f2a6a72e3d5..987b0b1d3ae1c482cfb2cbaf313f2f3cd9634ce3 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_ViewerWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/07/27 07:58:20 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2009/09/08 08:14:30 $
+  Version:   $Revision: 1.16 $
 
   Copyright: (c) 2002, 2003
   License:
                if(mvtkmpr2Dview_Z!=NULL){
                        mvtkmpr2Dview_Z->setColorTransferFunction(colortable);
                }
+               if(mwxvtkmpr3Dview!=NULL){
+                       mwxvtkmpr3Dview->setColorTransferFunction(colortable);
+               }
        }
\ No newline at end of file
index ab9803cd9c19ed0d0ae36aee5a47b42ecb73f55b..61c5ea52f241ed7c135fcda6d17d6f76e4934f8d 100644 (file)
@@ -577,7 +577,7 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
        //setting variables if the user wants to do refresh
        hDlg->setCTF(ctfun);
        hDlg->setTF(tfun);
-       hDlg->setClipping3DView(_wxvtkclipping3Dview);
+       //hDlg->setClipping3DView(_wxvtkclipping3Dview);
        /*
        hDlg->setVolume(newvol);
        hDlg->setVolumeMapper(volumeMapper);
index 28c4ca778c3eb9885e99a99a0571a78c5984dd11..d6e88bbe5598dabd95916bf14c98b12135ec3278 100644 (file)
@@ -202,7 +202,9 @@ wxVtkMPR3DView::~wxVtkMPR3DView()
        }
 
 }
-
+void wxVtkMPR3DView::setColorTransferFunction(vtkColorTransferFunction* colortable){
+       GetVtkMPR3DDataViewer ()->setColorTransferFunction(colortable); 
+}
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::Refresh()   // virtual
 {
index 338e4016ea1ce73fd5a153c3e7cfedb1f27025c8..a704ac86dee78013f66c229a27dc74e20d6ac727 100644 (file)
@@ -42,6 +42,8 @@ public:
        void RemoveActor(vtkActor* actor);
        void ResetCamera(int *ext=NULL, double* origin=NULL,double* spc=NULL);
 
+       void setColorTransferFunction(vtkColorTransferFunction* colortable);
+
 private:
        wxVtk3DBaseView                                 *_wxvtk3Dbaseview;
        vtkMPR3DDataViewer                              *_vtkmpr3Ddataviewer;
index 8665e09ccd1f77507895fc9dd573499254a31acc..7e8d4a65ff467d24f38d578a976da6b343cee1b6 100644 (file)
@@ -232,7 +232,7 @@ hDlg->addColorPoint(gr,(int)(r*255),(int)(g*255),(int)(b*255));
        //setting variables if the user wants to do refresh
        
        hDlg->setCTF(ctfun);
-       hDlg->setMPR3Dview(_wxvtkmpr3Dview);
+       //hDlg->setMPR3Dview(_wxvtkmpr3Dview);
        
        if(hDlg->ShowModal()== wxID_OK )
        {