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
//-----------------------
}
+/**
+** 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