vtk-dicom  0.8.17
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
vtkDICOMUtilities Class Reference

Utility functions for use with DICOM classes. More...

#include <vtkDICOMUtilities.h>

Inheritance diagram for vtkDICOMUtilities:
Inheritance graph
[legend]
Collaboration diagram for vtkDICOMUtilities:
Collaboration graph
[legend]

Public Types

typedef vtkObject Superclass
 VTK dynamic type information macro.
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 
vtkDICOMUtilitiesNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) VTK_DICOM_OVERRIDE
 Print a summary of the contents of this object.
 
unsigned short GetCIDFromUID (const char *uid)
 Get the CID from the UID.
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
bool GetDebug ()
 
void SetDebug (bool debugFlag)
 
virtual void Modified ()
 
virtual vtkMTimeType GetMTime ()
 
void PrintSelf (ostream &os, vtkIndent indent) VTK_OVERRIDE
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommand * GetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
int HasObserver (unsigned long event, vtkCommand *)
 
int HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
int HasObserver (unsigned long event)
 
int HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
int InvokeEvent (unsigned long event, void *callData)
 
int InvokeEvent (const char *event, void *callData)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 
virtual void Delete ()
 
virtual void FastDelete ()
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
virtual void Register (vtkObjectBase *o)
 
virtual void UnRegister (vtkObjectBase *o)
 
int GetReferenceCount ()
 
void SetReferenceCount (int)
 
void PrintRevisions (ostream &)
 

Static Public Member Functions

static vtkDICOMUtilitiesNew ()
 VTK new method (for Java and Tcl wrappers)
 
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkDICOMUtilitiesSafeDownCast (vtkObjectBase *o)
 
static void SetUIDPrefix (const char *prefix)
 Set a UID prefix to use when generating UIDs. More...
 
static const char * GetUIDPrefix ()
 
static std::string GenerateUID (vtkDICOMTag tag)
 Generate a UID for the provided tag.
 
static void GenerateUIDs (vtkDICOMTag tag, vtkStringArray *uids)
 Generate a series of UIDs, sorted from low to high. More...
 
static int CompareUIDs (const char *u1, const char *u2)
 Numerically compare two UIDs, returns -1, 0, or +1.
 
static std::string GenerateDateTime (const char *zone)
 Generate a DICOM date time string in the given timezone. More...
 
static std::string GenerateDateTime (long long microsecs, const char *zone)
 Generate a DICOM date time string from long integer. More...
 
static long long ConvertDateTime (const char *datetime)
 Convert a DICOM data time string into a long integer. More...
 
static long long GetUniversalTime ()
 Get the current time in microseconds. More...
 
static long long GetUTC (long long *offset)
 Deprecated method, do not use.
 
static bool IsDICOMFile (const char *filename)
 Check if the specified file is a DICOM file. More...
 
static const char * GetImplementationClassUID ()
 Get the UID for this DICOM implementation.
 
static void SetImplementationClassUID (const char *uid)
 Set the UID for this DICOM implementation. More...
 
static const char * GetImplementationVersionName ()
 Get the versioned name for this DICOM implementation.
 
static void SetImplementationVersionName (const char *name)
 Set the versioned name for this DICOM implementation. More...
 
static unsigned int UnpackUnsignedInt (const unsigned char *cp)
 Unpack one little-endian int from a stream of bytes. More...
 
static void PackUnsignedInt (unsigned int i, unsigned char *cp)
 Pack one little-endian int into a stream of bytes. More...
 
static bool PatternMatches (const char *pattern, const char *val)
 Return true if the pattern matches the given string (utf-8). More...
 
static bool PatternMatches (const char *pattern, size_t pl, const char *val, size_t vl)
 Match patterns on non-terminated strings.
 
static bool IsValidUTF8 (const char *text, size_t l)
 Check that a string is valid utf-8. More...
 
static const char * GetUIDName (const char *uid)
 Get the name associated with the given UID.
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 
static void BreakOnError ()
 
static void SetGlobalWarningDisplay (int val)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 
static vtkObjectBaseNew ()
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
- Protected Member Functions inherited from vtkObject
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) VTK_OVERRIDE
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Static Protected Member Functions

static long long GetLocalOffset (long long t)
 

Static Protected Attributes

static char UIDPrefix [64]
 
static char ImplementationClassUID [65]
 
static char ImplementationVersionName [17]
 

Additional Inherited Members

- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
vtkAtomicInt32 ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

Utility functions for use with DICOM classes.

Member Function Documentation

◆ ConvertDateTime()

static long long vtkDICOMUtilities::ConvertDateTime ( const char *  datetime)
static

