]> Creatis software - creaMaracasVisu.git/commitdiff
BUG histogram
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Thu, 7 May 2009 15:35:46 +0000 (15:35 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Thu, 7 May 2009 15:35:46 +0000 (15:35 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx

index 8466cdadf16b1e7d0f6b2c62c19b77e93e1761d1..affe13c876cbe3c28c0a631115771bc2ce2acfc8 100644 (file)
@@ -145,6 +145,7 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
                        yValues[4]=0;
                        
                        pGraphicalFunction * tf = plotter ->getFunctionForVectors( xValues, 5, yValues, 5 ); 
+               printf("EED %p HistogramWidget::drawTransferenceFunction %p\n", this , tf);             
                        // Including and drawing the created function in the plotter
                        if (tf)
                        {
@@ -266,8 +267,12 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
        */
        bool  HistogramWidget::addPointToTransferenceFunction(double x, double y)
        {
+               bool result=false;
                pGraphicalFunction* tf=plotter->getFunction(idTransferenceFunction);
-               return tf->AddPoint(x,y);
+printf("EED %p HistogramWidget::addPointToTransferenceFunction tp%p x%f y%f %d\n",this, tf, x ,y, idTransferenceFunction);
+               if (tf!=NULL) { result=tf->AddPoint(x,y); }
+               
+               return result;
        }
        /*
                add a color point to the histogram
@@ -294,15 +299,16 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
                {
                        // we have to erase the points
                        pGraphicalFunction* tf=plotter->getFunction(idTransferenceFunction);
-                       int numOfPoints=tf->getSizePoints();
-                       int i=numOfPoints-1;//-2;
-                       while(i>=0)
-                       {
-                               tf->deletePointAt(i);
-                               i--;
-                       }
-                       
-               }
+                       if (tf!=NULL){
+                               int numOfPoints=tf->getSizePoints();
+                               int i=numOfPoints-1;//-2;
+                               while(i>=0)
+                               {
+                                       tf->deletePointAt(i);
+                                       i--;
+                               } // while
+                       } // if tf
+               } // if transferenceFunctionHasPoints
                
        //we set for actual the histogram
                //plotter->setActual()
index b04e17c81bacb5a648d8dacb8c735f85b3a7691d..0eed1ed66fa2c6317cfc4e3f626cac72e757a2fe 100644 (file)
@@ -159,15 +159,18 @@ bool pGraphicalFunction:: AddNewPoint(int x,int y)
 */
 bool pGraphicalFunction::AddPoint(int aX, int aY,bool order) 
 {      
-       
-       bool added=logicFunction -> AddPoint( aX, aY,order );
-       if(!fromWindow)
-        setUp();
-       else
-       {
-               logicFunction->setEndPoints();
-               logicFunction->setStartPoints();
-       }
+       printf("EED %p pGraphicalFunction::AddPoint %p (%d %d) \n", this, logicFunction, aX, aY);       
+       bool added=false;
+       if (logicFunction!=NULL){
+               added=logicFunction -> AddPoint( aX, aY,order );
+               if(!fromWindow)
+                       setUp();
+               else
+               {
+                       logicFunction->setEndPoints();
+                       logicFunction->setStartPoints();
+               } // if fromWindow
+       } // if logicFunction
        return added;
 }
 
@@ -822,7 +825,7 @@ void pGraphicalFunction :: setColorPoints(std::vector<pColorPoint *> &colorVecto
 {
        f_colorPoints.clear();
        int i = 0;      
-       while(i<colorVector.size())
+       while(i<(int)(colorVector.size()))
        {
                f_colorPoints.push_back(colorVector[i]);                
                i++;
@@ -836,7 +839,7 @@ void pGraphicalFunction :: setColorPoints(std::vector<pColorPoint *> &colorVecto
 void pGraphicalFunction :: getColorPoints(std::vector<pColorPoint *> &colorVector)
 {
        int i = 0;      
-       while(i<f_colorPoints.size())
+       while(i<(int)(f_colorPoints.size()))
        {
                pColorPoint * originaslPoint = f_colorPoints[i];
                pColorPoint * copyPoint = new pColorPoint(originaslPoint->getRealX(), originaslPoint->getColor(), originaslPoint->isTemporalColor());
index 7635f6070d87806be6fd46c619ca3fd7e47c6385..5bc7148d3787f1fbfb7a3121b5a88df72be23723 100644 (file)
@@ -1387,10 +1387,15 @@ int pPlotterWindow:: addFunction(pGraphicalFunction * function)
                function->initializeSplineVectors();
                UpdateAll();
        }
-       // bool added1= functions.Append(function)!=NULL; // JPRx
+       
+//     bool added1= functions.Append(function)!=NULL; // JPRx
+       functions.Append(function);  //EED      
        
        int id=functions.IndexOf(function);
-       /* bool added2= */ AddLayer(function);// JPRx
+       
+       // bool added2=  AddLayer(function);// JPRx
+       AddLayer(function); //EED
+        
        UpdateAll();
        return id;//added1 && added2;
 }
@@ -1799,7 +1804,9 @@ void pPlotterWindow::moveFunctions( float porcentageMinX,float porcentageMaxX)
 */
 int pPlotterWindow::addFunctionToMove(pGraphicalFunction *function)
 {
-       // bool added1=  functionsToMove.Append(function)!=NULL; // JPRx
+       //bool added1=  functionsToMove.Append(function)!=NULL; // JPRx
+       functionsToMove.Append(function); // EED
+       
        int id=functionsToMove.IndexOf(function);
        UpdateAll();
        return id;
index f3217a2e5b2f801419ea11328f6f542898987425..a46feff5b49d41b2ac441a90eceff740b0c503f2 100644 (file)
@@ -341,7 +341,6 @@ void vtkMPR3DDataViewer::Refresh()
        int x = (int)(_vtkmprbasedata->GetX());
        int y = (int)(_vtkmprbasedata->GetY());
        int z = (int)(_vtkmprbasedata->GetZ());
-       std::cout<<" vtkMPR3DDataViewer::Refresh() x="<<x<<" y= "<<y<<" z= "<<z;
        SetPositionX( x );
        SetPositionY( y );
        SetPositionZ( z );
index f0a704039bb9b2eda1952b44bdbaa4f1d8d3607a..da7729e47a7eda21532fdae7353ea29d48eff3fb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMPRWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/05/04 15:06:42 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2009/05/07 15:35:46 $
+  Version:   $Revision: 1.13 $
 
   Copyright: (c) 2002, 2003
   License:
@@ -2687,6 +2687,13 @@ void wxVtkMPR3DViewCntrlPanel::OnEditColorTable(wxCommandEvent& event)
        std::vector<double> *ctfunVectorGreen   = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorGreen();
        std::vector<double> *ctfunVectorBlue    =   this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorBlue();
 
+       printf("EED %p wxVtkMPR3DViewCntrlPanel::OnEditColorTable ctfun %p\n", this, ctfun);    
+       printf("EED %p wxVtkMPR3DViewCntrlPanel::OnEditColorTable ctfunVectorPoint %p\n", this, ctfunVectorPoint);      
+       printf("EED %p wxVtkMPR3DViewCntrlPanel::OnEditColorTable ctfunVectorRed %p\n", this, ctfunVectorRed);  
+       printf("EED %p wxVtkMPR3DViewCntrlPanel::OnEditColorTable ctfunVectorGreen %p\n", this, ctfunVectorGreen);      
+       printf("EED %p wxVtkMPR3DViewCntrlPanel::OnEditColorTable ctfunVectorBlue %p\n", this, ctfunVectorBlue);        
+
+       
        //void *p=this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer(); // JPRx
 
 
@@ -3383,6 +3390,8 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
        std::vector<double>* bctf               = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetBlueColorsOfColorTransferenceFVector();
        vtkImageData *imagedata = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
 
+       
+       
        //use for update in the refresh
        /*
        vtkVolumeRayCastMapper* volumeMapper = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVolumeMapper();
@@ -3612,10 +3621,12 @@ void wxVtkMPR3DView::ResetCamera(int* ext, double* origin,double* spc){
 }
 void wxVtkMPR3DView::Configure(){
 
-
        _wxvtk3Dbaseview->Configure();
        _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel();
-       _wxvtk3Dbaseview->GetRenderer()->Clear();               
+       
+//EED ??????  07Mai2009        
+//     _wxvtk3Dbaseview->GetRenderer()->Clear();               
+       
        
        // Actors are added to the renderer. 
        vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor();
index 5d3233f3eae7d821ddc385da16ccf79f894f4870..f9822d12b23747942bb6f27925a2fc5724cdbfbc 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_ViewerWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/05/04 07:35:42 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2009/05/07 15:35:46 $
+  Version:   $Revision: 1.11 $
 
   Copyright: (c) 2002, 2003
   License:
 
                        mwxvtkmpr3Dview                                                 = new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D );
 
-
                        vtkmpr3Ddataviewer      = new vtkMPR3DDataViewer();     
 
-                       
-
                        wxWindow        *window3D                                       = mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor();
 
                        wxPanel                 *panelControl                   = new wxPanel(panelClipping3D,-1);