X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FpPlotter%2FHistogramWidget.cxx;h=d3dbfc46b1898b5599aa4500d64b48504cd3cb73;hb=65c158dc171f8d3114ee3544b2a94a1f41880df0;hp=d5dd0d772b6a63f7b31143de3cbbc4291242840c;hpb=1a8a3ec53282897cf506adeee7b49e5e2c0fe9f5;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx index d5dd0d7..d3dbfc4 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx @@ -8,6 +8,7 @@ #include "HistogramWidget.h" #include "vtkImageCast.h" #include + // ---------------------------------------------------------------------------- // WX headers inclusion. // For compilers that support precompilation, includes . @@ -15,8 +16,9 @@ #ifndef WX_PRECOMP #include - #endif + #endif +#include //---------------------------------------------------------------------------- // Class implementation //---------------------------------------------------------------------------- @@ -41,15 +43,16 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint } */ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag,vtkImageData* imageData,int type): - wxPanel(parent,id,pos,size) + wxPanel(parent,id,wxDefaultPosition,wxDefaultSize) { SetBackgroundColour(wxColour(255,255,255)); //histogram histogram= new pHistogram(imageData); + //plotter plotter=new pPlotter(this, 400,350); - + //is a plotter of histograms plotter->setType(2); //setting the popMenu @@ -59,8 +62,11 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint idHistogram=-1; transferenceFunctionHasColor=true; transferenceFunctionHasPoints=true; - this->type=type;; + this->type=type; + this->SetAutoLayout(true); + this->Refresh(); + //drawing drawHistogram(); drawTransferenceFunction(); @@ -74,9 +80,10 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint SetBackgroundColour(wxColour(255,255,255)); histogram = NULL; + //plotter plotter=new pPlotter(this, 400,350); - + //is a plotter of histograms plotter->setType(2); //setting the popMenu @@ -87,10 +94,14 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint transferenceFunctionHasColor=true; transferenceFunctionHasPoints=true; this->type=type;; + this->SetAutoLayout(true); + this->Refresh(); } + + void HistogramWidget::initializeHistogram(vtkImageData* img){ if(histogram ==NULL){ histogram= new pHistogram(img); @@ -302,7 +313,7 @@ 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); +//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; @@ -383,4 +394,21 @@ printf("EED %p HistogramWidget::addPointToTransferenceFunction tp%p x%f y%f %d\n 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& greylevel,std::vector& value){ + plotter->GetValuesPointsFunction(greylevel,value,histogramSize); + } +/** +** Returns two vectors, the grey level of the point and its value, the red, green +** and blue value is between [0,1] +**/ + void HistogramWidget::GetValuesColorPointsFunction(std::vector& greylevel, + std::vector& red, + std::vector& green, + std::vector& blue) + { + plotter->GetValuesColorPointsFunction(greylevel,red,green,blue); + }