MeVisLab Toolbox Reference
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 that is responsible for loading the specific DICOM library. More...
 

Typedefs

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

Functions

thread_id DCMTREE_EXPORT thread_start (thread_function func, thread_parameter param)
 Starts func as a new thread with param as parameter (void-pointer :) ) More...
 
void DCMTREE_EXPORT thread_await (thread_id id)
 Waits for a thread to complete its work. More...
 
bool DCMTREE_EXPORT thread_running (thread_id id)
 Tests whether a thread is running. More...
 
void DCMTREE_EXPORT thread_initcriticalsection (thread_criticalsection &cs)
 Prepares a critical section for further usage. More...
 
void DCMTREE_EXPORT thread_entercriticalsection (thread_criticalsection &cs)
 Enters a critical section. More...
 
void DCMTREE_EXPORT thread_leavecriticalsection (thread_criticalsection &cs)
 Leaves a critical section. More...
 
void DCMTREE_EXPORT thread_destroycriticalsection (thread_criticalsection &cs)
 Destroys a critical section. More...
 
const std::string configInstallPath ()
 Returns the path where the current application is installed. More...
 
const std::list< std::string > configLibraryPathList (const std::string &installPath)
 Returns a list of paths to search for dynamic libraries. More...
 
bool configLoadDll (std::string dllPath)
 Loads a dynamic library from the specified path. More...
 
DCMTREE_EXPORT void configLoadLibraries (LoadLibraryDelegate *delegate=nullptr)
 Loads dynamic libraries and searches in file DCMTree.cfg for their names. More...
 
DCMTREE_EXPORT StringList split (const std::string &tosplit, char c, bool skipempties=false)
 Splits the given string at each c. More...
 
DCMTREE_EXPORT std::string toString (const DCMTree::Date &date)
 Converts a date to a string. More...
 
DCMTREE_EXPORT std::string toString (const DCMTree::Time &time)
 Converts a time to a string. More...
 
DCMTREE_EXPORT std::string toString (const DCMTree::DateTime &datetime)
 Converts a datetime to a string. More...
 
DCMTREE_EXPORT std::string toString (int val)
 Convert an int val to a string. More...
 
DCMTREE_EXPORT std::string toString (unsigned int val)
 Converts an unsigned int val to a string. More...
 
DCMTREE_EXPORT std::string toString (float val)
 Converts a float val to a string. More...
 
DCMTREE_EXPORT std::string toString (double val)
 Converts a double val to a string. More...
 
DCMTREE_EXPORT DCMTree::Date toDate (const std::string &str)
 Converts a string str to a date. More...
 
DCMTREE_EXPORT DCMTree::Time toTime (const std::string &str)
 Converts a string str to time. More...
 
DCMTREE_EXPORT DCMTree::DateTime toDateTime (const std::string &str)
 Converts a string str to datetime. More...
 
DCMTREE_EXPORT std::string digitsOnly (const std::string &str, bool allowhex=false)
 Removes all non-digits from the given strings. More...
 
DCMTREE_EXPORT std::string afterFractionPart (const std::string &str)
 Returns the part of the string after the right-most dot. More...
 
DCMTREE_EXPORT std::string beforeFractionPart (const std::string &str)
 Returns the part of the string before the right-most dot. More...
 
DCMTREE_EXPORT int hexToInt (const std::string &str)
 Converts a hex-string str to int. More...
 
DCMTREE_EXPORT unsigned int hexToUInt (const std::string &str)
 Converts a hex-string str to unsigned int. More...
 
DCMTREE_EXPORT int toInt (const std::string &str)
 Converts a string str to int. More...
 
DCMTREE_EXPORT unsigned int toUInt (const std::string &str)
 Converts a string str to unsigned int. More...
 
DCMTREE_EXPORT double toDouble (const std::string &str)
 Converts a string str to double. More...
 
DCMTREE_EXPORT std::string toString (const DCMTree::Vr vr)
 Converts a VR vr to a string. More...
 
DCMTREE_EXPORT DCMTree::Vr toVr (const std::string &vrString)
 Converts a string str to a VR. More...
 
DCMTREE_EXPORT void toStream (std::ostream &out, const std::string &val)
 Helper functions to write data into a stream. More...
 
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, size_t maxSize=0)
 Helper functions to read data out of a stream. More...
 
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)
 Sets a callback for logging purposes. More...
 
DCMTREE_EXPORT LoggingHandler getLoggingHandler ()
 Returns the currently set logging callback. More...
 
DCMTREE_EXPORT void logMessage (std::string message, int errorCode=0)
 Logs a message using the provided callback, if any. More...
 
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. For example, toString(unsigned int) vs. toString(Tagid).

Typedef Documentation

◆ LoggingHandler

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

Definition at line 207 of file DCMTree_Utils.h.

◆ StringList

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

A list of strings.

Definition at line 80 of file DCMTree_Utils.h.

◆ thread_criticalsection

typedef CRITICAL_SECTION DCMTree_Utils::thread_criticalsection

Definition at line 42 of file DCMTree_ThreadSupport.h.

◆ thread_function

typedef thread_result(thread_modifier * DCMTree_Utils::thread_function) (thread_parameter)

Definition at line 41 of file DCMTree_ThreadSupport.h.

◆ thread_id

Definition at line 40 of file DCMTree_ThreadSupport.h.

◆ thread_parameter

System dependent types and definitions.

