#include "HistogramWidget.h"
#include "vtkImageCast.h"
#include <math.h>
+
// ----------------------------------------------------------------------------
// WX headers inclusion.
// For compilers that support precompilation, includes <wx/wx.h>.
#ifndef WX_PRECOMP
#include <wx/wx.h>
- #endif
+ #endif
+#include <wx/bitmap.h>
//----------------------------------------------------------------------------
// Class implementation
//----------------------------------------------------------------------------
}
*/
HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int flag,vtkImageData* imageData,int type):
- wxPanel(parent,id,pos,size)
+ wxPanel(parent,id,wxDefaultPosition,wxDefaultSize)
{
SetBackgroundColour(wxColour(255,255,255));
//histogram
histogram= new pHistogram(imageData);
+
//plotter
plotter=new pPlotter(this, 400,350);
-
+
//is a plotter of histograms
plotter->setType(2);
//setting the popMenu
idHistogram=-1;
transferenceFunctionHasColor=true;
transferenceFunctionHasPoints=true;
- this->type=type;;
+ this->type=type;
+ this->SetAutoLayout(true);
+ this->Refresh();
+
//drawing
drawHistogram();
drawTransferenceFunction();
SetBackgroundColour(wxColour(255,255,255));
histogram = NULL;
+
//plotter
plotter=new pPlotter(this, 400,350);
-
+
//is a plotter of histograms
plotter->setType(2);
//setting the popMenu
transferenceFunctionHasColor=true;
transferenceFunctionHasPoints=true;
this->type=type;;
+ this->SetAutoLayout(true);
+ this->Refresh();
}
+
+
void HistogramWidget::initializeHistogram(vtkImageData* img){
if(histogram ==NULL){
histogram= new pHistogram(img);
{
bool result=false;
pGraphicalFunction* tf=plotter->getFunction(idTransferenceFunction);
-printf("EED %p HistogramWidget::addPointToTransferenceFunction tp%p x%f y%f %d\n",this, tf, x ,y, idTransferenceFunction);
+//printf("EED %p HistogramWidget::addPointToTransferenceFunction tp%p x%f y%f %d\n",this, tf, x ,y, idTransferenceFunction);
if (tf!=NULL) { result=tf->AddPoint(x,y); }
return result;
this->type=type;
}
+/**
+** Returns two vectors, the grey level of the point and its value, the value is between [0,1]
+**/
+ void HistogramWidget::GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value){
+ plotter->GetValuesPointsFunction(greylevel,value,histogramSize);
+ }
+/**
+** Returns two vectors, the grey level of the point and its value, the red, green
+** and blue value is between [0,1]
+**/
+ void HistogramWidget::GetValuesColorPointsFunction(std::vector<double>& greylevel,
+ std::vector<double>& red,
+ std::vector<double>& green,
+ std::vector<double>& blue)
+ {
+ plotter->GetValuesColorPointsFunction(greylevel,red,green,blue);
+ }