SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | List of all members
svkDataModel Class Reference

#include <svkDataModel.h>

Inheritance diagram for svkDataModel:

Public Member Functions

 vtkTypeMacro (svkDataModel, vtkObject)
 
 svkDataModel ()
 Constructor. More...
 
 ~svkDataModel ()
 Destructor. More...
 
virtual bool AddDataObject (string objectName, svkImageData *dataObject)
 
virtual bool RemoveDataObject (string objectName)
 
virtual void RemoveAllDataObjects ()
 
virtual bool ChangeDataObject (string objectName, svkImageData *dataObject)
 
virtual bool ReplaceDataFromFile (string objectName, string fileName)
 
virtual svkImageDataGetDataObject (string objectName)
 
virtual map< string,
svkImageData * > 
GetAllDataObjects ()
 
virtual bool SetDataFileName (string objectName, string fileName)
 
virtual string GetDataFileName (string objectName)
 
virtual svkImageDataLoadFile (string fileName, bool onlyOneInputFile=false)
 
svkDcmHeaderGetDcmHeader (string fileName)
 
virtual svkImageDataAddFileToModel (string objectName, string fileName, bool onlyOneInputFile=false)
 
virtual bool WriteToFile (string objectName, string fileName)
 
virtual bool WriteToFile (svkImageData *data, const char *fileName)
 
virtual map< string, void * > GetModelState ()
 
virtual void SetModelState (map< string, void * > modelState)
 
virtual bool AddState (string stateName, void *stateValue)
 
virtual bool ChangeState (string stateName, void *stateValue)
 
virtual void * GetState (string stateName)
 
virtual bool DataExists (string objectName)
 
virtual bool StateExists (string stateName)
 
string GetProgressText ()
 
void SetProgressText (string progressText)
 

Static Public Member Functions

static svkDataModelNew ()
 

Detailed Description

The purpose of the DataModel class is two fold. The first is to maintain a hash of svkImageData objects that can be accessed and modified by any "views". The second is to maintain a hash of states that are to be shared between "views". The DataViewControllers observe the DataModel and can respond if relevant changes are made.

Constructor & Destructor Documentation

Constructor.

Destructor.

Member Function Documentation

bool AddDataObject ( string  objectName,
svkImageData dataObject 
)
virtual

Adds a data object to the data hash. If the object already exists, it will return 0 and will not modify the hash.

Parameters
objectNamethe name of the object you wish to add
dataObjectthe pointer to the svkImageData object you wish to add
Returns
a boolean, 0 if the object name already exists, 1 if it has been added

References svkDataModel::DataExists().

Referenced by svkDataModel::AddFileToModel().

svkImageData * AddFileToModel ( string  objectName,
string  fileName,
bool  onlyOneInputFile = false 
)
virtual

Adds a file into the data hash.

Parameters
objectNamethe name you want to give the new object
fileNamethe file from which you want to create the new object
Returns
a pointer to the new data object

References svkDataModel::AddDataObject(), svkDataModel::ChangeDataObject(), svkDataModel::DataExists(), svkDataModel::LoadFile(), and svkDataModel::SetDataFileName().

Referenced by svkDataModel::ReplaceDataFromFile().

bool AddState ( string  stateName,
void *  stateValue 
)
virtual

Adds a state to the hash. If the state is already present the method returns 0 without modifying the hash.

Parameters
stateNamethe name of the new state you want to add
stateValuea void pointer to the data representing the state
Returns
boolean, 0 if the state already exists, 1 if it has been added

References svkDataModel::StateExists().

bool ChangeDataObject ( string  objectName,
svkImageData dataObject 
)
virtual

Changes a given data object in the hash to be associated with a new data object. If the object is not found, method returns 0;

Parameters
objectNamethe name of the object you wish to change
dataObjecta pointer to the net svkImageData object
Returns
a boolean, 0 if the object name was not found, 1 if the object was replaced

References svkDataModel::DataExists().

Referenced by svkDataModel::AddFileToModel().

bool ChangeState ( string  stateName,
void *  stateValue 
)
virtual

Changes a state in the state hash. If the state does not exist, zero is returned and the hash is not modified.

Parameters
stateNamethe name of the state you wish to change
stateValuea void pointer to the data representing the state
Returns
a boolean, 0 if the state does not exist, 1 if the state has been changed

