MeVisLabToolboxReference
DCMTree_Utils Namespace Reference

dictionary class to provide dicom-meta information More...

Classes

class  thread_scoped_criticalsection
 Class to manage thread specific critical sections. More...
class  UIDGenerator
 Class to generate unique ids, valid to be used in a DICOM environment. More...
class  LoadLibraryDelegate
 the delegate who is responsible for loading the specific DICOM library used in initialization, if the library is not loaded statically (via the DEF file) More...

Typedefs

typedef void * thread_parameter
 System dependent types and definitions.
typedef unsigned int thread_result
typedef HANDLE thread_id
typedef thread_result(thread_modifier * thread_function )(thread_parameter)
typedef CRITICAL_SECTION thread_criticalsection
typedef HANDLE thread_semaphore
typedef std::list< std::string > StringList
 a list of strings
typedef void(* LoggingHandler )(std::string, int)

Functions

thread_id DCMTREE_EXPORT thread_start (thread_function func, thread_parameter param)
 Start func as a new thread, param as parameter (void-pointer :) )
void DCMTREE_EXPORT thread_await (thread_id id)
 Wait for a thread to complete its work.
bool DCMTREE_EXPORT thread_running (thread_id id)
 Test if a thread is running.
void DCMTREE_EXPORT thread_initcriticalsection (thread_criticalsection &cs)
 Prepare a critical section for further usage.
void DCMTREE_EXPORT thread_entercriticalsection (thread_criticalsection &cs)
 Enter a critical section.
void DCMTREE_EXPORT thread_leavecriticalsection (thread_criticalsection &cs)
 Leave a critical section.
void DCMTREE_EXPORT thread_destroycriticalsection (thread_criticalsection &cs)
 Destroy a critical section.
void DCMTREE_EXPORT thread_initsemaphore (thread_semaphore &s, int initcount=0)
 Initializes a semaphore.
void DCMTREE_EXPORT thread_destroysemaphore (thread_semaphore &s)
 Destroys a semaphore.
void DCMTREE_EXPORT thread_waitsemaphore (thread_semaphore &s)
 Wait for a resource to be freed.
bool DCMTREE_EXPORT thread_waitsemaphore (thread_semaphore &s, unsigned long timeout)
 Wait for a resource to be freed.
void DCMTREE_EXPORT thread_postsemaphore (thread_semaphore &s)
 Free a resource.
const std::string configInstallPath ()
 get path where the current application is installed
const std::list< std::string > configLibraryPathList (const std::string &installPath)
 get list of paths where to search for dynamic libraries
bool configLoadDll (std::string dllPath)
 load a dynamic library from the specified path returns true on success else false
DCMTREE_EXPORT void configLoadLibraries (LoadLibraryDelegate *delegate=NULL)
 load dynamic libraries, search in file DCMTree.cfg for their names
DCMTREE_EXPORT StringList split (const std::string &tosplit, char c, bool skipempties=false)
 split the given string at each c if skipempties is true, all empty results would be removed
DCMTREE_EXPORT std::string toString (const DCMTree::Date &date)
 convert a date to a string
DCMTREE_EXPORT std::string toString (const DCMTree::Time &time)
 convert a time to a string
DCMTREE_EXPORT std::string toString (const DCMTree::DateTime &datetime)
 convert a datetime to a string
DCMTREE_EXPORT std::string toString (int val)
 convert a int to a string
DCMTREE_EXPORT std::string toString (unsigned int val)
 convert a unsigned int to a string
DCMTREE_EXPORT std::string toString (float val)
 convert a float to a string
DCMTREE_EXPORT std::string toString (double val)
 convert a double to a string
DCMTREE_EXPORT DCMTree::Date toDate (const std::string &str)
 convert a string to date
DCMTREE_EXPORT DCMTree::Time toTime (const std::string &str)
 convert a string to time
DCMTREE_EXPORT DCMTree::DateTime toDateTime (const std::string &str)
 convert a string to datetime
DCMTREE_EXPORT std::string digitsOnly (const std::string &str, bool allowhex=false)
 remove all non-digits from the given strings if allowhex is true 'a'-'f','A'-'F' are preserved too
