]> Creatis software - creaMaracasVisu.git/commitdiff
#2490 creaMaracasVisu Feature New High - Histogram Interaction
authordavila <eduardo.davila@creatis.insa-lyon.fr>
Thu, 18 Dec 2014 14:50:59 +0000 (15:50 +0100)
committerdavila <eduardo.davila@creatis.insa-lyon.fr>
Thu, 18 Dec 2014 14:50:59 +0000 (15:50 +0100)
bbtk/src/bbmaracasvisuHistogramView.cxx
bbtk/src/bbmaracasvisuHistogramView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/mBarRange2.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pFigure.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx

index c510b41105c9279a9fbe95a1e09310d967ede91b..a3101688aea46ff005d287fcd95816e711111bb7 100644 (file)
@@ -37,10 +37,11 @@ BBTK_BLACK_BOX_IMPLEMENTATION(HistogramView,bbtk::WxBlackBox);
 void HistogramView::Process()
 {
 printf("EED HistogramView::Process Start \n");
-       if (firsttime==true){
+       if (firsttime==true)
+       {
                firsttime=false;
        //      histogram_wxwidget = new Histogram( wxpanel , -1, wxPoint(0,0), wxSize(400,400),wxNO_BORDER );
-               histogram_wxwidget->Configure( bbGetInputIn() );
+               _histogramMinMaxLevel->Configure( bbGetInputIn() );
        }
 printf("EED HistogramView::Process End \n");
 }
@@ -55,10 +56,15 @@ void HistogramView::CreateWidget(wxWindow* parent)
 //     histogram_wxwidget = new Histogram( parent , -1, wxPoint(0,0), wxSize(400,400),wxNO_BORDER ,bbGetInputIn());
        wxPanel *wxpanel =new wxPanel(parent);
        wxpanel->SetSize(400,400);
-       histogram_wxwidget = new Histogram( parent , -1, wxPoint(0,0), wxSize(400,400),wxNO_BORDER );
+
+//Borrame
+//     histogram_wxwidget = new Histogram( parent , -1, wxPoint(0,0), wxSize(400,400),wxNO_BORDER );
        
-    bbtkDebugDecTab("Core",9);
-       bbSetOutputWidget( histogram_wxwidget );
+       Histogram* histogram            = new Histogram(  parent , -1, wxPoint(0,0), wxSize(400,400), /*wxNO_BORDER*/ wxBORDER_DEFAULT ); 
+       _histogramMinMaxLevel   = new HistogramMinMaxLevel( (HistogramBase*)histogram );
+
+   bbtkDebugDecTab("Core",9);
+       bbSetOutputWidget( _histogramMinMaxLevel->GetWindow() );
 //     bbSetOutputWidget( wxpanel );
 }
 
index 5cec9038de58cba9c9b5d65045d72265f5f782a9..bb69be239f89e05046819e4f958a4a3ce11e51da 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "vtkImageData.h"
 #include "Histogram.h"
+#include "HistogramBase.h"
 
 
 namespace bbcreaMaracasVisu
@@ -47,16 +48,16 @@ class /*BBTK_EXPORT*/ HistogramView
   void CreateWidget(wxWindow*);
        
 private:
-       bool            firsttime;
-       Histogram       *histogram_wxwidget;
-       wxPanel         *wxpanel;
+       bool                                                    firsttime;
+       HistogramMinMaxLevel*   _histogramMinMaxLevel;
+       wxPanel*                                                wxpanel;
 };
 
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(HistogramView,bbtk::WxBlackBox);
-BBTK_NAME("HistogramView");
-BBTK_AUTHOR("eduardo.davila [at] creatis.insa-lyon.fr");
-BBTK_DESCRIPTION("Histogram window");
-BBTK_CATEGORY("viewer");
+       BBTK_NAME("HistogramView");
+       BBTK_AUTHOR("eduardo.davila [at] creatis.insa-lyon.fr");
+       BBTK_DESCRIPTION("Histogram window");
+       BBTK_CATEGORY("viewer");
   BBTK_INPUT(HistogramView,In,"Input image",vtkImageData*,"");
 BBTK_END_DESCRIBE_BLACK_BOX(HistogramView);
 }
