]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramDialog.cxx
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / HistogramDialog.cxx
index 681263e93b8fb3b60537cc0df47260909ea558c2..a60429eaad88f0730d6b8eb046f0cb4765048daa 100644 (file)
@@ -80,6 +80,70 @@ HistogramDialog::HistogramDialog(wxWindow *parent,wxString title,vtkImageData* i
        SetBestSize(wxSize(600,600));
 }
 
+HistogramDialog::HistogramDialog(wxWindow *parent,wxString title)
+:wxDialog(parent,-1,title,wxDefaultPosition,wxDefaultSize,wxRESIZE_BORDER|wxDEFAULT_DIALOG_STYLE   ,_T("dialogBox")){
+       _ctfun=NULL;
+       _tfun=NULL;
+
+       SetBackgroundColour(wxColour(255,255,255));
+       /*
+       Pointers
+       */
+       wxvtkmpr3Dview=NULL;
+       wxvtkclipping3Dview=NULL;
+       
+       /*
+        Histogram
+       */
+       
+       histogramW=new HistogramWidget(this, -1);
+       
+       refreshed=false;
+
+       /*
+       Buttons
+       */
+       okBtn = new wxButton(this,wxID_OK ,_T("OK"));
+       cancelBtn = new wxButton(this,wxID_CANCEL,_T("Cancel"));
+       
+       saveDataBtn = new wxButton(this,ID_SAVE,_T("Save"));
+       loadDataBtn = new wxButton(this,ID_LOAD,_T("Load"));
+       refreshBtn = new wxButton(this,ID_REFRESH,_T("Refresh"));
+       
+       Connect(saveDataBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnSaveData       );
+       Connect(loadDataBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnLoadData       );
+       Connect(refreshBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &HistogramDialog::OnRefreshBtn      );
+       
+       //-------------------
+       //GUI
+       //-------------------
+       
+       //Upper Box
+       wxBoxSizer * upper_box = new wxBoxSizer( wxHORIZONTAL );
+       //Including components for plotter control
+       upper_box->Add( histogramW, 4, wxGROW);
+       
+
+       //bottom Sizer
+       wxBoxSizer *bottomBox = new wxBoxSizer( wxHORIZONTAL );
+       bottomBox->Add( okBtn, wxSizerFlags().Center());
+       bottomBox->AddSpacer(40);
+       bottomBox->Add( saveDataBtn,wxSizerFlags().Center() );
+       bottomBox->AddSpacer(40);
+       bottomBox->Add( loadDataBtn,wxSizerFlags().Center() );
+       bottomBox->AddSpacer(40);
+       bottomBox->Add( refreshBtn,wxSizerFlags().Center() );
+       bottomBox->AddSpacer(40);
+       bottomBox->Add( cancelBtn,wxSizerFlags().Center() );
+       //Sizer
+       wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+       sizer->Add(upper_box,1,wxEXPAND);       
+    sizer->Add(bottomBox,0,wxCENTER);
+       SetAutoLayout( TRUE );
+       SetSizer( sizer );
+       SetBestSize(wxSize(600,600));
+}
+
 //-----------------------
 //Handling events
 //-----------------------
@@ -488,3 +552,33 @@ void HistogramDialog::OnRefreshBtn(wxCommandEvent &event)
        }
 
 
+/**
+**     Initialize the histogram 
+*/
+       void HistogramDialog::initializeHistogram(vtkImageData* img){
+               histogramW->initializeHistogram(img);
+       }
+/**
+**     Returns two vectors, the grey level of the point and its value, the value is between [0,1]
+**/
+       void HistogramDialog::GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value){
+
+               histogramW->GetValuesPointsFunction(greylevel, value);
+       }
+
+/**
+**     Returns two vectors, the grey level of the point and its value, the red, green
+**     and blue value is between [0,1]
+**/
+void HistogramDialog::GetValuesColorPointsFunction(std::vector<double>& greylevel,
+                                                               std::vector<double>& red,
+                                                               std::vector<double>& green,
+                                                               std::vector<double>& blue)
+{
+       histogramW->GetValuesColorPointsFunction(greylevel, red, green, blue);
+}
+
+void HistogramDialog::SetFunctions(vtkPiecewiseFunction* _opac, vtkColorTransferFunction* _color){
+       _tfun = _opac;
+       _ctfun = _color;        
+}
\ No newline at end of file