DCMTREE_EXPORT std::string afterFractionPart (const std::string &str)
 get the part of the string after the right-most dot if there is no dot in the string the result is empty
DCMTREE_EXPORT std::string beforeFractionPart (const std::string &str)
 get the part of the string before the right-most dot if there is no dot in the string the result is the given string
DCMTREE_EXPORT int hexToInt (const std::string &str)
 convert a hex-string to int
DCMTREE_EXPORT unsigned int hexToUInt (const std::string &str)
 convert a hex-string to unsigned int
DCMTREE_EXPORT int toInt (const std::string &str)
 convert a string to int
DCMTREE_EXPORT unsigned int toUInt (const std::string &str)
 convert a string to unsigned int
DCMTREE_EXPORT double toDouble (const std::string &str)
 convert a string to double
DCMTREE_EXPORT std::string toString (const DCMTree::Vr vr)
 convert a vr into a string
DCMTREE_EXPORT DCMTree::Vr toVr (const std::string &vrString)
 convert a string into vr.
DCMTREE_EXPORT void toStream (std::ostream &out, const std::string &val)
 helpers to put data into a stream
DCMTREE_EXPORT void toStream (std::ostream &out, const int &val)
DCMTREE_EXPORT void toStream (std::ostream &out, const unsigned int &val)
DCMTREE_EXPORT void toStream (std::ostream &out, const bool &val)
DCMTREE_EXPORT void toStream (std::ostream &out, const unsigned char *ptr, unsigned int size)
DCMTREE_EXPORT void fromStream (std::istream &in, std::string &val)
 helpers to get data out of a stream
DCMTREE_EXPORT void fromStream (std::istream &in, int &val)
DCMTREE_EXPORT void fromStream (std::istream &in, unsigned int &val)
DCMTREE_EXPORT void fromStream (std::istream &in, bool &val)
DCMTREE_EXPORT void fromStream (std::istream &in, unsigned char *ptr, unsigned int size)
DCMTREE_EXPORT void setLoggingHandler (LoggingHandler handler)
 Set a callback for logging purposes.
DCMTREE_EXPORT void logMessage (std::string message, int errorCode=0)
 Log a message using the provided callback, if any.
DCMTREE_EXPORT std::string condGetNameForTag (DCMTree::TagId tag, const std::string &defaultName)

Detailed Description

dictionary class to provide dicom-meta information

utility-functions for DCMTree uses its own namespace to avoid name-mangling problems with alias types (toString(unsigned int) vs.

Author: Sascha Bohnenkamp development@mevisbreastcare.de
Copyright 2006 All Rights Reserved MeVis BreastCare GmbH & Co.KG Universitaetsallee 29 D-28359 Bremen phone +49 (0)421 330 74 0 fax +49 (0)421 330 74 50

Change history: 20060519 : SB initial version

toString(Tagid) for example)

Author: Sascha Bohnenkamp development@mevisbreastcare.de
Copyright 2006 All Rights Reserved MeVis BreastCare GmbH & Co.KG Universitaetsallee 29 D-28359 Bremen phone +49 (0)421 330 74 0 fax +49 (0)421 330 74 50

Change history: 20060531 : SB initial version


Typedef Documentation

typedef void(* DCMTree_Utils::LoggingHandler)(std::string, int)

Definition at line 206 of file DCMTree_Utils.h.

typedef std::list<std::string> DCMTree_Utils::StringList

a list of strings

Definition at line 80 of file DCMTree_Utils.h.

typedef CRITICAL_SECTION DCMTree_Utils::thread_criticalsection

Definition at line 50 of file DCMTree_ThreadSupport.h.

Definition at line 49 of file DCMTree_ThreadSupport.h.

typedef HANDLE DCMTree_Utils::thread_id

Definition at line 48 of file DCMTree_ThreadSupport.h.

System dependent types and definitions.

Definition at line 43 of file DCMTree_ThreadSupport.h.

typedef unsigned int DCMTree_Utils::thread_result

Definition at line 47 of file DCMTree_ThreadSupport.h.

