1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
/*=========================================================================
Program: Image Guided Surgery Software Toolkit
Module: $RCSfile: igstkPrecomputedTransformData.h,v $
Language: C++
Date: $Date: 2009-01-30 20:49:54 $
Version: $Revision: 1.1 $
Copyright (c) ISC Insight Software Consortium. All rights reserved.
See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __igstkPrecomputedTransformData_h
#define __igstkPrecomputedTransformData_h
#include "igstkStateMachine.h"
#include "igstkMacros.h"
#include "igstkObject.h"
#include "igstkTransformBase.h"
namespace igstk
{
/** \class PrecomputedTransformData
*
* \brief This class is a container for precomputed transformations.
* The container holds the transformation, its associated estimation
* error, computation date, and human readable description.
*
* This class allows the programmer to load a precomputed transformation
* for use in an IGSTK based application. The transformation is arbitrary
* (e.g rigid, affine, perspective...). This container is usefull for loading
* calibration data for tools, and preoperative registration of image data such
* as CT to MR.
*/
class PrecomputedTransformData : public Object
{
public:
/**Macro with standard traits declarations (Self, SuperClass, state machine
* etc.). */
igstkStandardClassTraitsMacro( PrecomputedTransformData, Object )
typedef igstk::TransformBase TransformType;
typedef std::string DateType;
typedef double ErrorType;
/** This method Initializes the transformation information according to the
* given data. All of the data is required at this time in a manner similar
* to standard object construction.
* NOTE: The temporal validity of the transformation is assumed to be
* infinite.*/
void RequestInitialize( TransformType *transform,
const DateType &date,
const std::string &description,
const ErrorType err );
/** This method is used to request the calibration/registration
* transformation.
* It generates three events: TransformationType3DEvent,
* PerspectiveTransformTypeEvent and InvalidRequestErrorEvent
* (denoting that the transformation data is not available). */
void RequestTransform();
/** This method is used to request the calibration/registration error (e.g.
* RMS error associated with pivot calibration, or expected TRE for
* paired point rigid registration).
* It generates two events: TransformErrorTypeEvent, and
* InvalidRequestErrorEvent (denoting that the error data is not
* available). */
void RequestEstimationError();
/** This method is used to request the calibration/registration description
* (e.g. "Claron bayonet pointer", or "CT to MR transformation").
* It generates two events: StringEvent, and InvalidRequestErrorEvent
* (denoting that the error data is not available). */
void RequestTransformDescription();
/** This method is used to request the calibration/registration date.
* (e.g. "Fri May 14 16:00:00 1948").
* It generates two events: TransformDateTypeEvent, and
* InvalidRequestErrorEvent (denoting that the error data is not
* available). */
void RequestComputationDateAndTime();
/** \class This event is generated when the transformation is requested and
* the data was initialized. */
class TransformTypeEvent : public IGSTKEvent
{
public:
TransformTypeEvent() {}
virtual ~TransformTypeEvent() {}
virtual const char * GetEventName() const
{
return "TransformTypeEvent";
}
virtual bool CheckEvent(const ::itk::EventObject* e) const
{ return dynamic_cast<const TransformTypeEvent*>(e); }
virtual ::itk::EventObject* MakeObject() const
{ return new TransformTypeEvent(); }
TransformTypeEvent(const TransformTypeEvent&s) : IGSTKEvent(s){};
PrecomputedTransformData::TransformType* Get() const
{ return m_Payload; }
void Set( PrecomputedTransformData::TransformType* p )
{ m_Payload = p; }
private:
void operator=(const TransformTypeEvent &);
TransformType* m_Payload;
};
/** This event is generated when the transformation estimation error is
* requested and the data was initialized. */
igstkLoadedEventMacro( TransformErrorTypeEvent, IGSTKEvent,
ErrorType );
/** This event is generated when the transformation computation date is
* requested and the data was initialized. */
igstkLoadedEventMacro( TransformDateTypeEvent, IGSTKEvent,
DateType );
protected:
PrecomputedTransformData( void );
virtual ~PrecomputedTransformData( void );
/** Print the object information in a stream. */
void PrintSelf( std::ostream& os, itk::Indent indent ) const;
private:
/** List of state machine states */
igstkDeclareStateMacro( Idle );
igstkDeclareStateMacro( Initialized );
/** List of state machine inputs */
igstkDeclareInputMacro( Initialize );
igstkDeclareInputMacro( GetTransform );
igstkDeclareInputMacro( GetEstimationError );
igstkDeclareInputMacro( GetDescription );
igstkDeclareInputMacro( GetDate );
/**List of state machine actions*/
void ReportInvalidRequestProcessing();
void InitializeProcessing();
void GetTransformProcessing();
void GetEstimationErrorProcessing();
void GetDescriptionProcessing();
void GetDateProcessing();
TransformType *m_TmpTransform;
TransformType *m_Transform;
ErrorType m_TmpTransformationError;
ErrorType m_TransformationError;
std::string m_TmpTransformationDescription;
std::string m_TransformationDescription;
DateType m_TmpComputationDateAndTime;
DateType m_ComputationDateAndTime;
};
} // end namespace igstk
#endif // __igstkPrecomputedTransformData_h
|