]> Creatis software - creaMaracasVisu.git/commitdiff
#2482 creaMaracasVisu Bug New High - ColorLayer refresh missing. The MPR is not...
authordavila <eduardo.davila@creatis.insa-lyon.fr>
Thu, 20 Nov 2014 13:00:14 +0000 (14:00 +0100)
committerdavila <eduardo.davila@creatis.insa-lyon.fr>
Thu, 20 Nov 2014 13:00:14 +0000 (14:00 +0100)
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/Histogram.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mBarRange.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotter.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h

index 35a1c49d7704490d465748b76659dd20d6e12b74..945c801d2bd86c2673bc5c0d4b85a1abd5f7a355 100644 (file)
@@ -78,15 +78,15 @@ class ColorLayerImageViewPanel
                        void SetActive(bool active);
 
                private:
-                       bool                            _active;
-                       int                             _fitting_mode;
+                       bool                                                                    _active;
+                       int                                                                     _fitting_mode;
 
-                       int                             _dimBase[3];
-                       double                          _spcBase[3];
-                       double                          _spcOrg[3];
+                       int                                                                     _dimBase[3];
+                       double                                                          _spcBase[3];
+                       double                                                          _spcOrg[3];
 
-                       bool                            _thresholdGo;
-                       ColorLayerImageViewManager      *_colorLayerImageViewManager;
+                       bool                                                                    _thresholdGo;
+                       ColorLayerImageViewManager      *_colorLayerImageViewManager;
 //                     ColorLayerImageView             *_colorLayerImageView;  
                        wxButton                        *_btn_ReadImage;
                        wxSlider                        *_opacity;
index 3b89d1a2f93be5deafdb135839076344a136e19d..eb70d3e92999533420fa33637be5cb1f2d839d45 100644 (file)
@@ -33,8 +33,7 @@
 #include "wxMPRBaseData.h"
 #include "wxVtk2DBaseView.h"
 #include "wxVTKRenderWindowInteractor.h"
-
-
+#include "vtkTextProperty.h"
 
 
 //---------------------------------------------------------------------------------------------
@@ -85,103 +84,6 @@ private:
 };
 
 
-//---------------------------------------------------------------------------------------------
-//---------------------------------------------------------------------------------------------
-//---------------------------------------------------------------------------------------------
-
-ColorLayerImageBasevtkInteractor::ColorLayerImageBasevtkInteractor(LayerImageBase* layerImageBase)
-{
-    _state                             =       false;
-    _stateKey                  =       false;
-    _layerImageBase    =       layerImageBase;
-       
-}
-
-//---------------------------------------------------------------------------------------------
-ColorLayerImageBasevtkInteractor::~ColorLayerImageBasevtkInteractor()
-{
-}
-
-//---------------------------------------------------------------------------------------------
-bool ColorLayerImageBasevtkInteractor::OnChar() 
-{
-       return true;
-}
-
-
-//---------------------------------------------------------------------------------------------
-bool ColorLayerImageBasevtkInteractor::OnMouseMove()   // vitual
-{
-       printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove start \n");
-
-       vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
-
-       // For example in ManualPaint Action
-        // This is not working, because the order of insertion events mecanism (_vtkInteractorStyleBaseView)
-        // Layer first Paint after.
-        // the only way to make it works is to take the axes an paint.  this force a first SetParent_refresh_waiting()
-//     if ( this->_vtkInteractorStyleBaseView->GetParent_refresh_waiting() == true )
-
-       if ( interactor->GetControlKey()==1 )  // EED This if for ManaulPaint Interaction compatibility
-       {
-               printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove need Refresh \n" );
-               _layerImageBase->onThreshold();
-               _layerImageBase->GetvtkImageReslice()->Modified();
-       } else {
-               printf("EED ColorLayerImageBasevtkInteractor::OnMouseMove NOT need Refresh \n" );
-       }       
-
-       
-       if (  (_state==true) &&  (_layerImageBase->GetActorPresent())  )
-       {
-               wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*) _vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
-               wxVTKRenderWindowInteractor *wxVTKiren = wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor();
-               int px, py;
-               wxVTKiren->GetEventPosition(px, py);
-
-//        int     typeView = 1;
-               double X = (double) px;
-               double Y = (double) py;
-               double Z = wxvtk2Dbaseview->GetActualSlice();
-//             wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z,true, typeView);
-               wxvtk2Dbaseview->TransFromCoordScreenToWorld(X, Y, Z, true);
-
-//             _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z);
-
-               _layerImageBase->SetX( (int)X );
-               _layerImageBase->SetY( (int)Y );
-               _layerImageBase->SetZ( (int)Z );
-               _layerImageBase->onThreshold();
-//             _layerImageBase->Refresh();
-
-               this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-
-               if  (_vtkInteractorStyleBaseView->GetRefresh_waiting()==true)
-               {
-                               _layerImageBase->GetvtkImageReslice()->Modified();
-               }
-       printf("EED ColorLayerImageBasevtkInteractor::YESSSSSS \n");
-       }
-       return true;
-}
-
-//---------------------------------------------------------------------------------------------
-bool  ColorLayerImageBasevtkInteractor::OnRightButtonDown() // virtual
-{
-       printf("EED ColorLayerImageBasevtkInteractor::OnRightButtonDown \n");
-       _state=true;
-   return true;
-}
-
-
-//---------------------------------------------------------------------------------------------
-bool  ColorLayerImageBasevtkInteractor::OnRightButtonUp()  // virtual
-{
-       printf("EED ColorLayerImageBasevtkInteractor::OnRightButtonUp \n");
-       _state=false;
-       return true;
-}
-
 
 //---------------------------------------------------------------------------------------------
 //---------------------------------------------------------------------------------------------