Definition at line 51 of file DCMTree_ThreadSupport.h.


Function Documentation

DCMTREE_EXPORT std::string DCMTree_Utils::afterFractionPart ( const std::string &  str)

get the part of the string after the right-most dot if there is no dot in the string the result is empty

DCMTREE_EXPORT std::string DCMTree_Utils::beforeFractionPart ( const std::string &  str)

get the part of the string before the right-most dot if there is no dot in the string the result is the given string

DCMTREE_EXPORT std::string DCMTree_Utils::condGetNameForTag ( DCMTree::TagId  tag,
const std::string &  defaultName 
)
const std::string DCMTree_Utils::configInstallPath ( )

get path where the current application is installed

const std::list<std::string> DCMTree_Utils::configLibraryPathList ( const std::string &  installPath)

get list of paths where to search for dynamic libraries

bool DCMTree_Utils::configLoadDll ( std::string  dllPath)

load a dynamic library from the specified path returns true on success else false

DCMTREE_EXPORT void DCMTree_Utils::configLoadLibraries ( LoadLibraryDelegate *  delegate = NULL)

load dynamic libraries, search in file DCMTree.cfg for their names

DCMTREE_EXPORT std::string DCMTree_Utils::digitsOnly ( const std::string &  str,
bool  allowhex = false 
)

remove all non-digits from the given strings if allowhex is true 'a'-'f','A'-'F' are preserved too

DCMTREE_EXPORT void DCMTree_Utils::fromStream ( std::istream &  in,
std::string &  val 
)

helpers to get data out of a stream

DCMTREE_EXPORT void DCMTree_Utils::fromStream ( std::istream &  in,
int &  val 
)
DCMTREE_EXPORT void DCMTree_Utils::fromStream ( std::istream &  in,
unsigned int &  val 
)
DCMTREE_EXPORT void DCMTree_Utils::fromStream ( std::istream &  in,
bool &  val 
)
DCMTREE_EXPORT void DCMTree_Utils::fromStream ( std::istream &  in,
unsigned char *  ptr,
unsigned int  size 
)
DCMTREE_EXPORT int DCMTree_Utils::hexToInt ( const std::string &  str)

convert a hex-string to int

DCMTREE_EXPORT unsigned int DCMTree_Utils::hexToUInt ( const std::string &  str)

convert a hex-string to unsigned int

DCMTREE_EXPORT void DCMTree_Utils::logMessage ( std::string  message,
int  errorCode = 0 
)

Log a message using the provided callback, if any.

DCMTREE_EXPORT void DCMTree_Utils::setLoggingHandler ( LoggingHandler  handler)

Set a callback for logging purposes.

DCMTREE_EXPORT StringList DCMTree_Utils::split ( const std::string &  tosplit,
char  c,
bool  skipempties = false 
)

split the given string at each c if skipempties is true, all empty results would be removed

void DCMTREE_EXPORT DCMTree_Utils::thread_await ( thread_id  id)

Wait for a thread to complete its work.

Parameters:
idThe thread to wait for
void DCMTREE_EXPORT DCMTree_Utils::thread_destroycriticalsection ( thread_criticalsection &  cs)

Destroy a critical section.

Parameters:
&csThe lock variable
void DCMTREE_EXPORT DCMTree_Utils::thread_destroysemaphore ( thread_semaphore &  s)

Destroys a semaphore.

Parameters:
&sThe semaphore variable
void DCMTREE_EXPORT DCMTree_Utils::thread_entercriticalsection ( thread_criticalsection &  cs)

Enter a critical section.

Parameters:
&csThe lock variable

Referenced by DCMTree_Utils::thread_scoped_criticalsection::thread_scoped_criticalsection().

void DCMTREE_EXPORT DCMTree_Utils::thread_initcriticalsection ( thread_criticalsection &  cs)

Prepare a critical section for further usage.

Parameters:
&csThe variable to protect the critical section
void DCMTREE_EXPORT DCMTree_Utils::thread_initsemaphore ( thread_semaphore &  s,
int  initcount = 0 
)

Initializes a semaphore.

