NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
niftk::IGIDataSourceManager Class Reference

Class to manage a list of IGIDataSources (trackers, ultra-sound machines, video etc). More...

Inheritance diagram for niftk::IGIDataSourceManager:
Inheritance graph
[legend]
Collaboration diagram for niftk::IGIDataSourceManager:
Collaboration graph
[legend]

Signals

void UpdateFinishedDataSources (niftk::IGIDataType::IGITimeType, QList< QList< IGIDataItemInfo > >)
 Emmitted when this manager has asked each data source to update, and they have all updated. More...
 
void UpdateFinishedRendering ()
 Emmitted when this manager has called for rendering to be updated, and that call has completed. More...
 
void PlaybackTimerAdvanced (int sliderValue)
 When playing back, this class calculates the next time step, and broadcasts what the corresponding slider value should be. More...
 
void TimerUpdated (QString rawTimeStamp, QString humanReadableTimeStamp)
 Manager emits the time, to update the GUI. More...
 
void BroadcastStatusString (QString)
 This manager will broadcast status messages to anyone listening. More...
 

Public Member Functions

 IGIDataSourceManager (mitk::DataStorage::Pointer dataStorage, QObject *parent)
 
virtual ~IGIDataSourceManager ()
 
bool IsPlayingBack () const
 Returns true if the manager is currently playing back, and false otherwise. More...
 
bool IsPlayingBackAutomatically () const
 Returns true if the manager is playing back automatically, and false otherwise. More...
 
bool IsUpdateTimerOn () const
 Returns true if the update timer is on, and false otherwise. More...
 
void SetIsPlayingBackAutomatically (bool isPlayingBackAutomatically)
 Sets a flag, then the internal clock triggering will also advance the playback time such that the manager will automatically creep forward through time. More...
 
void StopUpdateTimer ()
 Stops the internal timer. More...
 
void StartUpdateTimer ()
 Starts the internal timer. More...
 
QString GetDirectoryName ()
 Gets a suitable directory name from a prefix determined by preferences, and a date-time stamp. More...
 
void SetDirectoryPrefix (const QString &directoryPrefix)
 Sets the base directory into which all recording sessions will be saved. More...
 
void SetFramesPerSecond (const int &framesPerSecond)
 Sets the update rate, effectively the number of times per second the internal timer ticks, and the number of times the mitk::RenderingManager is asked to update. More...
 
int GetFramesPerSecond () const
 Returns the frame rate. More...
 
void WriteDescriptorFile (QString absolutePath)
 Writes the descriptor file for a recording session. More...
 
QList< QString > GetAllFactoryNames () const
 Retrieves the name of all the available data source factory names. More...
 
bool NeedsStartupGui (QString name)
 When creating sources, some will need configuring (e.g. port number). So, given the display name of a data source (string in combo-box in GUI), will return true if the manager can create a GUI for you to configure the service. More...
 
void AddSource (QString name, QMap< QString, QVariant > &properties)
 Adds a source, using the display name of a factory, and configures it with the provided properties. More...
 
void RemoveSource (int rowIndex)
 Removes a source at a given rowIndex. More...
 
void RemoveAllSources ()
 Removes all sources. More...
 
void StartRecording (QString absolutePath)
 Starts a new recording session, writing to the folder given by the absolutePath. More...
 
void StopRecording ()
 Stops the recording process. More...
 
void FreezeAllDataSources (bool isFrozen)
 Freezes the data sources (i.e. does not do update). More...
 
void FreezeDataSource (unsigned int i, bool isFrozen)
 Freezes individual data sources (i.e. does not do update). More...
 
bool IsFrozen (unsigned int i) const
 Returns true if data source i is frozen and false otherwise. More...
 
void StartPlayback (const QString &directoryPrefix, const QString &descriptorPath, IGIDataType::IGITimeType &startTime, IGIDataType::IGITimeType &endTime, int &sliderMax, int &sliderSingleStep, int &sliderPageStep, int &sliderValue)
 Sets the manager ready for playback. More...
 
void StopPlayback ()
 Stops all sources playing back. More...
 
int ComputePlaybackTimeSliderValue (QString textEditField) const
 Takes a string time field and computes the corresponding slider value. More...
 
IGIDataType::IGITimeType ComputeTimeFromSlider (int sliderValue) const
 If the user moves the time slider, we calculate a corresponding time. More...
 
void SetPlaybackTime (const IGIDataType::IGITimeType &time)
 Sets the current time of the manager to time, and the next available update pulse will trigger a refresh. More...
 
void SetIsGrabbingScreen (QString directoryName, bool isGrabbing)
 Requests the manager to grab the currently focussed screen. More...
 
niftk::IGIDataSourceFactoryServiceIGetFactory (QString name)
 Retrieves a factory given the display name. More...
 
niftk::IGIDataSourceFactoryServiceIGetFactory (int rowNumber)
 Returns the factory given the row number in the GUI which should correspond to the order of the source in this manager. More...
 
niftk::IGIDataSourceI::Pointer GetSource (int rowNumber)
 Returns the actual source. More...
 
void GlobalReInit ()
 Performs a global re-init. More...
 

Static Public Member Functions

static QString GetDefaultPath ()
 Returns a default path, to somewhere writable, like the desktop. More...
 

Static Public Attributes

static const int DEFAULT_FRAME_RATE = 20
 
static const char * DEFAULT_RECORDINGDESTINATION_ENVIRONMENTVARIABLE = "NIFTK_IGIDATASOURCES_DEFAULTRECORDINGDESTINATION"
 

Protected Member Functions

 IGIDataSourceManager (const IGIDataSourceManager &)
 
IGIDataSourceManageroperator= (const IGIDataSourceManager &)
 

Detailed Description

Class to manage a list of IGIDataSources (trackers, ultra-sound machines, video etc).

This class should not contain Widget related stuff, so we can instantiate it directly in any class, or a command line app or something without a GUI. It can still derive from QObject, so that we have the benefit of signals and slots.

Note: All errors should be thrown as mitk::Exception or sub-class thereof.

Constructor & Destructor Documentation

niftk::IGIDataSourceManager::IGIDataSourceManager ( mitk::DataStorage::Pointer  dataStorage,
QObject *  parent 
)
niftk::IGIDataSourceManager::~IGIDataSourceManager ( )
virtual
niftk::IGIDataSourceManager::IGIDataSourceManager ( const IGIDataSourceManager )
protected

Member Function Documentation

void niftk::IGIDataSourceManager::AddSource ( QString  name,
QMap< QString, QVariant > &  properties 
)

Adds a source, using the display name of a factory, and configures it with the provided properties.

void niftk::IGIDataSourceManager::BroadcastStatusString ( QString  )
signal

This manager will broadcast status messages to anyone listening.

int niftk::IGIDataSourceManager::ComputePlaybackTimeSliderValue ( QString  textEditField) const

Takes a string time field and computes the corresponding slider value.

IGIDataType::IGITimeType niftk::IGIDataSourceManager::ComputeTimeFromSlider ( int  sliderValue) const

If the user moves the time slider, we calculate a corresponding time.

void niftk::IGIDataSourceManager::FreezeAllDataSources ( bool  isFrozen)

Freezes the data sources (i.e. does not do update).

Does not affect the saving of data. The data source can continue to grab data, and save it, as it feels like.

void niftk::IGIDataSourceManager::FreezeDataSource ( unsigned int  i,
bool  isFrozen 
)

Freezes individual data sources (i.e. does not do update).

Does not affect the saving of data. The data source can continue to grab data, and save it, as it feels like.

QList< QString > niftk::IGIDataSourceManager::GetAllFactoryNames ( ) const

Retrieves the name of all the available data source factory names.

The returned list is the display name, as shown in the GUI, e.g. "OpenCV Frame Grabber", and these strings are created in each data sources factory class.

QString niftk::IGIDataSourceManager::GetDefaultPath ( )
static

Returns a default path, to somewhere writable, like the desktop.

QString niftk::IGIDataSourceManager::GetDirectoryName ( )

Gets a suitable directory name from a prefix determined by preferences, and a date-time stamp.

niftk::IGIDataSourceFactoryServiceI * niftk::IGIDataSourceManager::GetFactory ( QString  name)

Retrieves a factory given the display name.

niftk::IGIDataSourceFactoryServiceI * niftk::IGIDataSourceManager::GetFactory ( int  rowNumber)

Returns the factory given the row number in the GUI which should correspond to the order of the source in this manager.

int niftk::IGIDataSourceManager::GetFramesPerSecond ( ) const

Returns the frame rate.

niftk::IGIDataSourceI::Pointer niftk::IGIDataSourceManager::GetSource ( int  rowNumber)

Returns the actual source.

void niftk::IGIDataSourceManager::GlobalReInit ( )

Performs a global re-init.

bool niftk::IGIDataSourceManager::IsFrozen ( unsigned int  i) const

Returns true if data source i is frozen and false otherwise.

bool niftk::IGIDataSourceManager::IsPlayingBack ( ) const

Returns true if the manager is currently playing back, and false otherwise.

bool niftk::IGIDataSourceManager::IsPlayingBackAutomatically ( ) const

Returns true if the manager is playing back automatically, and false otherwise.

bool niftk::IGIDataSourceManager::IsUpdateTimerOn ( ) const

Returns true if the update timer is on, and false otherwise.

bool niftk::IGIDataSourceManager::NeedsStartupGui ( QString  name)

When creating sources, some will need configuring (e.g. port number). So, given the display name of a data source (string in combo-box in GUI), will return true if the manager can create a GUI for you to configure the service.

IGIDataSourceManager& niftk::IGIDataSourceManager::operator= ( const IGIDataSourceManager )
protected
void niftk::IGIDataSourceManager::PlaybackTimerAdvanced ( int  sliderValue)
signal

When playing back, this class calculates the next time step, and broadcasts what the corresponding slider value should be.

void niftk::IGIDataSourceManager::RemoveAllSources ( )

Removes all sources.

This stops the timer, and removes all sources, after which there is no point restarting the timer, so a side effect is that the timer should be off.

void niftk::IGIDataSourceManager::RemoveSource ( int  rowIndex)

Removes a source at a given rowIndex.

This will stop the timer, and if, after removing the specified source there are still sources to continue updating, will restart the timer.

void niftk::IGIDataSourceManager::SetDirectoryPrefix ( const QString &  directoryPrefix)

Sets the base directory into which all recording sessions will be saved.

This is normally set via a GUI preference, so remains unchanged as each recording session is recorded into a new sub-directory within this directory.

void niftk::IGIDataSourceManager::SetFramesPerSecond ( const int framesPerSecond)

Sets the update rate, effectively the number of times per second the internal timer ticks, and the number of times the mitk::RenderingManager is asked to update.

void niftk::IGIDataSourceManager::SetIsGrabbingScreen ( QString  directoryName,
bool  isGrabbing 
)

Requests the manager to grab the currently focussed screen.

void niftk::IGIDataSourceManager::SetIsPlayingBackAutomatically ( bool  isPlayingBackAutomatically)

Sets a flag, then the internal clock triggering will also advance the playback time such that the manager will automatically creep forward through time.

void niftk::IGIDataSourceManager::SetPlaybackTime ( const IGIDataType::IGITimeType time)

Sets the current time of the manager to time, and the next available update pulse will trigger a refresh.

void niftk::IGIDataSourceManager::StartPlayback ( const QString &  directoryPrefix,
const QString &  descriptorPath,
IGIDataType::IGITimeType startTime,
IGIDataType::IGITimeType endTime,
int sliderMax,
int sliderSingleStep,
int sliderPageStep,
int sliderValue 
)

Sets the manager ready for playback.

Parameters
directoryPrefixpath to the root folder of the recording session
descriptorPathpath to a descriptor to parse.
startTimereturns the minimum of start times of all available data sources.
endTimereturns the maximum of end times of all available data sources.

Here, the user must have created the right data sources. The reason is that each data-source might need configuring each time you set up the system. e.g. An Aurora tracker might be connected to a specific COM port. These configurations might be different between record and playback.

void niftk::IGIDataSourceManager::StartRecording ( QString  absolutePath)

Starts a new recording session, writing to the folder given by the absolutePath.

void niftk::IGIDataSourceManager::StartUpdateTimer ( )

Starts the internal timer.

If there are no sources, this does nothing.

void niftk::IGIDataSourceManager::StopPlayback ( )

Stops all sources playing back.

void niftk::IGIDataSourceManager::StopRecording ( )

Stops the recording process.

void niftk::IGIDataSourceManager::StopUpdateTimer ( )

Stops the internal timer.

void niftk::IGIDataSourceManager::TimerUpdated ( QString  rawTimeStamp,
QString  humanReadableTimeStamp 
)
signal

Manager emits the time, to update the GUI.

void niftk::IGIDataSourceManager::UpdateFinishedDataSources ( niftk::IGIDataType::IGITimeType  ,
QList< QList< IGIDataItemInfo > >   
)
signal

Emmitted when this manager has asked each data source to update, and they have all updated.

void niftk::IGIDataSourceManager::UpdateFinishedRendering ( )
signal

Emmitted when this manager has called for rendering to be updated, and that call has completed.

(This doesn't mean that the rendering has actually happened. That depends on the mitk::RenderingManager).

void niftk::IGIDataSourceManager::WriteDescriptorFile ( QString  absolutePath)

Writes the descriptor file for a recording session.

This descriptor is then used to reconstruct the right number of data sources when you playback.

Member Data Documentation

const int niftk::IGIDataSourceManager::DEFAULT_FRAME_RATE = 20
static
const char * niftk::IGIDataSourceManager::DEFAULT_RECORDINGDESTINATION_ENVIRONMENTVARIABLE = "NIFTK_IGIDATASOURCES_DEFAULTRECORDINGDESTINATION"
static

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