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

References DCMTREE_EXPORT.

◆ 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.

References DCMTREE_EXPORT.

◆ condGetNameForTag()

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

References DCMTREE_EXPORT.

◆ 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.

References DCMTREE_EXPORT.

◆ 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.

References DCMTREE_EXPORT.

◆ fromStream() [1/5]

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

References DCMTREE_EXPORT.

◆ fromStream() [2/5]

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

References DCMTREE_EXPORT.

◆ 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.

References DCMTREE_EXPORT.

◆ fromStream() [4/5]

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

References DCMTREE_EXPORT.

◆ fromStream() [5/5]

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

References DCMTREE_EXPORT.

◆ getLoggingHandler()

DCMTREE_EXPORT LoggingHandler DCMTree_Utils::getLoggingHandler ( )

Returns the currently set logging callback.

References DCMTREE_EXPORT.

◆ hexToInt()

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

Converts a hex-string str to int.

References DCMTREE_EXPORT.

◆ hexToUInt()

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

Converts a hex-string str to unsigned int.

References DCMTREE_EXPORT.

◆ logMessage()

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

Logs a message using the provided callback, if any.

References DCMTREE_EXPORT.

◆ setLoggingHandler()

DCMTREE_EXPORT void DCMTree_Utils::setLoggingHandler ( LoggingHandler handler)

Sets a callback for logging purposes.

References DCMTREE_EXPORT.

◆ 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.

References DCMTREE_EXPORT.

◆ 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

References DCMTREE_EXPORT.

◆ thread_destroycriticalsection()

void DCMTREE_EXPORT DCMTree_Utils::thread_destroycriticalsection ( thread_criticalsection & cs)

Destroys a critical section.

Parameters
&csThe lock variable

References DCMTREE_EXPORT.

◆ thread_entercriticalsection()

void DCMTREE_EXPORT DCMTree_Utils::thread_entercriticalsection ( thread_criticalsection & cs)

Enters a critical section.

Parameters
&csThe lock variable

References DCMTREE_EXPORT.

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

References DCMTREE_EXPORT.

◆ thread_leavecriticalsection()

void DCMTREE_EXPORT DCMTree_Utils::thread_leavecriticalsection ( thread_criticalsection & cs)

Leaves a critical section.

Parameters
&csThe lock variable

References DCMTREE_EXPORT.

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

References DCMTREE_EXPORT.

◆ 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

References DCMTREE_EXPORT.

◆ toDate()

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

Converts a string str to a date.

References DCMTREE_EXPORT.

◆ toDateTime()

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

Converts a string str to datetime.

References DCMTREE_EXPORT.

◆ toDouble()

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

Converts a string str to double.

References DCMTREE_EXPORT.

◆ toInt()

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

Converts a string str to int.

References DCMTREE_EXPORT.

◆ toStream() [1/5]

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

References DCMTREE_EXPORT.

◆ toStream() [2/5]

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

References DCMTREE_EXPORT.

◆ toStream() [3/5]

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

Helper functions to write data into a stream.

References DCMTREE_EXPORT.

◆ toStream() [4/5]

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

References DCMTREE_EXPORT.

◆ toStream() [5/5]

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

References DCMTREE_EXPORT.

◆ toString() [1/8]

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

Converts a date to a string.

References DCMTREE_EXPORT.

◆ toString() [2/8]

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

Converts a datetime to a string.

References DCMTREE_EXPORT.

◆ toString() [3/8]

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

Converts a time to a string.

References DCMTREE_EXPORT.

◆ toString() [4/8]

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

Converts a VR vr to a string.

References DCMTREE_EXPORT.

◆ toString() [5/8]

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

Converts a double val to a string.

References DCMTREE_EXPORT.

◆ toString() [6/8]

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

Converts a float val to a string.

References DCMTREE_EXPORT.

◆ toString() [7/8]

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

Convert an int val to a string.

References DCMTREE_EXPORT.

◆ toString() [8/8]

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

Converts an unsigned int val to a string.

References DCMTREE_EXPORT.

◆ toTime()

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

Converts a string str to time.

References DCMTREE_EXPORT.

◆ toUInt()

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

Converts a string str to unsigned int.

References DCMTREE_EXPORT.

◆ 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.

References DCMTREE_EXPORT.