IGSTK
igstkPivotCalibrationFLTKWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Image Guided Surgery Software Toolkit
4 Module: $RCSfile: igstkPivotCalibrationFLTKWidget.h,v $
5 Language: C++
6 Date: $Date: 2009-06-15 20:57:59 $
7 Version: $Revision: 1.2 $
8 
9 Copyright (c) ISC Insight Software Consortium. All rights reserved.
10 See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
11 
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __igstkPivotCalibrationFLTKWidget_h
18 #define __igstkPivotCalibrationFLTKWidget_h
19 
20 #include <FL/Fl.H>
21 #include <FL/Fl_Group.H>
22 
23 #include "igstkStateMachine.h"
24 #include "igstkMacros.h"
25 #include "igstkEvents.h"
26 #include "igstkTracker.h"
27 #include "igstkPivotCalibration.h"
28 
29 class Fl_Output;
30 class Fl_Progress;
31 class Fl_Button;
32 class Fl_Multiline_Output;
33 
34 
35 namespace igstk
36 {
71 class PivotCalibrationFLTKWidget : public Fl_Group
72 {
73 public:
74 
76  typedef Fl_Group Superclass;
77 
79 
82 
83 
87  PivotCalibrationFLTKWidget( int x, int y,
88  int w, int h,
89  const char *label="" );
91  virtual ~PivotCalibrationFLTKWidget( void );
92 
99  void RequestInitialize( unsigned int n,
100  igstk::TrackerTool::Pointer trackerTool );
101 
104  void RequestSetDelay( unsigned int delayInSeconds );
105 
112 
117  void RequestPivotPoint();
118 
124  void RequestCalibrationRMSE();
125 
126 
128  unsigned long AddObserver( const itk::EventObject & event,
129  itk::Command *command );
130  unsigned long AddObserver( const itk::EventObject & event,
131  itk::Command *command ) const;
132  void RemoveObserver( unsigned long observerID );
133 
134 private:
135 
136  Fl_Output *m_toolDescription;
137  Fl_Progress *m_progress;
138  Fl_Button *m_calibrateButton;
139  Fl_Multiline_Output *m_output;
140 
141  static const double TOOL_DESCRIPTION_X_SCALE;
142  static const double TOOL_DESCRIPTION_Y_SCALE;
143  static const double TOOL_DESCRIPTION_W_SCALE;
144  static const double TOOL_DESCRIPTION_H_SCALE;
145 
146  static const double PROGRESS_X_SCALE;
147  static const double PROGRESS_Y_SCALE;
148  static const double PROGRESS_W_SCALE;
149  static const double PROGRESS_H_SCALE;
150 
151  static const double BUTTON_X_SCALE;
152  static const double BUTTON_Y_SCALE;
153  static const double BUTTON_W_SCALE;
154  static const double BUTTON_H_SCALE;
155 
156  static const double OUTPUT_X_SCALE;
157  static const double OUTPUT_Y_SCALE;
158  static const double OUTPUT_W_SCALE;
159  static const double OUTPUT_H_SCALE;
160 
162  static void RequestComputeCalibrationCB(Fl_Button *b,
163  void *v);
164  inline void RequestComputeCalibration();
165  //the igstk class that actually does everything
166  PivotCalibration::Pointer m_pivotCalibration;
167  //delay before data acquisition starts [milliseconds]
168  unsigned int m_delay;
169  //description of the tool we want to calibrate
170  std::string m_currentToolInformation;
171 
172  //accumulate the calibration information in this stream and
173  //then display to the user
174  std::ostringstream m_calibrationInformationStream;
175 
176  //pivot calibration initialization observer
177  typedef itk::MemberCommand<PivotCalibrationFLTKWidget>
178  InitializationObserverType;
179  void OnInitializationEvent( itk::Object *caller,
180  const itk::EventObject & event );
181  InitializationObserverType::Pointer m_InitializationObserver;
182 
183  //pivot calibration events (start, progress, end)
184  //observer
185  typedef itk::MemberCommand<PivotCalibrationFLTKWidget>
186  CalibrationObserverType;
187  void OnCalibrationEvent( itk::Object *caller,
188  const itk::EventObject & event );
189  CalibrationObserverType::Pointer m_CalibrationObserver;
190 
191  //pivot calibration get transform observer
192  igstkObserverMacro( TransformTo,
193  igstk::CoordinateSystemTransformToEvent,
195  TransformToObserver::Pointer m_TransformToObserver;
196 
197  //pivot calibration get pivot point observer
198  igstkObserverMacro( PivotPoint,
199  igstk::PointEvent,
200  igstk::EventHelperType::PointType )
201  PivotPointObserver::Pointer m_PivotPointObserver;
202 
203  //pivot calibration get RMSE observer
204  igstkObserverMacro( RMSE,
205  igstk::DoubleTypeEvent,
206  igstk::EventHelperType::DoubleType )
207  RMSEObserver::Pointer m_RMSEObserver;
208 
209 };
210 
211 } // end namespace igstk
212 
213 #endif //__igstkPivotCalibrationFLTKWidget_h
#define igstkTypeMacro(thisClass, superclass)
Type Macro defines the GetNameOfClass() method for every class where it is invoked.
Definition: igstkMacros.h:128
unsigned long AddObserver(const itk::EventObject &event, itk::Command *command)
Add an observer so that an outside class is notified of events.
void RequestCalibrationRMSE()
This method is used to request the Root Mean Square Error (RMSE) of the overdetermined equation syste...
void RemoveObserver(unsigned long observerID)
Base class for all the IGSTK classes.
Definition: igstkObject.h:40
#define igstkObserverMacro(name, eventType, payloadType)
Definition: igstkMacros.h:368
void RequestInitialize(unsigned int n, igstk::TrackerTool::Pointer trackerTool)
This method sets the number of transformations required for performing the pivot calibration, and the tool information.
defines standard system-wide macros, constants, and other common parameters in the IGSTK Library...
Abstract superclass for concrete IGSTK TrackerTool classes.
void RequestPivotPoint()
This method is used to request the pivot point, given in the coordinate system in which the user supp...
void RequestSetDelay(unsigned int delayInSeconds)
This method sets the delay in seconds between the moment the "Calibrate" button is pressed and the be...
This class encapsulates the pivot calibration algorithm and tracking data acquistion for performing t...
itk::Point< double, 3 > PointType
Definition: igstkEvents.h:59
#define igstkLoggerMacro()
Macro that defines all the standard elements related to the Logger.
Definition: igstkMacros.h:143
This class is a user interface (FLTK-based) for the pivot calibration class.
This class encapsulates the results of asking the coordinate reference system for a transform to anot...
void RequestCalibrationTransform()
This method is used to request the calibration transformation.