Parameters:
&sThe semaphore variable
initcountThe initial value of the semaphore variable
void DCMTREE_EXPORT DCMTree_Utils::thread_leavecriticalsection ( thread_criticalsection &  cs)

Leave a critical section.

Parameters:
&csThe lock variable

Referenced by DCMTree_Utils::thread_scoped_criticalsection::~thread_scoped_criticalsection().

void DCMTREE_EXPORT DCMTree_Utils::thread_postsemaphore ( thread_semaphore &  s)

Free a resource.

Parameters:
&sThe semaphore variable
bool DCMTREE_EXPORT DCMTree_Utils::thread_running ( thread_id  id)

Test if a thread is running.

Parameters:
idThe thread to test
thread_id DCMTREE_EXPORT DCMTree_Utils::thread_start ( thread_function  func,
thread_parameter  param 
)

Start func as a new thread, param as parameter (void-pointer :) )

Parameters:
funcThe function to call
paramThe parameter to pass to func
void DCMTREE_EXPORT DCMTree_Utils::thread_waitsemaphore ( thread_semaphore &  s)

Wait for a resource to be freed.

Parameters:
&sThe semaphore variable
bool DCMTREE_EXPORT DCMTree_Utils::thread_waitsemaphore ( thread_semaphore &  s,
unsigned long  timeout 
)

Wait for a resource to be freed.

The timeout is only implemented for WIN32 !

Parameters:
&sThe semaphore variable
timeoutThe timeout in milliseconds
Returns:
True if semaphore wait was successful, false if timeout
DCMTREE_EXPORT DCMTree::Date DCMTree_Utils::toDate ( const std::string &  str)

convert a string to date

DCMTREE_EXPORT DCMTree::DateTime DCMTree_Utils::toDateTime ( const std::string &  str)

convert a string to datetime

DCMTREE_EXPORT double DCMTree_Utils::toDouble ( const std::string &  str)

convert a string to double

DCMTREE_EXPORT int DCMTree_Utils::toInt ( const std::string &  str)

convert a string to int

DCMTREE_EXPORT void DCMTree_Utils::toStream ( std::ostream &  out,
const std::string &  val 
)

helpers to put data into a stream

DCMTREE_EXPORT void DCMTree_Utils::toStream ( std::ostream &  out,
const unsigned int &  val 
)
DCMTREE_EXPORT void DCMTree_Utils::toStream ( std::ostream &  out,
const bool &  val 
)
DCMTREE_EXPORT void DCMTree_Utils::toStream ( std::ostream &  out,
const unsigned char *  ptr,
unsigned int  size 
)
DCMTREE_EXPORT void DCMTree_Utils::toStream ( std::ostream &  out,
const int &  val 
)
DCMTREE_EXPORT std::string DCMTree_Utils::toString ( float  val)

convert a float to a string

DCMTREE_EXPORT std::string DCMTree_Utils::toString ( const DCMTree::Date date)

convert a date to a string

DCMTREE_EXPORT std::string DCMTree_Utils::toString ( int  val)

convert a int to a string

DCMTREE_EXPORT std::string DCMTree_Utils::toString ( const DCMTree::DateTime datetime)

convert a datetime to a string

DCMTREE_EXPORT std::string DCMTree_Utils::toString ( double  val)

convert a double to a string

DCMTREE_EXPORT std::string DCMTree_Utils::toString ( unsigned int  val)

convert a unsigned int to a string

DCMTREE_EXPORT std::string DCMTree_Utils::toString ( const DCMTree::Time time)

convert a time to a string

DCMTREE_EXPORT std::string DCMTree_Utils::toString ( const DCMTree::Vr  vr)

convert a vr into a string

DCMTREE_EXPORT DCMTree::Time DCMTree_Utils::toTime ( const std::string &  str)

convert a string to time

DCMTREE_EXPORT unsigned int DCMTree_Utils::toUInt ( const std::string &  str)

convert a string to unsigned int

DCMTREE_EXPORT DCMTree::Vr DCMTree_Utils::toVr ( const std::string &  vrString)

convert a string into vr.

If the conversion fails, vr will be UN.