NorMIT-nav  22.09
An IGT application
cxCoordinateSystemHelpers.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
13 
14 #include "cxDefinitionStrings.h"
15 
16 namespace cx
17 {
18 
20 {
21  return enum2string(mId) + (mRefObject.isEmpty() ? "" : ("/"+mRefObject));
22 }
23 
25 {
26  QStringList raw = text.split("/");
27  CoordinateSystem retval(csCOUNT);
28  if (raw.size()<1)
29  return retval;
30  retval.mId = string2enum<COORDINATE_SYSTEM>(raw[0]);
31  if (raw.size()<2)
32  return retval;
33  retval.mRefObject = raw[1];
34  return retval;
35 }
36 
38 {
39  return mId!=csCOUNT;
40 }
41 
42 bool operator==(const CoordinateSystem& lhs, const CoordinateSystem& rhs)
43 {
44  return ( lhs.mId==rhs.mId )&&( lhs.mRefObject==rhs.mRefObject );
45 }
46 
47 // --------------------------------------------------------
48 
49 
50 
51 } //namespace cx
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::CoordinateSystem::isValid
bool isValid() const
Definition: cxCoordinateSystemHelpers.cpp:37
cxCoordinateSystemHelpers.h
cx::CoordinateSystem::fromString
static CoordinateSystem fromString(QString text)
Definition: cxCoordinateSystemHelpers.cpp:24
cx::CoordinateSystem::toString
QString toString() const
Definition: cxCoordinateSystemHelpers.cpp:19
cxDefinitionStrings.h
cx::operator==
bool operator==(const RegistrationTransform &lhs, const RegistrationTransform &rhs)
Definition: cxRegistrationTransform.cpp:151
enum2string
QString enum2string(const ENUM &val)
cx::CoordinateSystem
Identification of a Coordinate system.
Definition: cxCoordinateSystemHelpers.h:31
cx::CoordinateSystem::mId
COORDINATE_SYSTEM mId
the type of coordinate system
Definition: cxCoordinateSystemHelpers.h:35
cx::CoordinateSystem::mRefObject
QString mRefObject
for tool, sensor and data we need a object uid to define the coordinate system
Definition: cxCoordinateSystemHelpers.h:36