#ifndef __HISTOGRAMSDIALOG__ #define __HISTOGRAMSDIALOG__ // ---------------------------------------------------------------------------- // wx headers inclusion. // For compilers that support precompilation, includes . // ---------------------------------------------------------------------------- #include #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include #endif //--------------------- // Includes //---------------------- #include "HistogramWidget.h" #include "vtkImageData.h" //#include #include #include #include #include #include "../wxMPRWidget.h" class HistogramDialog:public wxDialog { public: /* Constructor */ HistogramDialog(wxWindow *parent,wxString title,vtkImageData* imageData,int type); /* Constructor */ HistogramDialog(wxWindow *parent,wxString title); /* Methods */ /* get number of points of the transference function */ int getSizeTransferenceFunction(); /* get number of points of the barColor */ int getSizeBarColor(); /* get a point of the transference function */ void getTransferenceFunctionPoint(int index,int& x,int& y); /* get a color int the bqr color */ void getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue); /* get a point of the Histogram given the grey value */ int getHistogramPoint(int gValue); //-------------------- // bar Information //--------------------- /* Get the porcentage of the positions of the min,max and actual in the bar range */ float getMaxShowedPorcentage(); float getMinShowedPorcentage(); float getActualShowedPorcentage(); //--------------------------------------- // setting data in transferences function // and in bar color //---------------------------------------- /* Adds a point to the transference function */ bool addPointToTransferenceFunction(double x, double y); /* add a color point to the histogram @param x the level of grey to which the color is assigned @param red the level of red for the color @param green the level of red for the color @param blue the level of red for the color */ bool addColorPoint(double x,int red,int green, int blue); //------------------------ //Erase data //------------------------ /* Erase all the points that are in the transference function */ void erasePointsTransferenceFunction(); void eraseColorPoints(); //------------------- // Getter and setters //------------------- void setTransferenceFunctionHasPoints(bool hasPoints); void setTransferenceFunctionHasColor(bool hasColorPoints); //returns if the user has pressed refresh bool getRefreshed(); void setCTF(vtkColorTransferFunction* cf); void setTF(vtkPiecewiseFunction* tf); void setVolumeMapper(vtkVolumeRayCastMapper* volMapper); void setVolume(vtkVolume* vol); void setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1); void setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1); //-------------------- // plotter Information //--------------------- void updatePlotter(); //----------------------- //Handling events //----------------------- void OnSaveData(wxCommandEvent& event); void OnLoadData(wxCommandEvent& event); void OnRefreshBtn(wxCommandEvent& event); /** ** Initialize the histogram */ void initializeHistogram(vtkImageData* img); /** ** Returns two vectors, the grey level of the point and its value, the value is between [0,1] **/ void GetValuesPointsFunction(std::vector& greylevel,std::vector& value); /** ** Returns two vectors, the grey level of the point and its value, the red, green ** and blue value is between [0,1] **/ void GetValuesColorPointsFunction(std::vector& greylevel, std::vector& red, std::vector& green, std::vector& blue); void SetFunctions(vtkPiecewiseFunction* _opac, vtkColorTransferFunction* _color); private: /* Histogram Widget */ HistogramWidget* histogramW; /* ok Button */ wxButton *okBtn; /* cancel Button */ wxButton *cancelBtn; /* save Button */ wxButton *saveDataBtn; /* Load Button */ wxButton *loadDataBtn; /* Refresh Button */ wxButton *refreshBtn; // the user had pressed refresh bool refreshed; vtkColorTransferFunction *_ctfun; vtkPiecewiseFunction *_tfun; vtkVolumeRayCastMapper *volumeMapper; vtkVolume *newvol; //things to refresh wxVtkMPR3DView *wxvtkmpr3Dview; wxVtkClipping3DView *wxvtkclipping3Dview; // DECLARE_CLASS(HistogramDialog); // any class wishing to process wxWindows events must use this macro //DECLARE_EVENT_TABLE() }; #endif