HistogramDialog.h

Go to the documentation of this file.
00001 
00002 #ifndef __HISTOGRAMSDIALOG__
00003 #define __HISTOGRAMSDIALOG__
00004 
00005 
00006 // ----------------------------------------------------------------------------
00007 // wx headers inclusion.
00008 // For compilers that support precompilation, includes <wx/wx.h>.
00009 // ----------------------------------------------------------------------------
00010 #include <wx/wxprec.h>
00011 #ifdef __BORLANDC__
00012 #pragma hdrstop
00013 #endif
00014 #ifndef WX_PRECOMP
00015 #include <wx/wx.h>
00016 #endif
00017 
00018  //---------------------
00019  // Includes
00020  //----------------------
00021  #include "HistogramWidget.h"
00022  #include "vtkImageData.h"      
00023  //#include <vector>
00024  #include <vtkPiecewiseFunction.h>
00025  #include <vtkColorTransferFunction.h>
00026  #include <vtkVolumeRayCastMapper.h>
00027  #include <vtkVolume.h>
00028  #include "../wxMPRWidget.h"
00029 
00030 class HistogramDialog:public wxDialog
00031 {
00032 public:
00033         /*
00034          Constructor
00035         */
00036         HistogramDialog(wxWindow *parent,wxString title,vtkImageData* imageData,int type);
00037         /*
00038          Constructor
00039         */
00040         HistogramDialog(wxWindow *parent,wxString title);
00041         /*
00042          Methods
00043         */
00044         /*
00045                 get number of points of the transference function
00046         */
00047         int getSizeTransferenceFunction();
00048         /*
00049                 get number of points of the barColor
00050         */
00051         int getSizeBarColor();
00052         /*
00053                 get a point of the transference function
00054         */
00055         void getTransferenceFunctionPoint(int index,int& x,int& y);
00056         /*
00057                 get a  color int the bqr color
00058         */
00059         void getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue);
00060         /*
00061                 get a point of the Histogram
00062                 given the grey value
00063         */
00064         int getHistogramPoint(int gValue);
00065 
00066         //--------------------
00067         // bar Information
00068         //---------------------
00069         /*
00070          Get the porcentage of the positions of 
00071          the min,max and actual in the bar range
00072         */
00073         float getMaxShowedPorcentage();
00074         float getMinShowedPorcentage(); 
00075         float getActualShowedPorcentage();
00076 
00077         //---------------------------------------
00078         // setting data in transferences function
00079         // and in bar color
00080         //----------------------------------------
00081         /*
00082           Adds a point to the transference function
00083         */
00084         bool addPointToTransferenceFunction(double x, double y);
00085         /*
00086                 add a color point to the histogram
00087                 @param x the level of grey to which the color is assigned
00088                 @param red the level of red for the color
00089                 @param green the level of red for the color
00090                 @param blue the level of red for the color
00091         */
00092         bool addColorPoint(double x,int red,int green, int blue);
00093         //------------------------
00094         //Erase data
00095         //------------------------
00096         
00097         /*
00098          Erase all the points that are in the transference function
00099         */
00100         void erasePointsTransferenceFunction();
00101         void eraseColorPoints();
00102         //-------------------
00103         // Getter and setters
00104         //-------------------
00105 
00106         void setTransferenceFunctionHasPoints(bool hasPoints);
00107         void setTransferenceFunctionHasColor(bool hasColorPoints);
00108         
00109         //returns if the user has pressed refresh       
00110         
00111         bool getRefreshed();
00112         void setCTF(vtkColorTransferFunction* cf);
00113         void setTF(vtkPiecewiseFunction* tf);
00114         void setVolumeMapper(vtkVolumeRayCastMapper* volMapper);
00115         void setVolume(vtkVolume* vol);
00116         void setMPR3Dview(wxVtkMPR3DView *wxvtkmpr3Dview1);
00117         void setClipping3DView(wxVtkClipping3DView *wxvtkclipping3Dview1);
00118 
00119         //--------------------
00120         // plotter Information
00121         //---------------------
00122         void updatePlotter();
00123         
00124         //-----------------------
00125         //Handling events
00126         //-----------------------
00127 
00128         void OnSaveData(wxCommandEvent& event);
00129         void OnLoadData(wxCommandEvent& event);
00130         void OnRefreshBtn(wxCommandEvent& event);
00131 
00135         void initializeHistogram(vtkImageData* img);
00139         void GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value);
00140 
00145         void GetValuesColorPointsFunction(std::vector<double>& greylevel,
00146                                                                         std::vector<double>& red,
00147                                                                         std::vector<double>& green,
00148                                                                         std::vector<double>& blue);
00149         void SetFunctions(vtkPiecewiseFunction* _opac, vtkColorTransferFunction* _color);
00150 private:
00151         /*
00152         Histogram Widget
00153         */
00154         HistogramWidget*  histogramW;
00155 
00156         /*
00157          ok Button
00158         */
00159         wxButton                *okBtn;
00160         /*
00161          cancel Button
00162         */
00163         wxButton                *cancelBtn;
00164         /*
00165          save Button
00166         */
00167         wxButton                *saveDataBtn;   
00168         /*
00169         Load Button
00170         */
00171         wxButton                *loadDataBtn;
00172         /*
00173         Refresh Button
00174         */
00175         wxButton                *refreshBtn;
00176 
00177         
00178         
00179         // the user had pressed refresh
00180         bool refreshed;
00181         
00182         vtkColorTransferFunction                        *_ctfun;
00183         vtkPiecewiseFunction                            *_tfun;
00184         vtkVolumeRayCastMapper                          *volumeMapper; 
00185         vtkVolume                                                       *newvol;
00186 
00187         //things to refresh
00188         wxVtkMPR3DView                                          *wxvtkmpr3Dview;
00189         wxVtkClipping3DView                                     *wxvtkclipping3Dview;
00190         
00191         
00192 //      DECLARE_CLASS(HistogramDialog);
00193         // any class wishing to process wxWindows events must use this macro
00194         //DECLARE_EVENT_TABLE()
00195 };
00196 
00197 #endif
00198 
00199 
00200 

Generated on Wed Jul 29 16:35:29 2009 for creaMaracasVisu_lib by  doxygen 1.5.3