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 albaString GetComponentName(vtkDataArray *scalars, int compNum);
55
57 virtual void SetListener(albaObserver *Listener) {m_Listener = Listener;};
58
60 void OnEvent(albaEventBase *event);
61
62 ALBA_ID_DEC(RANGE_MODIFIED);
63
65 {
66 ID_LOGSCALE = MINID,
72 };
73
75 void SetHistogramData(vtkImageData *histogram);
76
78 void SetData(vtkDataArray *data, int component = 0, albaVME *vme = NULL);
79
81 void LogarithmicScale(int enable = 1);
82
84 void LogarithmicScaleOn() {LogarithmicScale();};
85
87 void LogarithmicScaleOff() {LogarithmicScale(0);};
88
90 bool IsLogarithmicScale() {return m_LogHistogramFlag != 0;};
91
92
94 void ShowLines(int value=1);
95
97 void ShowText(int value=1){m_ShowText=value;};
98
102 void SetLut(vtkLookupTable *lut);
103
106
108 void GetThresholds(double *lower, double *upper);
109
110 /* Get the number of samples in the bin associated to the x coordinate */
111 long int GetHistogramValue(int x, int y);
112
113 /* Get the scalar vale of the histogram associated to the x coordinate */
114 double GetHistogramScalarValue(int x, int y);
115
117 void UpdateLines(int min,int max);
118protected:
119
121 void CreateGui();
122
124 void UpdateGui();
125
127 void EnableWidgets(bool enable = true);
128
131
134
137
138
143 double m_Threshold[2];
146
148
151 double m_SelectedRange[2];
152
153 vtkLookupTable*m_Lut;
154 vtkDataArray *m_Data;
157 vtkALBAHistogram *m_Histogram;
158 vtkImageData *m_HistogramData;
159};
160#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
void ExportStats()
Exports Input Data statsistics as CSV file.
double GetHistogramScalarValue(int x, int y)
wxString GetProposedCSVNane()
Return a proposed name for CSV file export.
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 SetData(vtkDataArray *data, int component=0, albaVME *vme=NULL)
Input data from which generate histogram.
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.
albaString GetComponentName(vtkDataArray *scalars, int compNum)
Returns the component name.
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.
void ExportData()
Exports Input Data as CSV file.
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
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
albaVME -
Definition: albaVME.h:150