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;
42
43//----------------------------------------------------------------------------
45class ALBA_EXPORT albaGUIHistogramWidget: public albaGUIPanel, public albaObserver
46{
47public:
49 albaGUIHistogramWidget(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxSize(400,300), long style = wxTAB_TRAVERSAL /*| wxSUNKEN_BORDER */, bool showThresholds = false);
53
55 virtual void SetListener(albaObserver *Listener) {m_Listener = Listener;};
56
58 void OnEvent(albaEventBase *event);
59
61 {
62 ID_LOGSCALE = MINID,
68 };
69
71 void SetHistogramData(vtkImageData *histogram);
72
74 void SetData(vtkDataArray *data, int component = 0, albaVME *vme = NULL);
75
77 void LogarithmicScale(int enable = 1);
78
80 void LogarithmicScaleOn() {LogarithmicScale();};
81
83 void LogarithmicScaleOff() {LogarithmicScale(0);};
84
86 bool IsLogarithmicScale() {return m_LogHistogramFlag != 0;};
87
88
90 void ShowLines(int value=1);
91
93 void ShowText(int value=1){m_ShowText=value;};
94
98 void SetLut(vtkLookupTable *lut);
99
102
104 void GetThresholds(double *lower, double *upper);
105
106 /* Get the number of samples in the bin associated to the x coordinate */
107 long int GetHistogramValue(int x, int y);
108
109 /* Get the scalar vale of the histogram associated to the x coordinate */
110 double GetHistogramScalarValue(int x, int y);
111
113 void UpdateLines(int min,int max);
114
116 void OnMouseMove(double pos[2]);
117
119 void OnCtrlClick(double pos[2]);
120
122 ALBA_ID_DEC(BIN_PICKED);
123protected:
124
126 albaString GetComponentName(vtkDataArray *scalars, int compNum);
127
129 void CreateGui();
130
132 void UpdateGui();
133
135 void EnableWidgets(bool enable = true);
136
139
142
145
146
151 double m_Threshold[2];
154
156
159 double m_SelectedRange[2];
160
161 vtkLookupTable*m_Lut;
162 vtkDataArray *m_Data;
165 vtkALBAHistogram *m_Histogram;
166 vtkImageData *m_HistogramData;
168};
169#endif
MINID
Definition: albaDecl.h:244
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
albaGUIHistogramWidget : widget that encapsulate render window into a gui
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.
void OnCtrlClick(double pos[2])
CTRL+click on the histogram: send BIN_PICKED to the listener.
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.
ALBA_ID_DEC(BIN_PICKED)
CTRL+click on a bin of the histogram: its scalar value in GetDouble(), its number of samples in GetAr...
albaInteractionTool * m_Tool
tool getting the mouse moves and the CTRL+clicks of the render window
void OnMouseMove(double pos[2])
The mouse moved on the histogram: show the number of samples of the bin under the cursor.
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
Base class of the tools pushed on the stack of the PER.
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:151