PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
vtkPlusPhidgetSpatialTracker Class Reference

Interface for the Phidget 3/3/3 tracker. More...

#include <src/PlusDataCollection/PhidgetSpatialTracking/vtkPlusPhidgetSpatialTracker.h>

Inheritance diagram for vtkPlusPhidgetSpatialTracker:
Inheritance graph
[legend]
Collaboration diagram for vtkPlusPhidgetSpatialTracker:
Collaboration graph
[legend]

Public Types

typedef vtkPlusDevice Superclass
 
- Public Types inherited from vtkPlusDevice
typedef vtkImageAlgorithm Superclass
 

Public Member Functions

virtual const char * GetClassName ()
 
virtual int GetSerialNumber ()
 
PlusStatus InternalConnect ()
 
virtual PlusStatus InternalDisconnect ()
 
virtual int IsA (const char *type)
 
virtual bool IsResettable ()
 
virtual bool IsTracker () const
 
void PrintSelf (ostream &os, vtkIndent indent)
 
PlusStatus Probe ()
 
virtual PlusStatus ReadConfiguration (vtkXMLDataElement *config)
 
virtual PlusStatus Reset ()
 
virtual void SetSerialNumber (int)
 
virtual void SetZeroGyroscopeOnConnect (bool)
 
virtual PlusStatus WriteConfiguration (vtkXMLDataElement *config)
 
- Public Member Functions inherited from vtkPlusDevice
PlusStatus AddFieldDataSource (vtkPlusDataSource *aSource)
 
PlusStatus AddInputChannel (vtkPlusChannel *aChannel)
 
PlusStatus AddOutputChannel (vtkPlusChannel *aChannel)
 
PlusStatus AddTool (vtkPlusDataSource *tool, bool requireUniquePortName=true)
 
PlusStatus AddVideoSource (vtkPlusDataSource *anImage)
 
void ClearAllBuffers ()
 
virtual PlusStatus Connect ()
 
virtual PlusStatus CreateDefaultOutputChannel (const char *channelId=NULL, bool addSource=true)
 
void DeepCopy (const vtkPlusDevice &device)
 
virtual PlusStatus Disconnect ()
 
virtual PlusStatus ForceUpdate ()
 
virtual double GetAcquisitionRate () const
 
virtual PlusStatus GetBufferSize (vtkPlusChannel &aChannel, int &outVal, const std::string &aSourceId=std::string(""))
 
virtual int GetConnected () const
 
virtual bool GetCorrectlyConfigured () const
 
PlusStatus GetDataSource (const char *aSourceId, vtkPlusDataSource *&aSource)
 
PlusStatus GetDataSource (const std::string &aSourceId, vtkPlusDataSource *&aSource)
 
virtual double GetDesiredTimestamp ()
 
virtual std::string GetDeviceId () const
 
PlusStatus GetFieldDataSource (const char *aSourceId, vtkPlusDataSource *&aSource) const
 
PlusStatus GetFieldDataSource (const std::string &aSourceId, vtkPlusDataSource *&aSource) const
 
DataSourceContainerConstIterator GetFieldDataSourcessIteratorBegin () const
 
DataSourceContainerConstIterator GetFieldDataSourcessIteratorEnd () const
 
PlusStatus GetFirstActiveOutputVideoSource (vtkPlusDataSource *&aVideoSource)
 
PlusStatus GetFirstActiveTool (vtkPlusDataSource *&aTool) const
 
PlusStatus GetFirstOutputChannel (vtkPlusChannel *&aChannel)
 
PlusStatus GetFirstVideoSource (vtkPlusDataSource *&anImage)
 
virtual unsigned long GetFrameNumber () const
 
virtual double GetFrameTimeStamp () const
 
virtual PlusStatus GetImage (const std::string &requestedImageId, std::string &assignedImageId, const std::string &imageReferencFrameName, vtkImageData *imageData, vtkMatrix4x4 *ijkToReferenceTransform)
 
virtual PlusStatus GetImageMetaData (igsioCommon::ImageMetaDataList &imageMetaDataItems)
 