Definition at line 35 of file DCMTree_ThreadSupport.h.

◆ thread_result

typedef unsigned int DCMTree_Utils::thread_result

Definition at line 39 of file DCMTree_ThreadSupport.h.

Function Documentation

◆ afterFractionPart()

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

Returns the part of the string after the right-most dot.

If there is no dot in the string, the result is empty.

◆ beforeFractionPart()

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

Returns the part of the string before the right-most dot.

If there is no dot in the string, the result is the given string.

◆ condGetNameForTag()

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

◆ configInstallPath()

const std::string DCMTree_Utils::configInstallPath ( )

Returns the path where the current application is installed.

◆ configLibraryPathList()

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

Returns a list of paths to search for dynamic libraries.

◆ configLoadDll()

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

Loads a dynamic library from the specified path.

Returns true on success else false.

◆ configLoadLibraries()

DCMTREE_EXPORT void DCMTree_Utils::configLoadLibraries ( LoadLibraryDelegate delegate = nullptr)

Loads dynamic libraries and searches in file DCMTree.cfg for their names.

◆ digitsOnly()

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

Removes all non-digits from the given strings.

If allowhex is true, 'a'-'f','A'-'F' are preserved, too.

◆ fromStream() [1/5]

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

◆ fromStream() [2/5]

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

◆ fromStream() [3/5]

DCMTREE_EXPORT void DCMTree_Utils::fromStream ( std::istream &  in,
std::string &  val,
size_t  maxSize = 0 
)

Helper functions to read data out of a stream.

◆ fromStream() [4/5]

DCMTREE_EXPORT void DCMTree_Utils::fromStream ( std::istream &  in,
unsigned char *  ptr,
unsigned int  size 
)

◆ fromStream() [5/5]

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

◆ getLoggingHandler()

DCMTREE_EXPORT LoggingHandler DCMTree_Utils::getLoggingHandler ( )

Returns the currently set logging callback.

◆ hexToInt()

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

Converts a hex-string str to int.

◆ hexToUInt()

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

Converts a hex-string str to unsigned int.

◆ logMessage()

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

Logs a message using the provided callback, if any.

◆ setLoggingHandler()

DCMTREE_EXPORT void DCMTree_Utils::setLoggingHandler ( LoggingHandler  handler)

Sets a callback for logging purposes.

◆ split()

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

Splits the given string at each c.

If skipempties is true, all empty results are removed.

◆ thread_await()

void DCMTREE_EXPORT DCMTree_Utils::thread_await ( thread_id  id)

Waits for a thread to complete its work.

Parameters
idThe thread to wait for

◆ thread_destroycriticalsection()

void DCMTREE_EXPORT DCMTree_Utils::thread_destroycriticalsection ( thread_criticalsection cs)

Destroys a critical section.

Parameters
&csThe lock variable

◆ thread_entercriticalsection()

void DCMTREE_EXPORT DCMTree_Utils::thread_entercriticalsection ( thread_criticalsection cs)

Enters a critical section.

Parameters
&csThe lock variable

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

◆ thread_initcriticalsection()

void DCMTREE_EXPORT DCMTree_Utils::thread_initcriticalsection ( thread_criticalsection cs)

Prepares a critical section for further usage.

Parameters
&csThe variable to protect the critical section

◆ thread_leavecriticalsection()

void DCMTREE_EXPORT DCMTree_Utils::thread_leavecriticalsection ( thread_criticalsection cs)

Leaves a critical section.

Parameters
&csThe lock variable

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

◆ thread_running()

bool DCMTREE_EXPORT DCMTree_Utils::thread_running ( thread_id  id)

Tests whether a thread is running.

Parameters
idThe thread to test

◆ thread_start()

thread_id DCMTREE_EXPORT DCMTree_Utils::thread_start ( thread_function  func,
thread_parameter  param 
)

Starts func as a new thread with param as parameter (void-pointer :) )

Parameters
funcThe function to call
paramThe parameter to pass to func

◆ toDate()

DCMTREE_EXPORT DCMTree::Date DCMTree_Utils::toDate ( const std::string &  str)

Converts a string str to a date.

◆ toDateTime()

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

Converts a string str to datetime.

◆ toDouble()

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

Converts a string str to double.

◆ toInt()

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

Converts a string str to int.

◆ toStream() [1/5]

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

◆ toStream() [2/5]

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

◆ toStream() [3/5]

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

Helper functions to write data into a stream.

◆ toStream() [4/5]

DCMTREE_EXPORT void DCMTree_Utils::toStream ( std::ostream &  out,
const unsigned char *  ptr,
unsigned int  size 
)

◆ toStream() [5/5]

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

◆ toString() [1/8]

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

Converts a date to a string.

◆ toString() [2/8]

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

Converts a datetime to a string.

◆ toString() [3/8]

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

Converts a time to a string.

◆ toString() [4/8]

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

Converts a VR vr to a string.

◆ toString() [5/8]

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

Converts a double val to a string.

◆ toString() [6/8]

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

Converts a float val to a string.

◆ toString() [7/8]

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

Convert an int val to a string.

◆ toString() [8/8]

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

Converts an unsigned int val to a string.

◆ toTime()

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

Converts a string str to time.

◆ toUInt()

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

Converts a string str to unsigned int.

◆ toVr()

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

Converts a string str to a VR.

If the conversion fails, VR will be UN.