19 #include "mitkIGTException.h" 20 #include "mitkIGTHardwareException.h" 58 ss <<
"mitk::TrackingDeviceSource: not enough outputs available for all tools. " 59 << this->GetNumberOfOutputs() <<
" outputs available, but " 60 <<
m_TrackingDevice->GetToolCount() <<
" tools available in the tracking device.";
61 throw std::out_of_range(ss.str());
65 for (
unsigned int i = 0; i < toolCount; ++i)
96 MITK_DEBUG <<
"Setting TrackingDevice to " << td;
101 std::stringstream name;
102 name << td->GetData().Model <<
" Tracking Source";
109 if (this->GetNumberOfOutputs() > 0)
111 for (
int numOP = this->GetNumberOfOutputs() -1; numOP >= 0; numOP--)
112 this->RemoveOutput(numOP);
121 unsigned int numberOfOutputs = this->GetNumberOfIndexedOutputs();
123 MITK_DEBUG <<
"Number of outputs at start of method CreateOutputs(): " << numberOfOutputs;
128 DataObjectPointer newOutput = this->
MakeOutput(idx);
130 this->SetNthOutput(idx, newOutput);
139 throw std::invalid_argument(
"mitk::TrackingDeviceSource: No tracking device set");
152 throw std::runtime_error(std::string(
"mitk::TrackingDeviceSource: Could not open connection to tracking device. Error: ") + e.GetDescription());
159 throw std::invalid_argument(
"mitk::TrackingDeviceSource: No tracking device set");
163 throw std::runtime_error(
"mitk::TrackingDeviceSource: Could not start tracking");
169 throw std::invalid_argument(
"mitk::TrackingDeviceSource: No tracking device set");
171 throw std::runtime_error(
"mitk::TrackingDeviceSource: Could not close connection to tracking device");
177 throw std::invalid_argument(
"mitk::TrackingDeviceSource: No tracking device set");
179 throw std::runtime_error(
"mitk::TrackingDeviceSource: Could not stop tracking");
184 if(this->
GetTrackingDevice()->GetToolCount() != this->GetNumberOfIndexedOutputs())
188 Superclass::UpdateOutputInformation();
An object of this class represents an exception of the MITK-IGT module which are releated to the hard...
void GenerateData() override
filter execute method
void SetOrientationAccuracy(mitk::ScalarType error)
NavigationData * GetOutput(void)
return the output (output with id 0) of the filter
virtual void SetTrackingDevice(mitk::TrackingDevice *td)
sets the tracking device that will be used as a source for tracking data
~TrackingDeviceSource() override
double GetElapsed()
returns the time elapsed since calling Start() for the first time in milliseconds ...
An object of this class represents an exception of the MITK-IGT module.
void CreateOutputs()
Create the necessary outputs for the TrackingTool objects in m_TrackingDevice.
DataCollection - Class to facilitate loading/accessing structured data.
virtual void SetDataValid(bool _arg)
sets the dataValid flag of the NavigationData object indicating if the object contains valid data ...
virtual void SetIGTTimeStamp(TimeStampType _arg)
sets the IGT timestamp of the NavigationData object in milliseconds
virtual const mitk::TrackingDevice * GetTrackingDevice()
returns the tracking device that is used by this filter
mitk::Quaternion OrientationType
Type that holds the orientation part of the tracking data.
void StartTracking()
starts tracking. This needs to be called before Update() or GetOutput()->Update(). If the device is already tracking the method does nothing.
mitk::TrackingDevice::Pointer m_TrackingDevice
the tracking device that is used as a source for this filter object
virtual TimeStampType GetIGTTimeStamp() const
gets the IGT timestamp of the NavigationData object in milliseconds Please note, that there is also t...
itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
virtual void SetOrientation(OrientationType _arg)
sets the orientation of the NavigationData object
void StopTracking()
stops tracking.
Interface for all Tracking Devices.
static IGTTimeStamp * GetInstance()
returns a pointer to the current instance of mitkTimeStamp
virtual bool IsConnected()
returns true if a connection to the tracking device is established
virtual bool IsTracking()
returns true if tracking is in progress
void Disconnect()
Closes the connection to the tracking device.
virtual void SetPosition(PositionType _arg)
sets the position of the NavigationData object
#define mitkThrowException(classname)
void Connect()
Establishes a connection to the tracking device. If there is already a connection the method does not...
void UpdateOutputInformation() override
Used for pipeline update.
virtual void SetName(std::string _arg)
Sets the human readable name of this source. There is also a default name, but you can use this metho...
void SetPositionAccuracy(mitk::ScalarType error)