@@ -445,9 +347,11 @@ void LayerImageBase::onThreshold()
                
 //             _scalarbarActor->SetLookupTable( _thresholdTable );
                _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() );
-
                _scalarbarActor->SetTitle("Value");
-               _scalarbarActor->SetNumberOfLabels(5);
+               _scalarbarActor->SetNumberOfLabels(4);
+               int fontsize = _scalarbarActor->GetLabelTextProperty()->GetFontSize();
+               _scalarbarActor->GetLabelTextProperty()->SetFontSize(fontsize/2);
+
 //             _scalarbarActor->SetTextPad(4);  ??
 
                } // _image
index e9e92aadb22910a09ff647fc4237c66128c71489..fec399ca43a180788f551dee20215bc3f69a024f 100644 (file)
@@ -63,8 +63,8 @@ public:
        virtual bool OnRightButtonUp();
 
 private:
-    bool               _state;
-    bool               _stateKey;
+    bool                                       _state;
+    bool                               _stateKey;
     LayerImageBase*    _layerImageBase;
 
 protected:
index d9134e4fca6b9df7db1f0aaff8db3cead9758af1..8526658a8478c34a4e991edcecb798e204b59d73 100644 (file)
@@ -119,13 +119,19 @@ END_EVENT_TABLE()
                xValues=(double*)malloc(NUM_POINTS*sizeof(double));
                yValues=(double*)malloc(NUM_POINTS*sizeof(double));
                
-               unsigned short* histogramPointer=(unsigned short*)histogramImageData->GetScalarPointer(0,0,0);
+               double* histogramPointer=(double*)histogramImageData->GetScalarPointer(0,0,0);
                
-               for(int i=0; i< histogramSize; i++)
+               int i;
+               for(i=0; i< histogramSize; i++)
                {
                        xValues[i]=i;
-                       yValues[i]=log( (double) histogramPointer[i])*10;
-               }
+                       if (histogramPointer[i]==0)
+                       {
+                               yValues[i]=0;
+                       } else {
+                               yValues[i]=log(histogramPointer[i])*10;
+                       } // if histogramPointer
+               } // for i
 
                
                pGraphicalFunction* histogramFunction=plotter->getFunctionForVectors(xValues,histogramSize,yValues,histogramSize);
index 038f464bf1c732ecde16411ff98137f96d6cd440..5ac1e398857d340b6fcbdf0fe47cb760a1c4d54b 100644 (file)
@@ -206,40 +206,40 @@ private:
        /*
         ok Button
        */
-       //wxButton              *okBtn;
+       //wxButton                      *okBtn;
        wxBitmapButton          *okBtn;
        /*
         cancel Button
        */
-       //wxButton              *cancelBtn;
+       //wxButton                      *cancelBtn;
        wxBitmapButton          *cancelBtn;
        /*
         save Button
        */
-       wxButton                *saveDataBtn;   
+       wxButton                                *saveDataBtn;   
        /*
        Load Button
        */
