ALBA
albaGUIHistogramWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaGUIHistogramWidget
5 Authors: Paolo Quadrani, Gianluigi Crimi
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaGUIHistogramWidget_H__
18#define __albaGUIHistogramWidget_H__
19
20
21//----------------------------------------------------------------------------
22// Include:
23//----------------------------------------------------------------------------
24#include "albaGUIPanel.h"
25#include "albaDecl.h"
26#include "albaEvent.h"
27
28#include "vtkALBAHistogram.h"
29
30//----------------------------------------------------------------------------
31// forward refs
32//----------------------------------------------------------------------------
33class albaRWI;
34class vtkDataArray;
35class albaGUI;
36class albaVME;
37class vtkImageData;
40class vtkLookupTable;
41
42//----------------------------------------------------------------------------
44class ALBA_EXPORT albaGUIHistogramWidget: public albaGUIPanel, public albaObserver
45{
46public:
48 albaGUIHistogramWidget(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxSize(400,300), long style = wxTAB_TRAVERSAL /*| wxSUNKEN_BORDER */, bool showThresholds = false);
52
54 virtual void SetListener(albaObserver *Listener) {m_Listener = Listener;};
55
57 void OnEvent(albaEventBase *event);
58
59 ALBA_ID_DEC(RANGE_MODIFIED);
60
62 {
63 ID_LOGSCALE = MINID,
69 };
70
72 void SetHistogramData(vtkImageData *histogram);
73
75 void SetData(vtkDataArray *data, albaVME *vme = NULL);
76
78 void LogarithmicScale(int enable = 1);
79
81 void LogarithmicScaleOn() {LogarithmicScale();};
82
84 void LogarithmicScaleOff() {LogarithmicScale(0);};
85
87 bool IsLogarithmicScale() {return m_LogHistogramFlag != 0;};
88
89
91 void ShowLines(int value=1);
92
94 void ShowText(int value=1){m_ShowText=value;};
95
99 void SetLut(vtkLookupTable *lut);
100
103
105 void GetThresholds(double *lower, double *upper);
106
107 /* Get the number of samples in the bin associated to the x coordinate */
108 long int GetHistogramValue(int x, int y);
109
110 /* Get the scalar vale of the histogram associated to the x coordinate */
111 double GetHistogramScalarValue(int x, int y);
112
114 void UpdateLines(int min,int max);
115protected:
116
118 void CreateGui();
119
121 void UpdateGui();
122
124 void EnableWidgets(bool enable = true);
125
130 double m_Threshold[2];
132
134
137 double m_SelectedRange[2];
138
139 vtkLookupTable*m_Lut;
140 vtkDataArray *m_Data;
143 vtkALBAHistogram *m_Histogram;
144 vtkImageData *m_HistogramData;
145private:
146 void ExportData();
147 void ExportStats();
148};
149#endif
MINID
Definition: albaDecl.h:420
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
albaGUIHistogramWidget : widget that encapsulate render window into a gui
ALBA_ID_DEC(RANGE_MODIFIED)
albaGUI * GetGui()
Return a reference to the UI.
albaGUIHistogramWidget(wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL, bool showThresholds=false)
Constructor.
void SetLut(vtkLookupTable *lut)
Set the reference to the lut which range will be adjusted by the slider.
void LogarithmicScale(int enable=1)
Enable/disable logarithmic scale for histogram.
void SetHistogramData(vtkImageData *histogram)
Set a pre-calculated histogram, just visualize it instead calculate.
void GetThresholds(double *lower, double *upper)
Get the threshold of the histogram if setted.
virtual ~albaGUIHistogramWidget()
Destructor.
albaGUILutSlider * m_SliderThresholds
vtkALBAHistogram * m_Histogram
double GetHistogramScalarValue(int x, int y)
void UpdateLines(int min, int max)
Update position of the gizmo lines.
virtual void SetListener(albaObserver *Listener)
Set the listener for the widget.
albaGUIRangeSlider * m_Slider
long int GetHistogramValue(int x, int y)
void EnableWidgets(bool enable=true)
Enable/disable view widgets.
void LogarithmicScaleOff()
Turn Off log scale.
void CreateGui()
Create GUI for histogram widget.
bool IsLogarithmicScale()
Return the status of log scale flag.
void OnEvent(albaEventBase *event)
Main Event handler.
void UpdateGui()
Update UI parameters according to the vtkALBAHistogram.
void SetData(vtkDataArray *data, albaVME *vme=NULL)
Input data from which generate histogram.
void LogarithmicScaleOn()
Turn On log scale.
void ShowText(int value=1)
Enable/Disable the visualization of the number of samples in the bin under the mouse cursor.
void ShowLines(int value=1)
Enable/Disable threshold lines visualization.
albaGUILutSlider is a Label that notify user-click using the normal wxEvents.
class name: albaGUIPanel Inherits directly from wxPanel and adds the pointer to the next panel
Definition: albaGUIPanel.h:27
class name: albaGUIRangeSlider Class that handles a slider for visualising or changing range.
albaGUI is a panel with function to easily create GUI.
Definition: albaGUI.h:110
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
albaVME -
Definition: albaVME.h:150