References svkDataModel::StateExists().

bool DataExists ( string  objectName)
virtual

Checks to see if a given data object exists or not.

Parameters
objectNamethe name of the object you are looking for
Returns
a boolean, 0 for no object found, 1 for object found

Referenced by svkDataModel::AddDataObject(), svkDataModel::AddFileToModel(), svkDataModel::ChangeDataObject(), svkDataModel::GetDataFileName(), svkDataModel::GetDataObject(), svkDataModel::RemoveDataObject(), svkDataModel::ReplaceDataFromFile(), and svkDataModel::SetDataFileName().

map< string, svkImageData * > GetAllDataObjects ( )
virtual

Returns the hash of data objects in the model.

string GetDataFileName ( string  objectName)
virtual
svkImageData * GetDataObject ( string  objectName)
virtual

Returns data object associated with a given name in the data hash. If the hash does not contain that key, it returns NULL.

Parameters
objectNamethe name of the object you want to get
Returns
an svkImageData pointer of the given name, or null if the name does not exist

References svkDataModel::DataExists().

Referenced by svkDataModel::ReplaceDataFromFile().

svkDcmHeader * GetDcmHeader ( string  fileName)

Utility method for getting tags the header of a specific file.

References svkImageData::GetDcmHeader(), and svkDataModel::LoadFile().

map< string, void * > GetModelState ( )
virtual

Gets the entire state hash.

Returns
the state hash
string GetProgressText ( )
void * GetState ( string  stateName)
virtual

Gets the state value for the given key. Returns NULL if the key is not found.

Parameters
stateNamethe name of the state you wish to get
Returns
a void pointer to the data the state represents

References svkDataModel::StateExists().

svkImageData * LoadFile ( string  fileName,
bool  onlyOneInputFile = false 
)
virtual

Loads a file into an svkImageData object and returns a pointer to it. If the file cannot be loaded, the program exits.

NOTE!!! The result of this method needs be registered before another dataset can be loaded, otherwise loading a second dataset will DELETE the first!

Parameters
fileNamethe name of the file to load
Returns
an svkImageData pointer to the loaded object or NULL if file could not be loaded.

References svkImageReaderFactory::CreateImageReader2(), svkImageDataFactory::CreateInstance(), svkImageReader2::GetOutput(), svkImageReaderFactory::New(), svkImageReader2::OnlyReadOneInputFile(), and svkImageData::ShallowCopy().

Referenced by svkDataModel::AddFileToModel(), and svkDataModel::GetDcmHeader().

static svkDataModel* New ( )
static
void RemoveAllDataObjects ( )
virtual
bool RemoveDataObject ( string  objectName)
virtual

Removes a given data object from the data hash. If the object is not present, method returns 0.

Parameters
objectNamethe name of the object you wish to remove
Returns
a boolean, 0 if the object was removed, 1 if the object was not present

References svkDataModel::DataExists().

Referenced by svkDataModel::RemoveAllDataObjects().

bool ReplaceDataFromFile ( string  objectName,
string  fileName 
)
virtual

Replaces a data object in the data hash, with a new data object loaded from the give file.

Parameters
objectNamethe name of the object you wish to replace
fileNamethe name of the file you wish to load for the give name
Returns
a boolean, 0 if the object name was not found, 1 if the object was replaced

References svkDataModel::AddFileToModel(), svkDataModel::DataExists(), and svkDataModel::GetDataObject().

bool SetDataFileName ( string  objectName,
string  fileName 
)
virtual
void SetModelState ( map< string, void * >  modelState)
virtual

Sets the entire state hash.

Parameters
modelStatethe new state hash
void SetProgressText ( string  progressText)
bool StateExists ( string  stateName)
virtual

Checks to see if a given state exists or not.

Parameters
stateNamethe name of the state you are looking for
Returns
a boolean, 0 for no state found, 1 for state found

Referenced by svkDataModel::AddState(), svkDataModel::ChangeState(), and svkDataModel::GetState().

vtkTypeMacro ( svkDataModel  ,
vtkObject   
)
bool WriteToFile ( string  objectName,
string  fileName 
)
virtual

Not yet implemented, returns 0.

bool WriteToFile ( svkImageData data,
const char *  fileName 
)
virtual

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