HistogramWidget.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef __HISTOGRAMW__
00004 #define __HISTOGRAMW__
00005 
00006 
00007 // ----------------------------------------------------------------------------
00008 // wx headers inclusion.
00009 // For compilers that support precompilation, includes <wx/wx.h>.
00010 // ----------------------------------------------------------------------------
00011 #include <wx/wxprec.h>
00012 #ifdef __BORLANDC__
00013 #pragma hdrstop
00014 #endif
00015 #ifndef WX_PRECOMP
00016 #include <wx/wx.h>
00017 #endif
00018 
00019 #include "marTypes.h"
00020 #include "pPlotter.h"
00021 #include "pFunctionPoint.h"
00022 #include  "vtkImageData.h"
00023 #include "pHistogram.h"
00024 #include "pPlotterScaleY.h"
00025 #include "pPlotterScaleX.h"
00026 
00027 //#define MAX 500
00028 #define NUM_POINTS 100
00029 #define WINDOW_SIZE 10
00030 
00031 class creaMaracasVisu_EXPORT HistogramWidget:public wxPanel
00032 {
00033 public:
00034         //---------------------
00035         // Constructor
00036         //----------------------
00037 
00038         //HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag );
00039         
00040  
00041         HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag,vtkImageData* imageData,int type);
00042         
00043         ~HistogramWidget();
00044 
00045         /*
00046         Draw the histogram in the plotter
00047         */
00048         void drawHistogram();
00049         /*
00050         Draw the transference function in the plotter
00051         */
00052         void drawTransferenceFunction();
00053         /*
00054                 if the user resize the window   
00055         */
00056         void OnSize( wxSizeEvent &WXUNUSED(event) );
00057         //---------------------------------------
00058         // Get Information from the widget
00059         //---------------------------------------
00060         /*
00061                 get number of points of the transference function
00062         */
00063         int getSizeTransferenceFunction();
00064         /*
00065                 get number of points of the barColor
00066         */
00067         int getSizeBarColor();
00068         /*
00069                 get a point of the transference function
00070         */
00071         void getTransferenceFunctionPoint(int index,int& x,int& y);
00072         /*
00073                 get a  color int the bqr color
00074         */
00075         void getDataBarColorPoint(int index,int&x, int& red,int& green,int& blue);
00076         /*
00077                 get a point of the Histogram
00078                 given the grey value
00079         */
00080         int getHistogramPoint(int gValue);
00081 
00082         //--------------------
00083         // bar Information
00084         //---------------------
00085         /*
00086          Get the porcentage of the positions of 
00087          the min,max and actual in the bar range
00088         */
00089         float getMaxShowedPorcentage();
00090         float getMinShowedPorcentage(); 
00091         float getActualShowedPorcentage();      
00092 
00093         //---------------------------------------
00094         // setting data in transferences function
00095         // and in bar color
00096         //----------------------------------------
00097         /*
00098           Adds a point to the transference function
00099         */
00100         bool addPointToTransferenceFunction(double x, double y);
00101         /*
00102                 add a color point to the histogram
00103                 @param x the level of grey to which the color is assigned
00104                 @param red the level of red for the color
00105                 @param green the level of red for the color
00106                 @param blue the level of red for the color
00107         */
00108         bool addColorPoint(double x,int red,int green, int blue);
00109         //--------------------
00110         // plotter Information
00111         //---------------------
00112         void updatePlotter();
00113         
00114         //------------------------
00115         //Erase data
00116         //------------------------
00117         
00118 
00119         /*
00120          Erase all the points that are in the transference function
00121         */
00122         void erasePointsTransferenceFunction();
00123         /*
00124         Erase the  color points in the plotter
00125         */
00126         void eraseColorPoints();
00127 
00128         //-------------------
00129         // Getter and setters
00130         //-------------------
00131 
00132         void setTransferenceFunctionHasPoints(bool hasPoints);
00133         void setTransferenceFunctionHasColor(bool hasColorPoints);
00134         int getHistogramSize();
00135         void setType(int type);
00136 
00137 
00138 
00139 private:
00140         
00141          pHistogram* histogram;
00142          pPlotter* plotter;
00143          int idTransferenceFunction;
00144          int histogramSize;
00145          int idHistogram;
00146          /*
00147           if the image has already a transference
00148           function and color defines to that function
00149           we have to draw it in the widget
00150          */
00151          bool transferenceFunctionHasPoints;
00152          bool transferenceFunctionHasColor;
00153          /*
00154          * type=1 with transference function for moving
00155          * type=2 without transference function for moving
00156          */
00157          int type;
00158          
00159          DECLARE_CLASS(HistogramWidget);
00160          //----------------------------------------------------------------------------
00161         // wxWidget macro use declaration for handdling events
00162         //----------------------------------------------------------------------------
00163         DECLARE_EVENT_TABLE()
00164         
00165 };
00166 #endif
00167 
00168 

Generated on Fri Jun 12 00:08:33 2009 for creaMaracasVisu by  doxygen 1.5.7.1