#include <Histogram.h>
Public Member Functions | |
Histogram (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag) | |
~Histogram () | |
void | drawHistogram () |
void | OnSize (wxSizeEvent &WXUNUSED(event)) |
int | getHistogramPoint (int gValue) |
int | getHistogramSize () |
void | Configure (vtkImageData *imageData) |
Private Member Functions | |
DECLARE_CLASS (Histogram) | |
Private Attributes | |
pHistogram * | histogram |
pPlotterWindow * | plotter |
int | histogramSize |
int | idHistogram |
Definition at line 31 of file Histogram.h.
Histogram::Histogram | ( | wxWindow * | parent, | |
wxWindowID | id, | |||
const wxPoint & | pos, | |||
const wxSize & | size, | |||
int | flag | |||
) |
Definition at line 38 of file Histogram.cxx.
00038 : 00039 wxPanel(parent,id,pos,size,flag) 00040 { 00041 SetBackgroundColour(wxColour(255,255,255)); 00042 //histogram 00043 //EED Borrame 07Mai2009 00044 // histogram= new pHistogram(imageData); 00045 00046 //plotter 00047 plotter=new pPlotterWindow(this, -1, wxPoint(0,0), wxSize(742,476), wxSUNKEN_BORDER ); 00048 00049 plotter->AddLayer(new pPlotterScaleX()); 00050 plotter->AddLayer(new pPlotterScaleY()); 00051 //is a plotter of histograms 00052 plotter->setType(2); 00053 //setting the popMenu 00054 plotter->setPopUpMenu(true,true,true,true,true,true,false,false,false,false,false,false,false); 00055 histogramSize=0; 00056 00057 idHistogram=-1; 00058 00059 //EED Borrame 07Mai2009 00060 //drawing 00061 // drawHistogram(); 00062 00063 00064 }
Histogram::~Histogram | ( | ) |
void Histogram::Configure | ( | vtkImageData * | imageData | ) |
Definition at line 73 of file Histogram.cxx.
References drawHistogram(), and histogram.
00074 { 00075 histogram= new pHistogram(imageData); 00076 drawHistogram(); 00077 }
Histogram::DECLARE_CLASS | ( | Histogram | ) | [private] |
void Histogram::drawHistogram | ( | ) |
Definition at line 82 of file Histogram.cxx.
References pPlotterWindow::addFunction(), pPlotterWindow::addFunctionToMove(), pPlotterWindow::getFunctionForVectors(), pHistogram::getHistogram(), pHistogram::getSize(), histogram, histogramSize, idHistogram, NUM_POINTS, plotter, pGraphicalFunction::setEditable(), pGraphicalFunction::setmType(), mpLayer::SetPen(), and pGraphicalFunction::setType().
Referenced by Configure().
00083 { 00084 //int xValues[MAX],yValues[MAX],extent[6]; 00085 double* xValues; 00086 double* yValues; 00087 00088 vtkImageData* histogramImageData=histogram->getHistogram(); 00089 00090 //size 00091 histogramSize=histogram->getSize(); 00092 00093 //plotting 00094 xValues=(double*)malloc(NUM_POINTS*sizeof(double)); 00095 yValues=(double*)malloc(NUM_POINTS*sizeof(double)); 00096 00097 unsigned short* histogramPointer=(unsigned short*)histogramImageData->GetScalarPointer(0,0,0); 00098 00099 for(int i=0; i< histogramSize; i++) 00100 { 00101 xValues[i]=i; 00102 yValues[i]=log( (double) histogramPointer[i])*10; 00103 } 00104 00105 00106 pGraphicalFunction* histogramFunction=plotter->getFunctionForVectors(xValues,histogramSize,yValues,histogramSize); 00107 00108 if (histogramFunction) 00109 { 00110 histogramFunction->setEditable(false); 00111 //smooth function 00112 histogramFunction->setType(2); 00113 //it is an histogram 00114 histogramFunction->setmType(2); 00115 idHistogram=plotter->addFunction(histogramFunction); 00116 //for setting range the vision 00117 plotter->addFunctionToMove(histogramFunction); 00118 wxPen mypen1(*wxBLUE, 1, wxSOLID ); 00119 mypen1.SetWidth(2); 00120 histogramFunction->SetPen( mypen1 ); 00121 } 00122 00123 00124 free(xValues); 00125 free(yValues); 00126 00127 //plotter->setPopUpMenu(true,true,false,false,true,true,false,false,false,false,false,false,false); 00128 }
int Histogram::getHistogramPoint | ( | int | gValue | ) |
Definition at line 149 of file Histogram.cxx.
References pHistogram::getHistogramPoint(), and histogram.
00150 { 00151 return histogram->getHistogramPoint(gValue); 00152 }
int Histogram::getHistogramSize | ( | ) |
Definition at line 159 of file Histogram.cxx.
References histogramSize.
00160 { 00161 return histogramSize; 00162 }
void Histogram::OnSize | ( | wxSizeEvent & | WXUNUSEDevent | ) |
Definition at line 133 of file Histogram.cxx.
References plotter.
00134 { 00135 int scrX,scrY; 00136 GetClientSize(&scrX,&scrY); 00137 plotter->SetSize(scrX,scrY); 00138 /* 00139 pGraphicalFunction* actual=plotter->getFunction(idTransferenceFunction); 00140 actual->setScreens(scrX,scrY); 00141 actual->setScales(); 00142 */ 00143 }
pHistogram* Histogram::histogram [private] |
Definition at line 69 of file Histogram.h.
Referenced by Configure(), drawHistogram(), getHistogramPoint(), and ~Histogram().
int Histogram::histogramSize [private] |
Definition at line 71 of file Histogram.h.
Referenced by drawHistogram(), and getHistogramSize().
int Histogram::idHistogram [private] |
Definition at line 72 of file Histogram.h.
Referenced by drawHistogram().
pPlotterWindow* Histogram::plotter [private] |
Definition at line 70 of file Histogram.h.
Referenced by drawHistogram(), OnSize(), and ~Histogram().