virtual US_IMAGE_TYPE GetImageType (vtkPlusChannel &aChannel)
 
PlusStatus GetInputDevices (std::vector< vtkPlusDevice * > &outDeviceList) const
 
PlusStatus GetInputDevicesRecursive (std::vector< vtkPlusDevice * > &outDeviceList) const
 
virtual PlusStatus GetInputFrameSize (vtkPlusChannel &aChannel, unsigned int &x, unsigned int &y, unsigned int &z) const
 
virtual PlusStatus GetInputFrameSize (vtkPlusChannel &aChannel, FrameSizeType &dim) const
 
double GetInternalUpdateRate () const
 
virtual double GetLocalTimeOffsetSec () const
 
double GetMissingInputGracePeriodSec () const
 
virtual int GetNumberOfFieldDataSources () const
 
virtual int GetNumberOfTools () const
 
virtual int GetNumberOfVideoSources () const
 
PlusStatus GetOutputChannelByName (vtkPlusChannel *&aChannel, const char *aChannelId)
 
PlusStatus GetOutputChannelByName (vtkPlusChannel *&aChannel, const std::string &aChannelId)
 
ChannelContainerConstIterator GetOutputChannelsEnd () const
 
ChannelContainerIterator GetOutputChannelsEnd ()
 
ChannelContainerConstIterator GetOutputChannelsStart () const
 
ChannelContainerIterator GetOutputChannelsStart ()
 
virtual PlusStatus GetOutputFrameSize (vtkPlusChannel &aChannel, unsigned int &x, unsigned int &y, unsigned int &z) const
 
virtual PlusStatus GetOutputFrameSize (vtkPlusChannel &aChannel, FrameSizeType &dim) const
 
virtual std::string GetParameter (const std::string &key) const
 
virtual PlusStatus GetParameter (const std::string &key, std::string &outValue) const
 
virtual igsioCommon::VTKScalarPixelType GetPixelType (vtkPlusChannel &aChannel)
 
virtual std::string GetSdkVersion ()
 
virtual double GetStartTime ()
 
virtual double GetTimestampClosestToDesired ()
 
PlusStatus GetTool (const char *aToolSourceId, vtkPlusDataSource *&aTool) const
 
PlusStatus GetTool (const std::string &aToolSourceId, vtkPlusDataSource *&aTool) const
 
PlusStatus GetToolByPortName (const char *aPortName, vtkPlusDataSource *&aSource)
 
PlusStatus GetToolByPortName (const std::string &aPortName, vtkPlusDataSource *&aSource)
 
DataSourceContainerConstIterator GetToolIteratorBegin () const
 
DataSourceContainerConstIterator GetToolIteratorEnd () const
 
std::string GetToolReferenceFrameName () const
 
virtual int GetUpdateWithDesiredTimestamp ()
 
PlusStatus GetVideoSource (const char *aSourceId, vtkPlusDataSource *&aVideoSource)
 
PlusStatus GetVideoSourceByIndex (const unsigned int index, vtkPlusDataSource *&aVideoSource)
 
DataSourceContainerConstIterator GetVideoSourceIteratorBegin () const
 
DataSourceContainerConstIterator GetVideoSourceIteratorEnd () const
 
std::vector< vtkPlusDataSource * > GetVideoSources () const
 
PlusStatus GetVideoSourcesByPortName (const char *aPortName, std::vector< vtkPlusDataSource * > &sources)
 
PlusStatus GetVideoSourcesByPortName (const std::string &aPortName, std::vector< vtkPlusDataSource * > &sources)
 
virtual PlusStatus InternalUpdate ()
 
virtual bool IsConnected () const
 
virtual bool IsRecording () const
 
virtual bool IsVirtual () const
 
virtual PlusStatus NotifyConfigured ()
 
virtual int OutputChannelCount () const
 
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *)
 
virtual int RequestInformation (vtkInformation *, vtkInformationVector **, vtkInformationVector *)
 
virtual PlusStatus SendText (const std::string &textToSend, std::string *textReceived=NULL)
 
PlusStatus SetAcquisitionRate (double aRate)
 