-       wxButton                *loadDataBtn;
+       wxButton                                *loadDataBtn;
        /*
        Refresh Button
        */
-       wxButton                *refreshBtn;
+       wxButton                                *refreshBtn;
 
-       wxPanel_panextracontrols;
+       wxPanel                         *_panextracontrols;
        
        
        // the user had pressed refresh
        bool refreshed;
        
-       vtkColorTransferFunction                        *_ctfun;
+       vtkColorTransferFunction                *_ctfun;
        vtkPiecewiseFunction                            *_tfun;
-       vtkVolumeRayCastMapper                          *volumeMapper; 
+       vtkVolumeRayCastMapper                  *volumeMapper; 
        vtkVolume                                                       *newvol;
 
        //things to refresh
-       //wxVtkMPR3DView                                                *wxvtkmpr3Dview;
-       //wxVtkClipping3DView                                   *wxvtkclipping3Dview;
+       //wxVtkMPR3DView                                        *wxvtkmpr3Dview;
+       //wxVtkClipping3DView                   *wxvtkclipping3Dview;
 
        
        wxSizer* getControls(bool extracontrols = false);
index 999ff6f699c32cbd4f39a46d18ae556ad5aa82ad..9d80407174362c6653c4377464ef52e776354922 100644 (file)
@@ -128,7 +128,8 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
        
        
        void HistogramWidget::initializeHistogram(vtkImageData* img){
-               if(histogram ==NULL){
+               if(histogram ==NULL)
+               {
                        histogram= new pHistogram(img);
                }               
                //draw
@@ -160,13 +161,18 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
                xValues=(double*)malloc(NUM_POINTS*sizeof(double));
                yValues=(double*)malloc(NUM_POINTS*sizeof(double));
                
-               unsigned short* histogramPointer=(unsigned short*)histogramImageData->GetScalarPointer(0,0,0);
-               
-               for(int i=0; i< histogramSize; i++)
+               double* histogramPointer=(double*)histogramImageData->GetScalarPointer(0,0,0);
+               int i;
+               for(i=0; i< histogramSize; i++)
                {
                        xValues[i]=i;
-                       yValues[i]=log( (double) histogramPointer[i]);
-               }
+                       if (histogramPointer[i]==0)
+                       {
+                               yValues[i]=0;
+                       } else {
+                               yValues[i]=log(histogramPointer[i])*10;
+                       } // histogramPointer 
+               } // for i
 
                
                pGraphicalFunction* histogramFunction=plotter->getFunctionForVectors(xValues,histogramSize,yValues,histogramSize);
@@ -196,7 +202,6 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
        */
        void HistogramWidget::drawTransferenceFunction()
        {
-       
                        double xValues[5],yValues[5];
                        //xValues
                        int maxValueGrey=histogram->getMaximumLevelOfGrey();
@@ -214,7 +219,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);             
+                       printf("EED %p HistogramWidget::drawTransferenceFunction %p\n", this , tf);             
                        // Including and drawing the created function in the plotter
                        if (tf)
                        {
@@ -225,11 +230,13 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
                                tf->SetShowPoints(true);
                                idTransferenceFunction=plotter->addFunction( tf );
                                if(type==1)
+                               {
                                        plotter->addFunctionToMove(tf);
+                               }
                                wxPen mypen(*wxBLACK,0.5, wxSOLID  );
                                mypen.SetWidth(2);
                                tf->SetPen( mypen );
-                       }
+                       } // if tf
        }
 
        /*
@@ -241,7 +248,8 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
                GetClientSize(&scrX,&scrY);
                plotter->SetSize(scrX,scrY);
                pGraphicalFunction* actual=plotter->getFunction(idTransferenceFunction);
-               if(actual!=NULL){
+               if(actual!=NULL)
+               {
                        actual->setScreens(scrX,scrY);
                        actual->setScales();
                }
@@ -262,12 +270,12 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
        void HistogramWidget::getTransferenceFunctionPoint(int index,int& x,int& y)
        {
                pGraphicalFunction* tf=plotter->getFunction(idTransferenceFunction);
-               if(tf)
+               if(tf!=NULL)
                {
-                       wxNode* pnode=tf->GetPointAt(index);
-                       pFunctionPoint* point=(pFunctionPoint*)pnode->GetData();
-                       x=point->getRealX();
-                       y=point->getRealY();
+                       wxNode* pnode                           = tf->GetPointAt(index);
+                       pFunctionPoint* point   = (pFunctionPoint*)pnode->GetData();
+                       x                                                               = point->getRealX();
+                       y                                                               = point->getRealY();
                }
        }
        /*
@@ -288,21 +296,21 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
        /*
                get a  color int the bqr color
        */