Convert a DICOM data time string into a long integer.

Given a DICOM date time string, generate a long integer that counts microseconds since the UNIX epoch (00:00:00 UTC on 1 Jan 1970). If the datetime string contains a timezone offset, then that timezone is used to convert the time to UTC. Otherwise, the local timezone (according to the computer's timezone preferences) is used to convert the time to UTC. The return value is always intended to be interpreted as a UTC time.

◆ GenerateDateTime() [1/2]

static std::string vtkDICOMUtilities::GenerateDateTime ( const char *  zone)
static

Generate a DICOM date time string in the given timezone.

The time zone is to be given in the DICOM format of +HHMM or -HHMM where HH is the hour offset and MM is the minute offset. If no time zone is given, then local time is used (according to the computer's time zone preferences).

◆ GenerateDateTime() [2/2]

static std::string vtkDICOMUtilities::GenerateDateTime ( long long  microsecs,
const char *  zone 
)
static

Generate a DICOM date time string from long integer.

Given an integer number of microseconds since the UNIX epoch (00:00:00 UTC on 1 Jan 1970), return a DICOM date time string for the given time zone. The time zone should be given in the format +HHMM or -HHMM. If no time zone is given, then the local zone is used (according to the computer's time zone preferences).

◆ GenerateUIDs()

static void vtkDICOMUtilities::GenerateUIDs ( vtkDICOMTag  tag,
vtkStringArray *  uids 
)
static

Generate a series of UIDs, sorted from low to high.

Before passing the string array, call SetNumberOfValues() on the array to specify the number of UIDs that you want to be stored in it. The stored UIDs will be sorted, low to high. Generating a batch of UIDs is more efficient than calling GenerateUID() repeatedly.

◆ GetUniversalTime()

static long long vtkDICOMUtilities::GetUniversalTime ( )
static

Get the current time in microseconds.

The time is in microseconds since the UNIX epoch (00:00:00 UTC on 1 Jan 1970).

◆ IsA()

virtual vtkTypeBool vtkDICOMUtilities::IsA ( const char *  name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObjectBase.

◆ IsDICOMFile()

static bool vtkDICOMUtilities::IsDICOMFile ( const char *  filename)
static

Check if the specified file is a DICOM file.

This will return true if the file exists, is readable, and if it has the DICM magic number or if the first few bytes of the file look like DICOM data elements.

◆ IsValidUTF8()

static bool vtkDICOMUtilities::IsValidUTF8 ( const char *  text,
size_t  l 
)
static

Check that a string is valid utf-8.

The string is valid if it contains no NULL bytes and if it contains only valid 1-byte, 2-byte, 3-byte, or 4-byte utf-8 sequences. Any overlength sequences or sequences that encode values above U+10FFFF or between U+D800 and U+DFFF are considered invalid.

◆ PackUnsignedInt()

static void vtkDICOMUtilities::PackUnsignedInt ( unsigned int  i,
unsigned char *  cp 
)
inlinestatic

Pack one little-endian int into a stream of bytes.

This is a very common operation that is required in many different classes, so the code is centralized here.

◆ PatternMatches()

static bool vtkDICOMUtilities::PatternMatches ( const char *  pattern,
const char *  val 
)
static

Return true if the pattern matches the given string (utf-8).

This performs simple matching with "*" and "?" as the only wildcard. The input must either be ASCII or utf-8, and if it is utf-8, then matching will be done codepoint by codepoint.

◆ SetImplementationClassUID()

static void vtkDICOMUtilities::SetImplementationClassUID ( const char *  uid)
static

Set the UID for this DICOM implementation.

The supplied UID will be copied into a static storage area, and used for all future calls to GetImplementationClassUID. The ImplementationClassUID appears in the DICOM meta header.

◆ SetImplementationVersionName()

static void vtkDICOMUtilities::SetImplementationVersionName ( const char *  name)
static

Set the versioned name for this DICOM implementation.

The supplied name will be copied into a static storage area, and used for all future calls to GetImplementationVersionName. The ImplementationVersionName appears in the DICOM meta header.

◆ SetUIDPrefix()

static void vtkDICOMUtilities::SetUIDPrefix ( const char *  prefix)
static

Set a UID prefix to use when generating UIDs.

This is optional, if you do not own a UID prefix then the publicly available 2.25 prefix will be used.

◆ UnpackUnsignedInt()

static unsigned int vtkDICOMUtilities::UnpackUnsignedInt ( const unsigned char *  cp)
inlinestatic

Unpack one little-endian int from a stream of bytes.

This is a very common operation that is required in many different classes, so the code is centralized here.


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