virtual PlusStatus SetBufferSize (vtkPlusChannel &aChannel, int FrameBufferSize, const std::string &aSourceId=std::string(""))
 
virtual void SetDataCollector (vtkPlusDataCollector *_arg)
 
virtual void SetDesiredTimestamp (double)
 
void SetDeviceId (const std::string &id)
 
void SetFieldDataSourcesBufferSize (int aBufferSize)
 
virtual PlusStatus SetImageType (vtkPlusChannel &aChannel, US_IMAGE_TYPE imageType)
 
virtual PlusStatus SetInputFrameSize (vtkPlusDataSource &aSource, unsigned int x, unsigned int y, unsigned int z)
 
virtual void SetLocalTimeOffsetSec (double aTimeOffsetSec)
 
virtual void SetMissingInputGracePeriodSec (double)
 
virtual PlusStatus SetParameter (const std::string &key, const std::string &value)
 
virtual PlusStatus SetPixelType (vtkPlusChannel &aChannel, igsioCommon::VTKScalarPixelType pixelType)
 
virtual void SetStartTime (double startTime)
 
void SetToolReferenceFrameName (const std::string &frameName)
 
void SetToolsBufferSize (int aBufferSize)
 
virtual void SetUpdateWithDesiredTimestamp (int)
 
virtual PlusStatus StartRecording ()
 
virtual PlusStatus StopRecording ()
 
virtual void UpdateWithDesiredTimestampOff ()
 
virtual void UpdateWithDesiredTimestampOn ()
 
virtual PlusStatus WriteToolsToSequenceFile (const std::string &filename, bool useCompression=false)
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkPlusPhidgetSpatialTrackerNew ()
 
static vtkPlusPhidgetSpatialTrackerSafeDownCast (vtkObject *o)
 
- Static Public Member Functions inherited from vtkPlusDevice
static PlusStatus GetToolReferenceFrameFromTrackedFrame (igsioTrackedFrame &aFrame, std::string &aToolReferenceFrameName)
 
static int IsTypeOf (const char *type)
 
static vtkPlusDeviceNew ()
 
static vtkPlusDeviceSafeDownCast (vtkObject *o)
 

Protected Member Functions

PlusStatus InternalStartRecording ()
 
PlusStatus InternalStopRecording ()
 
bool IsCompassCorrectionParametersDefined ()
 
virtual void SetAhrsAlgorithmGain (double, double)
 
void SetAhrsAlgorithmGain (double [2])
 
virtual void SetCompassCorrectionParameters (double data[])
 
virtual void SetFilteredTiltSensorAhrsAlgorithmGain (double, double)
 
void SetFilteredTiltSensorAhrsAlgorithmGain (double [2])
 
 vtkPlusPhidgetSpatialTracker ()
 
void ZeroGyroscope ()
 
 ~vtkPlusPhidgetSpatialTracker ()
 
- Protected Member Functions inherited from vtkPlusDevice
virtual PlusStatus AddVideoItemToVideoSources (const std::vector< vtkPlusDataSource * > &videoSources, const igsioVideoFrame &frame, long frameNumber, double unfilteredTimestamp=UNDEFINED_TIMESTAMP, double filteredTimestamp=UNDEFINED_TIMESTAMP, const igsioFieldMapType *customFields=NULL)
 
virtual PlusStatus AddVideoItemToVideoSources (const std::vector< vtkPlusDataSource * > &videoSources, void *imageDataPtr, US_IMAGE_ORIENTATION usImageOrientation, const FrameSizeType &frameSizeInPx, igsioCommon::VTKScalarPixelType pixelType, unsigned int numberOfScalarComponents, US_IMAGE_TYPE imageType, int numberOfBytesToSkip, long frameNumber, double unfilteredTimestamp=UNDEFINED_TIMESTAMP, double filteredTimestamp=UNDEFINED_TIMESTAMP, const igsioFieldMapType *customFields=NULL)
 
PlusStatus EnsureUniqueDataSourceId (const std::string &aSourceId)
 
vtkXMLDataElement * FindInputChannelElement (vtkXMLDataElement *rootXMLElement, const char *aChannelId)
 