-       void HistogramWidget:: getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue)
+       void HistogramWidget::getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue)
        {
-               double tmp=x;
+               double tmp      = x;
                plotter->getBarColorDataAt(index,tmp,red,green,blue);
-               x=(int)tmp;
+               x                               = (int)tmp;
        }
        /*
         Returns the  maximum value ot the histogram that is show to the user 
        */
        float HistogramWidget::getMaxShowedPorcentage()
        {
-               float  porcentageMaxX=plotter->getMaxShowedPorcentage();
-               pGraphicalFunction* histogramFunction=plotter->getFunction(idHistogram);
-               int min=histogramFunction->getMinX();
-               float x=porcentageMaxX*(histogramFunction->getMaxX()-min);
+               float  porcentageMaxX                                           = plotter->getMaxShowedPorcentage();
+               pGraphicalFunction* histogramFunction   = plotter->getFunction(idHistogram);
+               int min                                                                                 = histogramFunction->getMinX();
+               float x                                                                                 = porcentageMaxX*(histogramFunction->getMaxX()-min);
                return min+ x;
        }
        /*
@@ -310,10 +318,10 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
        */
        float HistogramWidget::getMinShowedPorcentage()
        {
-               float  porcentageMinX=plotter->getMinShowedPorcentage();
-               pGraphicalFunction* histogramFunction=plotter->getFunction(idHistogram);
-               int min=histogramFunction->getMinX();
-               float x=porcentageMinX*(histogramFunction->getMaxX()-min);
+               float  porcentageMinX                                           = plotter->getMinShowedPorcentage();
+               pGraphicalFunction* histogramFunction   = plotter->getFunction(idHistogram);
+               int min                                                                                 = histogramFunction->getMinX();
+               float x                                                                                 = porcentageMinX*(histogramFunction->getMaxX()-min);
                return min+ x;
        }
        /*
@@ -321,11 +329,11 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
        */
        float HistogramWidget::getActualShowedPorcentage()
        {
-               float  porcentageActualX=plotter->getMinShowedPorcentage();
-               pGraphicalFunction* histogramFunction=plotter->getFunction(idHistogram);
-               int min=histogramFunction->getMinX();
-               float x=porcentageActualX*(histogramFunction->getMaxX()-min);
-               return min+ x;
+               float  porcentageActualX                                        = plotter->getMinShowedPorcentage();
+               pGraphicalFunction* histogramFunction   = plotter->getFunction(idHistogram);
+               int min                                                                                 = histogramFunction->getMinX();
+               float x                                                                                 = porcentageActualX*(histogramFunction->getMaxX()-min);
+               return min + x;
        }
        //---------------------------------------
        // setting data in transferences function
@@ -339,7 +347,10 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
                bool result=false;
                pGraphicalFunction* tf=plotter->getFunction(idTransferenceFunction);
 //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); }
+               if (tf!=NULL) 
+               { 
+                       result=tf->AddPoint(x,y); 
+               } // if tf
                
                return result;
        }
@@ -403,26 +414,29 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
 
        void HistogramWidget::setTransferenceFunctionHasPoints(bool hasPoints)
        {
-               transferenceFunctionHasPoints=hasPoints;
+               transferenceFunctionHasPoints = hasPoints;
        }
 
        void HistogramWidget::setTransferenceFunctionHasColor(bool hasColorPoints)
        {
-               transferenceFunctionHasPoints=hasColorPoints;
+               transferenceFunctionHasPoints = hasColorPoints;
        }
+
        int HistogramWidget::getHistogramSize()
        {
                return histogramSize;
        }
+
        void HistogramWidget::setType(int type)
        {
-               this->type=type;
+               this->type = type;
        }
 
 /**
 **     Returns two vectors, the grey level of the point and its value, the value is between [0,1]
 **/
-       void HistogramWidget::GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value){
+       void HistogramWidget::GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value)
+       {
                plotter->GetValuesPointsFunction(greylevel,value,histogramSize);
        }
 
index ffdbcdef096d4cbbfc80f1f226ba665e3a62d3a5..b92232faecc1a806ae48ab8e4fba8551abbfc1f9 100644 (file)
@@ -279,14 +279,15 @@ void mBarRange::SetHeight(int h)
 int mBarRange::filtreValue(int value)
 {
        if(value<_min)
+       {
                value = _min;
-       else if (value>_max)
+       } else if (value>_max) {
                value = _max;
-       
+       }
        return value;
 }
 
-
+//----------------------------------------------------------------------------
 int mBarRange::GetStart()
 {
        return _start;
@@ -297,11 +298,17 @@ int mBarRange::GetStart()
 void mBarRange::SetStart(int newstart)
 {
        _start = filtreValue(newstart);
-       if (_start>_end) { _start=_end; }
+
+       if (_start>_end) 
+       { 
+               _start=_end; 
+       }
+
        if (_in_rangeProperty==true)
        {
                if (_start>_actual)   { _start=_actual; }
        }
+
        RefreshForce(); 
 }
 //----------------------------------------------------------------------------
@@ -321,7 +328,10 @@ void mBarRange::SetEnd(int newend)
        if (_end<_start) { _end=_start; }
        if (_in_rangeProperty==true)
        {
-               if (_end<_actual)   { _end=_actual; }
+               if (_end<_actual)   
+               {
+                _end=_actual; 
+               } // _end
        }
        RefreshForce(); 
 }
@@ -351,6 +361,7 @@ int mBarRange::GetTrianglesHalfWidth()
 {
        return trianglesHalfWidth;
 }