index e883c986889ceceadf2bac1d74552b5a4df73574..cf3441d4938dab199cd5fb8ada9e3889ccfd4de0 100644 (file)
@@ -35,8 +35,8 @@
  * \brief 
  */
  
-#ifndef __ThresholdImageViewPanel_h__
-#define __ThresholdImageViewPanel_h__
+#ifndef __mBarRange2_h__
+#define __mBarRange2_h__
 
 
 #include <wx/wx.h>
@@ -78,5 +78,5 @@ END_DECLARE_EVENT_TYPES()
                };
        
        
-#endif
+#endif  //__mBarRange2_h__
 
index f2bbf1ffad085d2ef15006b897bb90acee0b2988..a1aef5e9732c7126bf41b58ff2178e9206a0cdbf 100644 (file)
@@ -56,10 +56,10 @@ IMPLEMENT_CLASS(pFigure, wxObject)
        */
        pFigure :: pFigure(int edges_n, int _w, int _h, int _orientation, bool bar_orientation)
        {
-               edges = edges_n;
+               edges           = edges_n;
                orientation = _orientation;
-               width = _w;
-               heigth = _h;
+               width           = _w;
+               heigth          = _h;
                setBarOrientation( bar_orientation );
        }
 
index cbfee52eeac8aedf549fbf9c1f1a37af899b9699..c14e9511348f57ac1bf39256258777ebdfbaf2d9 100644 (file)
@@ -74,14 +74,6 @@ pHistogram::pHistogram(vtkImageData* imageData)
        points          = vtkImageData::New();
        size                    = 100;
        sizeImage       = 0;
-       //cast
-       /*
-       vtkImageCast* cast= vtkImageCast::New();
-       cast->SetInput(imageData);
-       cast->SetOutputScalarTypeToInt();
-       cast->Update();
-       */
-       //build the histogram
        buildHistogram(imageData);
 }
 
@@ -176,8 +168,7 @@ printf("EED pHistogram::setPoints colums:%d\n", (int)(resulttable->GetNumberOfCo
        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);
-
-       double* dataHistogramPointer                            = (double*)points->GetScalarPointer(0,0,0);
+       double*                                 dataHistogramPointer    = (double*)points->GetScalarPointer(0,0,0);
        
        /*
         Range of greys
@@ -202,9 +193,9 @@ printf("EED pHistogram::setPoints colums:%d\n", (int)(resulttable->GetNumberOfCo
        int ext[6];
        imageData->GetExtent(ext);
        int sx,sy,sz;
-       sx=ext[1]-ext[0]+1;
-       sy=ext[3]-ext[2]+1;
-       sz=ext[5]-ext[4]+1;
+       sx = ext[1]-ext[0]+1;
+       sy = ext[3]-ext[2]+1;
+       sz = ext[5]-ext[4]+1;
 
        sizeImage=sx*sy*sz;
 
@@ -217,7 +208,7 @@ printf("EED pHistogram::setPoints colums:%d\n", (int)(resulttable->GetNumberOfCo
                dataHistogramPointer[i]=0;
        }
        
-       int j=0;
+       long int j=0;
 
 
        if (imageData->GetScalarType()==VTK_CHAR)
@@ -301,8 +292,14 @@ image
 */
 int pHistogram::getIndex(double gValue)
 {
-
-       double p=((double)gValue-minLevelOfGrey)/(maxLevelOfGrey-minLevelOfGrey);
+       double p;
+       double diff=maxLevelOfGrey-minLevelOfGrey;
+       if (diff!=0)
+       {
+               p=((double)gValue-minLevelOfGrey)/(maxLevelOfGrey-minLevelOfGrey);
+       } else {
+               p=0;
+       }
        double k=p*(size-1);
        //std::cout<<"gValue "<<gValue<<" k "<<k<<std::endl;
        return (int)k;