vtkXMLDataElement * FindOutputChannelElement (vtkXMLDataElement *rootXMLElement, const char *aChannelId)
 
vtkXMLDataElement * FindThisDeviceElement (vtkXMLDataElement *rootXMLElement)
 
virtual vtkPlusDataCollectorGetDataCollector ()
 
double GetRecordingStartTime () const
 
bool GetStartThreadForInternalUpdates () const
 
bool HasGracePeriodExpired ()
 
virtual void InternalWriteInputChannels (vtkXMLDataElement *rootXMLElement)
 
virtual void InternalWriteOutputChannels (vtkXMLDataElement *rootXMLElement)
 
virtual void SetCorrectlyConfigured (bool)
 
virtual void SetRecordingStartTime (double)
 
virtual void SetStartThreadForInternalUpdates (bool)
 
virtual PlusStatus ToolTimeStampedUpdate (const std::string &aToolSourceId, vtkMatrix4x4 *matrix, ToolStatus status, unsigned long frameNumber, double unfilteredtimestamp, const igsioFieldMapType *customFields=NULL)
 
virtual PlusStatus ToolTimeStampedUpdateWithoutFiltering (const std::string &aToolSourceId, vtkMatrix4x4 *matrix, ToolStatus status, double unfilteredtimestamp, double filteredtimestamp, const igsioFieldMapType *customFields=NULL)
 
 vtkPlusDevice ()
 
virtual ~vtkPlusDevice ()
 

Friends

class PhidgetSpatialCallbackClass
 

Additional Inherited Members

- Public Attributes inherited from vtkPlusDevice
double InternalUpdateRate
 
vtkIGSIORecursiveCriticalSection * UpdateMutex
 
vtkTimeStamp UpdateTime
 
- Static Public Attributes inherited from vtkPlusDevice
static const std::string BMODE_PORT_NAME = "B"
 
static const std::string PARAMETER_XML_ELEMENT_TAG = "Parameter"
 
static const std::string PARAMETERS_XML_ELEMENT_TAG = "Parameters"
 
static const std::string RFMODE_PORT_NAME = "Rf"
 
- Static Protected Member Functions inherited from vtkPlusDevice
static void * vtkDataCaptureThread (vtkMultiThreader::ThreadInfo *data)
 
- Protected Attributes inherited from vtkPlusDevice
double AcquisitionRate
 
int Connected
 
bool CorrectlyConfigured
 
StreamBufferItemCurrentStreamBufferItem
 
vtkPlusDataCollectorDataCollector
 
double DesiredTimestamp
 
std::string DeviceId
 
DataSourceContainer Fields
 
unsigned long FrameNumber
 
double FrameTimeStamp
 
ChannelContainer InputChannels
 
double LocalTimeOffsetSec
 
double MissingInputGracePeriodSec
 
ChannelContainer OutputChannels
 
int OutputNeedsInitialization
 
std::map< std::string, std::string > Parameters
 
int Recording
 
double RecordingStartTime
 
std::set< std::string > ReportedUnknownTools
 
bool RequireImageOrientationInConfiguration
 
bool RequirePortNameInDeviceSetConfiguration
 
bool StartThreadForInternalUpdates
 
bool ThreadAlive
 
vtkMultiThreader * Threader
 
int ThreadId
 
double TimestampClosestToDesired
 
std::string ToolReferenceFrameName
 
DataSourceContainer Tools
 
int UpdateWithDesiredTimestamp
 
DataSourceContainer VideoSources
 
- Static Protected Attributes inherited from vtkPlusDevice
static const int VIRTUAL_DEVICE_FRAME_RATE = 50
 

Detailed Description

Interface for the Phidget 3/3/3 tracker.

This class talks with PhidgetSpatial 3/3/3 accelerometer/magnetometer/gyroscope device.

Tracker coordinate system: South-West-Down.

Sensor coordinate system is drawn on the sensor PCB. If the PCB is laying flat on the table with cable socket towards East then the axis directions are: South-West-Down.