+
 //----------------------------------------------------------------------------
 void mBarRange::SetTrianglesHalfWidth(int nwTriHalfWidth)
 {
@@ -363,9 +374,7 @@ void mBarRange::OnSize( wxSizeEvent &WXUNUSED(event) )
        if(_orientation)
        {               
                SetWidth( rectTotal.GetWidth() - deviceEndMargin );                     
-       } 
-       else 
-       {
+       }       else    {
                SetWidth( rectTotal.GetHeight() - deviceEndMargin);                             
        }
        _selectionMoveId = -1;
@@ -385,7 +394,8 @@ void mBarRange::Refresh(bool eraseBackground, const wxRect* rect)
 //----------------------------------------------------------------------------
 void mBarRange::OnPaint( wxPaintEvent &WXUNUSED(event) )
 {
-       if (_bitmap_bar!=NULL){
+       if (_bitmap_bar!=NULL)
+       {
                //repaint rectangle
                if(_orientation)
                {
@@ -417,9 +427,8 @@ void mBarRange::OnPaint( wxPaintEvent &WXUNUSED(event) )
 //                             dc.Blit(0,_w, _h+deviceStart_y+200, _w+deviceStart_x+200-deviceEndMargin, &temp_dc, deviceStart_y,_w+deviceStart_x);
 //                     }
 
-
                } 
-       } 
+       } // _bitmap_bar
 }
 
 
index 1c5aa115d4a39cb0af5cc3a43f35e56df6003635..cbfee52eeac8aedf549fbf9c1f1a37af899b9699 100644 (file)
 //----------------------------------------------------------------------------
 pHistogram::pHistogram(std::string filePath)
 {
-       path=filePath;
-       points= vtkImageData::New();
-       size=100;
-       sizeImage=0;
+       path                    = filePath;
+       points          = vtkImageData::New();
+       size                    = 100;
+       sizeImage       = 0;
        buildHistogram();
 }
 
 pHistogram::pHistogram(vtkImageData* imageData)
 {
-       points= vtkImageData::New();
-       size=100;
-       sizeImage=0;
+       points          = vtkImageData::New();
+       size                    = 100;
+       sizeImage       = 0;
        //cast
        /*
        vtkImageCast* cast= vtkImageCast::New();
@@ -85,19 +85,19 @@ pHistogram::pHistogram(vtkImageData* imageData)
        buildHistogram(imageData);
 }
 
+//----------------------------------------------------------------------------
 pHistogram::~pHistogram()
 {
        if(points!=NULL)points->Delete();
 }
-//----------------------------------------------------------------------------
-// Methods
-//----------------------------------------------------------------------------
 
+//----------------------------------------------------------------------------
 void pHistogram::setImagePath(std::string filePath)
 {
        path=filePath;
 }
 
+//----------------------------------------------------------------------------
 void pHistogram::buildHistogram()
 {
        /*
@@ -121,7 +121,6 @@ void pHistogram::buildHistogram()
        imageData->GetScalarRange(range);
        initializePoints(size);
        setPoints(imageData);
-       
 }
 
 /*
@@ -144,7 +143,7 @@ void pHistogram::initializePoints(int xDimension)
        //setting image data of the points
        points->SetDimensions(xDimension,1,1);
 //EED  points->SetScalarTypeToUnsignedShort();
-       points->SetScalarTypeToShort();
+       points->SetScalarTypeToDouble();
        points->AllocateScalars();
        points->Update();
 }
@@ -170,31 +169,32 @@ printf("EED pHistogram::setPoints colums:%d\n", (int)(resulttable->GetNumberOfCo
        /*
                Pointers
        */
-       unsigned short* dataImagePointerUS      = NULL;
-       short* dataImagePointerS                = NULL;
-       double* dataImagePointerD               = NULL;
 
-       short* dataHistogramPointer             = NULL;
+       char*                           dataImagePointerC               = (char*)imageData->GetScalarPointer(0,0,0);
+       unsigned char*  dataImagePointerUC      = (unsigned char*)imageData->GetScalarPointer(0,0,0);
+       short*                          dataImagePointerS               = (short*)imageData->GetScalarPointer(0,0,0);
+       unsigned short*         dataImagePointerUS      = (unsigned short*)imageData->GetScalarPointer(0,0,0);
+       float*                          dataImagePointerF               = (float*)imageData->GetScalarPointer(0,0,0);
+       double*                                 dataImagePointerD               = (double*)imageData->GetScalarPointer(0,0,0);
 
-       dataImagePointerUS      = (unsigned short*)imageData->GetScalarPointer(0,0,0);
-       dataImagePointerS       = (short*)imageData->GetScalarPointer(0,0,0);
-       dataImagePointerD       = (double*)imageData->GetScalarPointer(0,0,0);
-
-       dataHistogramPointer    = (short*)points->GetScalarPointer(0,0,0);
+       double* dataHistogramPointer                            = (double*)points->GetScalarPointer(0,0,0);
        
        /*
         Range of greys
        */
        double range[2];
        if(imageData==NULL)
-               range[1]=1;
-       else
+       {
+               range[1] = 1;
+       } else {
                imageData->GetScalarRange(range);
+       } // imageData
+
        /*
         Setting the  minimun and maximum levels of grey
        */
-       maxLevelOfGrey=range[1];
-       minLevelOfGrey=range[0];
+       maxLevelOfGrey = range[1];
+       minLevelOfGrey = range[0];
        //std::cout<<"maxLevelOfGrey "<<maxLevelOfGrey<<" minLevelOfGrey "<<minLevelOfGrey<<std::endl;
        /*
         Image Size
@@ -202,9 +202,9 @@ printf("EED pHistogram::setPoints colums:%d\n", (int)(resulttable->GetNumberOfCo
        int ext[6];
        imageData->GetExtent(ext);
        int sx,sy,sz;
-       sx=ext[1]+1;
-       sy=ext[3]+1;
-       sz=ext[5]+1;
+       sx=ext[1]-ext[0]+1;
+       sy=ext[3]-ext[2]+1;
+       sz=ext[5]-ext[4]+1;
 
        sizeImage=sx*sy*sz;
 
@@ -217,49 +217,75 @@ printf("EED pHistogram::setPoints colums:%d\n", (int)(resulttable->GetNumberOfCo
                dataHistogramPointer[i]=0;
        }
        
-       /*
-       Constructing the Histogram
-       */
-       //int k=size/(maxLevelOfGrey-minLevelOfGrey);
        int j=0;
-       for(i=0;i<sizeImage;i++)
+
+
+       if (imageData->GetScalarType()==VTK_CHAR)
        {
-               /*
-                hashing the histogram
-               */
-               //double p=((float)*dataImagePointer-minLevelOfGrey);
-               //j=p*k;
-               if (imageData->GetScalarType()==VTK_UNSIGNED_SHORT)
-               { 
-                       j=getIndex(*dataImagePointerUS);
-                       dataImagePointerUS++;
-               }
-               if (imageData->GetScalarType()==VTK_SHORT) 
+               for(i=0;i<sizeImage;i++)
+               {
+                       j=getIndex(*dataImagePointerC);
+                       dataImagePointerC++;
+                       dataHistogramPointer[j]++;
+               }  // for i
+       } //  CHAR
+
+       if (imageData->GetScalarType()==VTK_UNSIGNED_CHAR)
+       {
+               for(i=0;i<sizeImage;i++)
+               {
+                       j=getIndex(*dataImagePointerUC);
+                       dataImagePointerUC++;
+                       dataHistogramPointer[j]++;
+               }  // for i
+       } // UNSIGNED CHAR
+
+
+       if (imageData->GetScalarType()==VTK_SHORT)
+       {
+               for(i=0;i<sizeImage;i++)
                {
                        j=getIndex(*dataImagePointerS);
                        dataImagePointerS++;
-               }
-               if (imageData->GetScalarType()==VTK_DOUBLE) 
+                       dataHistogramPointer[j]++;
+               }  // for i
+       } // SHORT
+
+       if (imageData->GetScalarType()==VTK_UNSIGNED_SHORT)
+       {
+               for(i=0;i<sizeImage;i++)
+               {
+                       j=getIndex(*dataImagePointerUS);
+                       dataImagePointerUS++;
+                       dataHistogramPointer[j]++;
+               }  // for i
+       } // UNSIGNED SHORT
+
+
+       if (imageData->GetScalarType()==VTK_FLOAT)
+       {
+               for(i=0;i<sizeImage;i++)
+               {
+                       j=getIndex(*dataImagePointerF);
+                       dataImagePointerF++;
+                       dataHistogramPointer[j]++;
+               }  // for i
+       } // FLOAT
+
+
+       if (imageData->GetScalarType()==VTK_DOUBLE)
+       {
+               for(i=0;i<sizeImage;i++)
                {
                        j=getIndex(*dataImagePointerD);
                        dataImagePointerD++;
-               }
-//EED          j=getIndex(*dataImagePointer);
+                       dataHistogramPointer[j]++;
+               }  // for i
+       } // DOUBLE
 
-               //std::cout<<j<<std::endl;
-               dataHistogramPointer[j]++;
-       }
-       /*
-       BORRAME
-       */
-       /*
-       k=0;
-       for(i=0;i<size;i++)
-       {
-               k=dataHistogramPointer[i];
-       }
-       */
 }
+
+
 /*
 Returns the poins of the histograms
 */
@@ -325,9 +351,7 @@ int pHistogram::getHistogramPoint(int gValue)
        //double p=((float)gValue-minLevelOfGrey)/(maxLevelOfGrey-minLevelOfGrey); // JPRx
        //double k=p*size;
 
-       unsigned short* dataHistogramPointer=NULL;
-       dataHistogramPointer=(unsigned short*)points->GetScalarPointer(0,0,0);
-
+       double* dataHistogramPointer = dataHistogramPointer=(double*)points->GetScalarPointer(0,0,0);
        return dataHistogramPointer[gValue];
 }
 
index 22b7dcd3afa20e3d528a8d907e5667c72f585554..bddea2312257675dda70286dd5bfa5fd0ab74590 100644 (file)
@@ -439,18 +439,17 @@ void  pPlotter::onBarrange(wxCommandEvent& event)
 */
 void  pPlotter::onActualChange_Bar(wxCommandEvent& event)
 {
-       text.Clear();
-       text = _T( "Last event was on min-max bar: Actual triangle moved to: " );
        int lastActual_X = barrange->GetActual();
-
-       text << lastActual_X;
        
        color_bar ->setRealX_vertical_line (lastActual_X);
-       m_plot->setRealGuideX (lastActual_X);
-
        color_bar -> RefreshForce();    
+
+       m_plot->setRealGuideX (lastActual_X);
        m_plot->UpdateAll();
 
+       text.Clear();
+       text = _T( "Last event was on min-max bar: Actual triangle moved to: " );
+       text << lastActual_X;
        sendTMessage(text);
 }
 
index b07e111fde985f905fd287f3ded77e7f9da2f90d..5115e2d33b47c2dbf48f7e470f94913558877108 100644 (file)
@@ -75,26 +75,26 @@ IMPLEMENT_CLASS(pPlotterWindow, mpWindow)
 //----------------------------------------------------------------------------
 
 BEGIN_EVENT_TABLE(pPlotterWindow,mpWindow)
-EVT_MOTION (pPlotterWindow::onMouseMove)
-EVT_LEFT_DCLICK(pPlotterWindow::onChangeActual)
-EVT_LEFT_DOWN(pPlotterWindow::onAddPoint)
-EVT_MENU(pwID_DELPOINT, pPlotterWindow::onDeletePoint)
-EVT_MENU(pwID_SHOWPOINTS, pPlotterWindow::onShowPoints)
-EVT_MENU(pwID_STARTDRAWING, pPlotterWindow::onStartDrawing)
-//EVT_MENU(pwID_DELFUNCTION,pPlotterWindow::onDeleteFunction)
-EVT_MENU(pwID_STOPDRAWING, pPlotterWindow::onStopDrawing)
-EVT_MENU(pwID_ADDNEWPOINT, pPlotterWindow::onAddNewPoint)
-EVT_MENU(pwID_NOSHOWPOINTS, pPlotterWindow::onNoShowPoints)
-EVT_MENU(pwID_MYZOOMOUT,pPlotterWindow::onMyZoomOut)
-EVT_MENU(pwID_MYZOOMIN,pPlotterWindow::onMyZoomIn)
-EVT_MENU(pwID_SPLINE,pPlotterWindow::onSplinePoints)
-EVT_MENU(pwID_LINE,pPlotterWindow::onLine)
-EVT_MENU(pwID_SAVE,pPlotterWindow::onSave)
-EVT_MENU(pwID_LOAD,pPlotterWindow::onLoad)
-EVT_MENU(pwID_CHANGECOLOR,pPlotterWindow::onChangeColor)
-EVT_MENU( mpID_LINE_GUIDES, pPlotterWindow::OnGuideLines)
-EVT_MENU( pwID_TRASLATEACTUALFUNCTION, pPlotterWindow::onMoveFunction)
-EVT_LEFT_UP(pPlotterWindow::onLeftUp)
+ EVT_MOTION (pPlotterWindow::onMouseMove)
+ EVT_LEFT_DCLICK(pPlotterWindow::onChangeActual)
+ EVT_LEFT_DOWN(pPlotterWindow::onAddPoint)
+ EVT_MENU(pwID_DELPOINT, pPlotterWindow::onDeletePoint)
+ EVT_MENU(pwID_SHOWPOINTS, pPlotterWindow::onShowPoints)
+ EVT_MENU(pwID_STARTDRAWING, pPlotterWindow::onStartDrawing)
+ //EVT_MENU(pwID_DELFUNCTION,pPlotterWindow::onDeleteFunction)
+ EVT_MENU(pwID_STOPDRAWING, pPlotterWindow::onStopDrawing)
+ EVT_MENU(pwID_ADDNEWPOINT, pPlotterWindow::onAddNewPoint)
+ EVT_MENU(pwID_NOSHOWPOINTS, pPlotterWindow::onNoShowPoints)
+ EVT_MENU(pwID_MYZOOMOUT,pPlotterWindow::onMyZoomOut)
+ EVT_MENU(pwID_MYZOOMIN,pPlotterWindow::onMyZoomIn)
+ EVT_MENU(pwID_SPLINE,pPlotterWindow::onSplinePoints)
+ EVT_MENU(pwID_LINE,pPlotterWindow::onLine)
+ EVT_MENU(pwID_SAVE,pPlotterWindow::onSave)
+ EVT_MENU(pwID_LOAD,pPlotterWindow::onLoad)
+ EVT_MENU(pwID_CHANGECOLOR,pPlotterWindow::onChangeColor)
+ EVT_MENU( mpID_LINE_GUIDES, pPlotterWindow::OnGuideLines)
+ EVT_MENU( pwID_TRASLATEACTUALFUNCTION, pPlotterWindow::onMoveFunction)
+ EVT_LEFT_UP(pPlotterWindow::onLeftUp)
 END_EVENT_TABLE()
 
 //----------------------------------------------------------------------------
index 38d0decf4a8c592f8686437c8d5b8071cec14c69..64c29bf7fd649d9398f012088f9270ae7abc41a3 100644 (file)
@@ -394,7 +394,7 @@ private:
                Use to Show Information
        */
 
-       wxTextCtrl      *m_log;
+       wxTextCtrl  *m_log;
        wxString                text;
 
        /*