Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "mitkNavigationData.h"
00019
00020
00021 mitk::NavigationData::NavigationData() : itk::DataObject(),
00022 m_Position(), m_Orientation(0.0, 0.0, 0.0, 0.0), m_CovErrorMatrix(),
00023 m_HasPosition(true), m_HasOrientation(true), m_DataValid(false), m_TimeStamp(0.0),
00024 m_Name()
00025 {
00026 m_Position.Fill(0.0);
00027 m_CovErrorMatrix.SetIdentity();
00028 }
00029
00030 mitk::NavigationData::~NavigationData()
00031 {
00032 }
00033
00034
00035 void mitk::NavigationData::Graft( const DataObject *data )
00036 {
00037
00038 const Self* nd;
00039 try
00040 {
00041 nd = dynamic_cast<const Self *>( data );
00042 }
00043 catch( ... )
00044 {
00045 itkExceptionMacro( << "mitk::NavigationData::Graft cannot cast "
00046 << typeid(data).name() << " to "
00047 << typeid(const Self *).name() );
00048 return;
00049 }
00050 if (!nd)
00051 {
00052
00053 itkExceptionMacro( << "mitk::NavigationData::Graft cannot cast "
00054 << typeid(data).name() << " to "
00055 << typeid(const Self *).name() );
00056 return;
00057 }
00058
00059 this->SetPosition(nd->GetPosition());
00060 this->SetOrientation(nd->GetOrientation());
00061 this->SetDataValid(nd->IsDataValid());
00062 this->SetTimeStamp(nd->GetTimeStamp());
00063 this->SetHasPosition(nd->GetHasPosition());
00064 this->SetHasOrientation(nd->GetHasOrientation());
00065 this->SetCovErrorMatrix(nd->GetCovErrorMatrix());
00066 this->SetName(nd->GetName());
00067 }
00068
00069
00070 bool mitk::NavigationData::IsDataValid() const
00071 {
00072 return m_DataValid;
00073 }
00074
00075
00076 void mitk::NavigationData::PrintSelf(std::ostream& os, itk::Indent indent) const
00077 {
00078 this->Superclass::PrintSelf(os, indent);
00079 os << indent << "data valid: " << this->IsDataValid() << std::endl;
00080 os << indent << "Position: " << this->GetPosition() << std::endl;
00081 os << indent << "TimeStamp: " << this->GetTimeStamp() << std::endl;
00082 os << indent << "HasPosition: " << this->GetHasPosition() << std::endl;
00083 os << indent << "HasOrientation: " << this->GetHasOrientation() << std::endl;
00084 os << indent << "CovErrorMatrix: " << this->GetCovErrorMatrix() << std::endl;
00085 }
00086
00087
00088 void mitk::NavigationData::CopyInformation( const DataObject* data )
00089 {
00090 this->Superclass::CopyInformation( data );
00091
00092 const Self * nd = NULL;
00093 try
00094 {
00095 nd = dynamic_cast<const Self*>(data);
00096 }
00097 catch( ... )
00098 {
00099
00100 itkExceptionMacro(<< "mitk::NavigationData::CopyInformation() cannot cast "
00101 << typeid(data).name() << " to "
00102 << typeid(Self*).name() );
00103 }
00104 if ( !nd )
00105 {
00106
00107 itkExceptionMacro(<< "mitk::NavigationData::CopyInformation() cannot cast "
00108 << typeid(data).name() << " to "
00109 << typeid(Self*).name() );
00110 }
00111
00112 }
00113
00114
00115 void mitk::NavigationData::SetPositionAccuracy(mitk::ScalarType error)
00116 {
00117 for ( int i = 0; i < 3; i++ )
00118 for ( int j = 0; j < 3; j++ )
00119 {
00120 m_CovErrorMatrix[ i ][ j ] = 0;
00121
00122 m_CovErrorMatrix[ i + 3 ][ j ] = 0;
00123 m_CovErrorMatrix[ i ][ j + 3 ] = 0;
00124 }
00125 m_CovErrorMatrix[0][0] = m_CovErrorMatrix[1][1] = m_CovErrorMatrix[2][2] = error * error;
00126 }
00127
00128
00129 void mitk::NavigationData::SetOrientationAccuracy(mitk::ScalarType error)
00130 {
00131 for ( int i = 0; i < 3; i++ )
00132 for ( int j = 0; j < 3; j++ ) {
00133 m_CovErrorMatrix[ i + 3 ][ j + 3 ] = 0;
00134
00135 m_CovErrorMatrix[ i + 3 ][ j ] = 0;
00136 m_CovErrorMatrix[ i ][ j + 3 ] = 0;
00137 }
00138 m_CovErrorMatrix[3][3] = m_CovErrorMatrix[4][4] = m_CovErrorMatrix[5][5] = error * error;
00139 }