Tools: Accelerometer, Gyroscope, Magnetometer: Raw sensor measurements. The values are stored in the translation part of the transformation matrix. The rotation part is identity. TiltSensor: 2-DOF sensor tilt is computed as a rotation matrix. Only the accelerometer is used. FilteredTiltSensor: Modifies OrientationSensor output, with one axis constrained to always point west. Used to constrain rotational error around the Z axis. OrientationSensor: 3-DOF sensor orientation is computed using sensor fusion. With ...IMU algorithm only the accelerometer and gyroscope data are used. With ...AHRS algorithm accelerometer, gyroscope, and magnetometer data are used.

Gyroscope zeroing is performed automatically at device connect, therefore the sensor shall not be moved for 2 seconds after the vtkPlusPhidgetSpatialTracker::Connect() call if the OrientationSensor or Accelerometer tool is used.

AHRS algorithm gain values: The Madgwick method uses only one parameter (beta). A value of 1.0 works well at 125Hz. The Mahony method uses two parameters (proportional and integral). A value of proportional=15.0, integral=1.0 work well at 125Hz.

If magnetic fields nearby the sensor have non-negligible effect then compass can be ignored by choosing an ..._IMU AHRS algorithm (as opposed to ..._MARG) or compass correction may be performed (see http://www.phidgets.com/docs/Compass_Primer). If compass correction parameters cannot be stored in the device flash then they should be set in vtkPlusPhidgetSpatialTracker::Connect().

The magnetometer has an internal calibration mechanism, which is running continuously. During this internal calibration no measurement data can be retrieved from the magnetometer. When magnetometer data is not available then the associated tool status is set to INVALID.

Definition at line 58 of file vtkPlusPhidgetSpatialTracker.h.

Member Typedef Documentation

◆ Superclass

Definition at line 63 of file vtkPlusPhidgetSpatialTracker.h.

Constructor & Destructor Documentation

◆ vtkPlusPhidgetSpatialTracker()

vtkPlusPhidgetSpatialTracker::vtkPlusPhidgetSpatialTracker ( )
protected

Definition at line 206 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ ~vtkPlusPhidgetSpatialTracker()

vtkPlusPhidgetSpatialTracker::~vtkPlusPhidgetSpatialTracker ( )
protected

Definition at line 256 of file vtkPlusPhidgetSpatialTracker.cxx.

Member Function Documentation

◆ GetClassName()

virtual const char* vtkPlusPhidgetSpatialTracker::GetClassName ( )
virtual

Reimplemented from vtkPlusDevice.

◆ GetSerialNumber()

virtual int vtkPlusPhidgetSpatialTracker::GetSerialNumber ( )
virtual

◆ InternalConnect()

PlusStatus vtkPlusPhidgetSpatialTracker::InternalConnect ( )
virtual

Connect to device

Reimplemented from vtkPlusDevice.

Definition at line 319 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ InternalDisconnect()

PlusStatus vtkPlusPhidgetSpatialTracker::InternalDisconnect ( )
virtual

Disconnect from device

Reimplemented from vtkPlusDevice.

Definition at line 463 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ InternalStartRecording()

PlusStatus vtkPlusPhidgetSpatialTracker::InternalStartRecording ( )
protectedvirtual

Start the tracking system. The tracking system is brought from its ground state into full tracking mode. The device will only be reset if communication cannot be established without a reset.

Reimplemented from vtkPlusDevice.

Definition at line 488 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ InternalStopRecording()

PlusStatus vtkPlusPhidgetSpatialTracker::InternalStopRecording ( )
protectedvirtual

Stop the tracking system and bring it back to its ground state: Initialized, not tracking, at 9600 Baud.

Reimplemented from vtkPlusDevice.

Definition at line 495 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ IsA()

virtual int vtkPlusPhidgetSpatialTracker::IsA ( const char *  type)
virtual

Reimplemented from vtkPlusDevice.

◆ IsCompassCorrectionParametersDefined()

bool vtkPlusPhidgetSpatialTracker::IsCompassCorrectionParametersDefined ( )
protected

Returns true if compass correction parameters are defined (any of the parameters is non-zero)

Definition at line 757 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ IsResettable()

bool vtkPlusPhidgetSpatialTracker::IsResettable ( )
virtual

Return whether or not the device can be reset

Reimplemented from vtkPlusDevice.

Definition at line 728 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ IsTracker()

virtual bool vtkPlusPhidgetSpatialTracker::IsTracker ( ) const
inlinevirtual

Is this device a tracker

Reimplemented from vtkPlusDevice.

Definition at line 66 of file vtkPlusPhidgetSpatialTracker.h.

◆ IsTypeOf()

static int vtkPlusPhidgetSpatialTracker::IsTypeOf ( const char *  type)
static

◆ New()

static vtkPlusPhidgetSpatialTracker* vtkPlusPhidgetSpatialTracker::New ( )
static

◆ PrintSelf()

void vtkPlusPhidgetSpatialTracker::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
virtual

Reimplemented from vtkPlusDevice.

Definition at line 277 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ Probe()

PlusStatus vtkPlusPhidgetSpatialTracker::Probe ( )
virtual

Probe to see if the tracking system is present on the specified serial port.

Reimplemented from vtkPlusDevice.

Definition at line 480 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ ReadConfiguration()

PlusStatus vtkPlusPhidgetSpatialTracker::ReadConfiguration ( vtkXMLDataElement *  config)
virtual

Read configuration from xml data

Reimplemented from vtkPlusDevice.

Definition at line 502 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ Reset()

PlusStatus vtkPlusPhidgetSpatialTracker::Reset ( )
virtual

Reset the device

Reimplemented from vtkPlusDevice.

Definition at line 734 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ SafeDownCast()

static vtkPlusPhidgetSpatialTracker* vtkPlusPhidgetSpatialTracker::SafeDownCast ( vtkObject *  o)
static

◆ SetAhrsAlgorithmGain() [1/2]

virtual void vtkPlusPhidgetSpatialTracker::SetAhrsAlgorithmGain ( double  ,
double   
)
protectedvirtual

◆ SetAhrsAlgorithmGain() [2/2]

void vtkPlusPhidgetSpatialTracker::SetAhrsAlgorithmGain ( double  [2])
protected

◆ SetCompassCorrectionParameters()

virtual void vtkPlusPhidgetSpatialTracker::SetCompassCorrectionParameters ( double  data[])
protectedvirtual

◆ SetFilteredTiltSensorAhrsAlgorithmGain() [1/2]

virtual void vtkPlusPhidgetSpatialTracker::SetFilteredTiltSensorAhrsAlgorithmGain ( double  ,
double   
)
protectedvirtual

◆ SetFilteredTiltSensorAhrsAlgorithmGain() [2/2]

void vtkPlusPhidgetSpatialTracker::SetFilteredTiltSensorAhrsAlgorithmGain ( double  [2])
protected

◆ SetSerialNumber()

virtual void vtkPlusPhidgetSpatialTracker::SetSerialNumber ( int  )
virtual

Serial number of the hardware device that will be connected

◆ SetZeroGyroscopeOnConnect()

virtual void vtkPlusPhidgetSpatialTracker::SetZeroGyroscopeOnConnect ( bool  )
virtual

◆ WriteConfiguration()

PlusStatus vtkPlusPhidgetSpatialTracker::WriteConfiguration ( vtkXMLDataElement *  config)
virtual

Write configuration to xml data

Reimplemented from vtkPlusDevice.

Definition at line 622 of file vtkPlusPhidgetSpatialTracker.cxx.

◆ ZeroGyroscope()

void vtkPlusPhidgetSpatialTracker::ZeroGyroscope ( )
protected

Determine the gyroscope sensors offset by integrating the gyroscope values for 2 seconds while the sensor is stationary. The offset may slightly change as the temperature of the sensor changes.

Definition at line 721 of file vtkPlusPhidgetSpatialTracker.cxx.

Friends And Related Function Documentation

◆ PhidgetSpatialCallbackClass

friend class PhidgetSpatialCallbackClass
friend

Definition at line 102 of file vtkPlusPhidgetSpatialTracker.h.


The documentation for this class was generated from the following files: