Controller Class Reference
[Controller]

The main application control. More...

#include <controller.h>

Inherits QObject.

Collaboration diagram for Controller:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::string dataset_key_type

Public Slots

void datasetChangedSlot (dataset_key_type const &dataset_key)

Public Member Functions

std::pair< dataset_key_type,
dataset_type
loadDataset (std::string filename) throw (FormatNotSupportedException, NullPointerException)
void writeDataset (dataset_key_type dataset_key, std::string filename) throw (DatasetNotFoundException, FormatNotSupportedException)
bool removeDataset (dataset_key_type dataset_key)
std::string const & getDatasetFilename (dataset_key_type dataset_key) throw (DatasetNotFoundException)
void getLoadedDatasetKeys (std::vector< dataset_key_type > &key_container) const
dataset_pointer_type getDataset (dataset_key_type dataset_key) const throw (DatasetNotFoundException)
metadata_pointer_type getMetadataFor (dataset_key_type dataset_key) const throw (DatasetNotFoundException, NullPointerException)
void getDatasetKeysOfType (dataset_type type, dataset_key_container_type &dataset_key_container) throw (NullPointerException)
void getDatasetKeysOfTypes (AlgorithmDefinition::accepted_datasets_type types, dataset_key_container_type &dataset_key_container) throw (NullPointerException)
view_pointer_type getViewOfDataset (view_type type, dataset_key_type dataset_key) throw (DatasetNotFoundException)
void getDependentViewIDsOfDataset (dataset_key_type dataset_key, view_id_container_type &target_container) const throw (DatasetNotFoundException, NullPointerException)
view_type getViewTypeForDatasetSlice (dataset_key_type dataset_key, slice_type slice) throw (DatasetNotFoundException)
slice_type getDatasetSliceForViewType (dataset_key_type dataset_key, view_type type) throw (DatasetNotFoundException)
void deleteViews (view_id_container_type view_ids) throw (NullPointerException)
void loadConfiguration (std::string config_file_name)
algorithm_name_container_type getLoadedAlgorithmNames () const
AlgorithmConfig::algorithm_definition_pointer_type getAlgorithmDefinition (std::string name) const throw (AlgorithmNotFoundException)
void runAlgorithm (std::string key, configuration_pointer_type algorithm_config) throw (AlgorithmNotFoundException, NullPointerException)
config_widget_pointer_type createConfigWidget (std::string key) const throw (AlgorithmNotFoundException, NullPointerException)
configuration_pointer_type createConfiguration (std::string key) const throw (AlgorithmNotFoundException, NullPointerException)
void loadAlgorithm (std::string name) throw (AlgorithmNotFoundException)
bool isAlgorithmLoaded (std::string name)
metadata_pointer_type getMetadataForDataset (std::string dataset_key) const throw (DatasetNotFoundException, NullPointerException)
void setGuiInteractionMode (gui_interaction_mode_type gui_interaction_mode)
gui_interaction_mode_type getGuiInteractionMode ()
void setInputDatasetsInConfiguration (configuration_pointer_type configuration, config_dataset_id_to_input_map_type input_datasets, std::map< config_dataset_id_type, std::pair< dataset_key_type, dataset_type > > &new_dataset_keys_and_types) throw (NullPointerException, DatasetNotFoundException, InvalidCastException)
void setOutputDatasetsInConfiguration (configuration_pointer_type configuration, config_dataset_id_to_output_map_type output_datasets, std::map< config_dataset_id_type, std::pair< dataset_key_type, dataset_type > > &new_dataset_keys_and_types) throw (NullPointerException)

Static Public Member Functions

static ControllergetInstance ()

Detailed Description

The main application control.

The controller implements the core application logic. It represents the interface between the graphical user interface and the core application. The Controller is implmented as a singleton to be accessible from anywhere in the application.

Author:
Tobias Gross (tobias.gross@imedgine.org)

Christian Koerner (christian.koerner@imedgine.org)

Alexander Lex (alexander.lex@imedgine.org)

Marc Streit (marc.streit@imedgine.org)

Martin Reininger (martin.reininger@imedgine.org)

Definition at line 65 of file controller.h.


Member Typedef Documentation

typedef std::string dataset_key_type
 

the type describing a dataset key

Definition at line 75 of file controller.h.


Member Function Documentation

configuration_pointer_type createConfiguration std::string  key  )  const throw (AlgorithmNotFoundException, NullPointerException)
 

Creates a configuration object and returns a smart pointer to it

Parameters:
key the key the widget's prototype is stored under
Returns:
a pointer to a Configuration object
Exceptions:
AlgorithmNotFoundException if the algorithm/widget config info could not be found

config_widget_pointer_type createConfigWidget std::string  key  )  const throw (AlgorithmNotFoundException, NullPointerException)
 

Creates a configuration widget object and returns a smart pointer to it

Parameters:
key the key the widget's prototype is stored under
Returns:
a pointer to a configwidget
Exceptions:
AlgorithmNotFoundException if the algorithm/widget config info could not be found

Definition at line 482 of file controller.cpp.

References ConfigWidget::setConfiguration().

Here is the call graph for this function:

void datasetChangedSlot dataset_key_type const &  dataset_key  )  [slot]
 

Slot that handles changes to the dataset with the given key. Triggers view updates.

Returns:
The unique key of the dataset as returned by load dataset

Definition at line 796 of file controller.cpp.

References DataViewMediator::updateDataChanged().

void deleteViews view_id_container_type  view_ids  )  throw (NullPointerException)
 

Delete a set of views registered in the data view mediator

Parameters:
view_ids The unique ids of the views to delete

Definition at line 325 of file controller.cpp.

Referenced by ViewContainerWidget::~ViewContainerWidget().

AlgorithmConfig::algorithm_definition_pointer_type getAlgorithmDefinition std::string  name  )  const throw (AlgorithmNotFoundException)
 

Get the definition from configuration of algorithm with a certain name.

Parameters:
name the algorithm's name
Returns:
the algorithm definition
Exceptions:
AlgorithmNotFoundException if the algorithm was not present in the factory

Definition at line 434 of file controller.cpp.

dataset_pointer_type getDataset dataset_key_type  dataset_key  )  const throw (DatasetNotFoundException)
 

Return a pointer to the dataset with the given key

Parameters:
dataset_key The key that identifies the dataset (as returned by loadDataset)
Returns:
A pointer to the dataset
Exceptions:
DatasetNotFoundException Thrown if the given dataset key does not identify an available dataset

Definition at line 151 of file controller.cpp.

std::string const & getDatasetFilename dataset_key_type  dataset_key  )  throw (DatasetNotFoundException)
 

Returns the filename the dataset associated with the given key has been read from. If the dataset was created by the application an empty string is returned.

Parameters:
dataset_key The unique key of the dataset to get the filename from
Exceptions:
DatasetNotFoundException Thrown if the given key does not identify an available dataset

Definition at line 124 of file controller.cpp.

void getDatasetKeysOfType dataset_type  type,
dataset_key_container_type dataset_key_container
throw (NullPointerException)
 

Returns the keys of all datasets of the given dataset type

Parameters:
type The dataset type

Definition at line 186 of file controller.cpp.

void getDatasetKeysOfTypes AlgorithmDefinition::accepted_datasets_type  types,
dataset_key_container_type dataset_key_container
throw (NullPointerException)
 

Returns the keys of all datasets of the given dataset types

Parameters:
types The container of dataset types
dataset_key_container a reference to a container capable of holding the dataset keys

Definition at line 207 of file controller.cpp.

slice_type getDatasetSliceForViewType dataset_key_type  dataset_key,
view_type  type
throw (DatasetNotFoundException)
 

Return the type dataset slice (one of AXIAL_SLICE, CORONAL_SLICE, SAGATTAL_SLICE) that is associated with the given view type (XY_SLICE_VIEW, XZ_SLICE_VIEW or YZ_SLICE_VIEW) for the given dataset. NOTE: For analyze datasets this is always (XY - axial, XZ - sagittal, YZ - coronal). For dicom datasets this may vary.

Parameters:
dataset_key The key of the dataset
type The type of view (XY_SLICE_VIEW, XZ_SLICE_VIEW or YZ_SLICE_VIEW)
Returns:
The dataset slice type (one of AXIAL_SLICE, CORONAL_SLICE, SAGATTAL_SLICE)
Exceptions:
DatasetNotFoundException Thrown if the given dataset key does not identify an available dataset

Definition at line 290 of file controller.cpp.

void getDependentViewIDsOfDataset dataset_key_type  dataset_key,
view_id_container_type target_container
const throw (DatasetNotFoundException, NullPointerException)
 

Return the IDs of all dependent views ot the given dataset

Parameters:
dataset_key The key that identifies the dataset (as returned by loadDataset)
target_container A container to store the view ids in
Exceptions:
DatasetNotFoundException Thrown if the given dataset key does not identify an available dataset

Definition at line 238 of file controller.cpp.

Referenced by TabOrganizer::closeTab().

gui_interaction_mode_type getGuiInteractionMode  ) 
 

Retrieve the current gui interaction mode

Returns:
the current gui interaction mode

Definition at line 524 of file controller.cpp.

Controller & getInstance  )  [static]
 

Returns the singleton instance ot the Controller

Returns:
The unique controller instance

Definition at line 57 of file controller.cpp.

Referenced by DatasetConfigurationTabWidget::addDatasetConfigurationTab(), ImedgineSliceViewer::buildPopupMenu(), TabOrganizer::closeTab(), ImedgineSliceViewer::menuSelection(), AlgorithmWidget::okPressed(), TabOrganizer::openOverviewForImage(), TabOrganizer::openOverviewForVolume(), ChooseViewsDialog::show(), and ViewContainerWidget::~ViewContainerWidget().

algorithm_name_container_type getLoadedAlgorithmNames  )  const
 

A multimap of the names of all loaded algorithms, key is the algorithm classification

Returns:
multimap of all loaded algorithm names

Definition at line 350 of file controller.cpp.

void getLoadedDatasetKeys std::vector< dataset_key_type > &  key_container  )  const
 

Write the keys of all loaded datasets into the container given as parameter

Parameters:
key_container The container to write the keys to

Definition at line 139 of file controller.cpp.

Referenced by ImedgineSliceViewer::buildPopupMenu(), ImedgineSliceViewer::menuSelection(), and ChooseViewsDialog::show().

metadata_pointer_type getMetadataFor dataset_key_type  dataset_key  )  const throw (DatasetNotFoundException, NullPointerException)
 

Return a pointer to the metadata of the dataset with the given key

Parameters:
dataset_key The key that identifies the dataset (as returned by loadDataset)
Returns:
A pointer to the metadata of the dataset
Exceptions:
DatasetNotFoundException Thrown if the given dataset key does not identify an available dataset

Definition at line 166 of file controller.cpp.

metadata_pointer_type getMetadataForDataset std::string  dataset_key  )  const throw (DatasetNotFoundException, NullPointerException)
 

Retrieve the metadata for a given dataset

Parameters:
dataset_key the key the dataset is stored under in session
Returns:
a smart pointer to a metadata type
Exceptions:
DatasetNotFoundException Thrown if the given dataset key does not identify an available dataset
NullPointerException in case something goes seriously wrong

Definition at line 494 of file controller.cpp.

view_pointer_type getViewOfDataset view_type  type,
dataset_key_type  dataset_key
throw (DatasetNotFoundException)
 

Return the view of the specified type of the given dataset

Parameters:
type The type of view to return
dataset_key The key that identifies the dataset (as returned by loadDataset)
Returns:
A pointer to the requested view
Exceptions:
DatasetNotFoundException Thrown if the given dataset key does not identify an available dataset

Definition at line 221 of file controller.cpp.

Referenced by DatasetConfigurationTabWidget::addDatasetConfigurationTab(), TabOrganizer::openOverviewForImage(), and TabOrganizer::openOverviewForVolume().

view_type getViewTypeForDatasetSlice dataset_key_type  dataset_key,
slice_type  slice
throw (DatasetNotFoundException)
 

Return the type of slice view (XY_SLICE_VIEW, XZ_SLICE_VIEW, YZ_SLICE_VIEW) that is associated with the given slice type (axial, coronal, sagittal) for the given dataset. NOTE: For analyze datasets this is always (XY - axial, XZ - sagittal, YZ - coronal). For dicom datasets this may vary.

Parameters:
dataset_key The key of the dataset
slice The type of slice (one of AXIAL_SLICE, CORONAL_SLICE, SAGATTAL_SLICE)
Returns:
The slice view type (XY, XZ or YZ)
Exceptions:
DatasetNotFoundException Thrown if the given dataset key does not identify an available dataset

Definition at line 255 of file controller.cpp.

bool isAlgorithmLoaded std::string  name  ) 
 

Tells whether an algorithm with the given name has been previously loaded

Parameters:
name The algorithm name (key)
Returns:
True if the algorithm is already loaded, false otherwise

Definition at line 442 of file controller.cpp.

References AlgorithmFactory::isAlgorithmLoaded().

Here is the call graph for this function:

void loadAlgorithm std::string  name  )  throw (AlgorithmNotFoundException)
 

Load algorithm with name from external library name has to be a valid name

Parameters:
the name of the algorithm to load from lib
Exceptions:
AlgorithmNotFoundException if the algorithm can't be found in configuration or the library is unavailable

Definition at line 449 of file controller.cpp.

void loadConfiguration std::string  config_file_name  ) 
 

Load the configuration from the given config_file_name.

Parameters:
config_file_name absolute path and filename of the config file

Definition at line 336 of file controller.cpp.

References Settings::getInstance(), and ConfigParser::parseConfiguration().

Here is the call graph for this function:

std::pair< dataset_key_type, dataset_type > loadDataset std::string  filename  )  throw (FormatNotSupportedException, NullPointerException)
 

Loads a dataset with given filename.

Returns:
A pair of the key that identifies the loaded dataset uniquely and the type of the loaded dataset

Definition at line 66 of file controller.cpp.

bool removeDataset dataset_key_type  dataset_key  ) 
 

Remove the dataset associated with the given dataset key.

Parameters:
dataset_key The unique key of the dataset to remove

Definition at line 117 of file controller.cpp.

References DataViewMediator::removeDataset().

Here is the call graph for this function:

void runAlgorithm std::string  key,
configuration_pointer_type  algorithm_config
throw (AlgorithmNotFoundException, NullPointerException)
 

Create a new Algorithm pointer object by calling algorithm_factory_'s createAlgorithm method

Parameters:
key the key this algorithm is registered under

Definition at line 460 of file controller.cpp.

Referenced by AlgorithmWidget::okPressed().

void setGuiInteractionMode gui_interaction_mode_type  gui_interaction_mode  ) 
 

Set the Gui Interaction Mode

Parameters:
gui_interaction_mode The mode to be set

Definition at line 517 of file controller.cpp.

void setInputDatasetsInConfiguration configuration_pointer_type  configuration,
config_dataset_id_to_input_map_type  input_datasets,
std::map< config_dataset_id_type, std::pair< dataset_key_type, dataset_type > > &  new_dataset_keys_and_types
throw (NullPointerException, DatasetNotFoundException, InvalidCastException)
 

Set the input datasets in the dataset configuration object according to a given mapping from config file dataset IDs defined by the algorithm developer to the keys of the datasets and the datset parts the application chose to use

Parameters:
configuration A pointer to the configuration object which the algorithm get as input
dataset_keys The mapping between configuration file dataset keys and dataset keys plus dataset part
new_dataset_keys_and_types A writable container to write keys and the types of the newly created input datasets to
Exceptions:
DatasetNotFoundException Thrown if the given dataset key does not identify an available dataset

Definition at line 531 of file controller.cpp.

void setOutputDatasetsInConfiguration configuration_pointer_type  configuration,
config_dataset_id_to_output_map_type  output_datasets,
std::map< config_dataset_id_type, std::pair< dataset_key_type, dataset_type > > &  new_dataset_keys_and_types
throw (NullPointerException)
 

Set the output datasets in the dataset configuration object according to a given mapping from config file dataset IDs defined by the algorithm developer to the output dataset types that are specified in the algorithm config file or derived from the input dataset types the application user chose respectively.

Parameters:
configuration A pointer to the configuration object which the algorithm get as input
dataset_keys The mapping between configuration file dataset keys and output dataset types
new_dataset_keys_and_types A writable container to write keys and the types of the newly created input datasets to

Definition at line 671 of file controller.cpp.

void writeDataset dataset_key_type  dataset_key,
std::string  filename
throw (DatasetNotFoundException, FormatNotSupportedException)
 

Writes the dataset associated with the given key to the given file.

Returns:
A key that identifies the loaded dataset uniquely
Exceptions:
DatasetNotFoundException if the dataset_key wasn't the identifier of an existing dataset
FormatNotSupportedException if the filename suggests an unknown file format

Definition at line 96 of file controller.cpp.


The documentation for this class was generated from the following files:
Generated on Sun Aug 13 18:20:01 2006 for iMEDgine by  doxygen 1.4.6