# itk::GDCMImageIO2 Class Reference

ImageIO class for reading and writing DICOM V3.0 and ACR/NEMA (V1.0 & V2.0) images This class is only an adaptor to the gdcm library (currently gdcm 2.0 is used): More...

`#include <itkGDCMImageIO2.h>`

Collaboration diagram for itk::GDCMImageIO2:
[legend]

List of all members.

## Public Types

typedef SmartPointer< Self > | Pointer
typedef GDCMImageIO2 | Self
typedef ImageIOBase | Superclass
enum | TCompressionType { JPEG = 0, JPEG2000 }

## Public Member Functions

virtual bool | CanReadFile (const char *)
virtual bool | CanWriteFile (const char *)
void | GetBodyPart (char *part)
void | GetInstitution (char *ins)
void | GetManufacturer (char *manu)
void | GetModality (char *modality)
void | GetModel (char *model)
void | GetNumberOfSeriesInStudy (char *series)
void | GetNumberOfStudyRelatedSeries (char *series)
void | GetPatientAge (char *age)
void | GetPatientDOB (char *dob)
void | GetPatientID (char *id)
void | GetPatientName (char *name)
void | GetPatientSex (char *sex)
void | GetScanOptions (char *options)
void | GetStudyDate (char *date)
void | GetStudyDescription (char *desc)
void | GetStudyID (char *id)
bool | GetValueFromTag (const std::string &tag, std::string &value)
| itkBooleanMacro (KeepOriginalUID)
| itkBooleanMacro (LoadSequences)
| itkBooleanMacro (LoadPrivateTags)
| itkGetEnumMacro (CompressionType, TCompressionType)
| itkGetMacro (KeepOriginalUID, bool)
| itkGetMacro (RescaleSlope, double)
| itkGetMacro (LoadPrivateTags, bool)
| itkGetMacro (RescaleIntercept, double)
| itkGetMacro (LoadSequences, bool)
| itkGetStringMacro (StudyInstanceUID)
| itkGetStringMacro (UIDPrefix)
| itkGetStringMacro (SeriesInstanceUID)
| itkGetStringMacro (FrameOfReferenceInstanceUID)
| itkNewMacro (Self)
| itkSetEnumMacro (CompressionType, TCompressionType)
| itkSetMacro (KeepOriginalUID, bool)
| itkSetMacro (MaxSizeLoadEntry, long)
| itkSetMacro (LoadSequences, bool)
| itkSetMacro (LoadPrivateTags, bool)
| itkSetStringMacro (UIDPrefix)
| itkTypeMacro (GDCMImageIO2, Superclass)
virtual void | Read (void *buffer)
virtual void | ReadImageInformation ()
virtual void | Write (const void *buffer)
virtual void | WriteImageInformation ()

## Static Public Member Functions

static bool | GetLabelFromTag (const std::string &tag, std::string &labelId)
static bool | GetLoadPrivateTagsDefault ()
static bool | GetLoadSequencesDefault ()
static void | LoadPrivateTagsDefaultOff ()
static void | LoadPrivateTagsDefaultOn ()
static void | LoadSequencesDefaultOff ()
static void | LoadSequencesDefaultOn ()
static void | SetLoadPrivateTagsDefault (bool)
static void | SetLoadSequencesDefault (bool)

## Protected Member Functions

| GDCMImageIO2 ()
| ~GDCMImageIO2 ()
void | InternalReadImageInformation (std::ifstream &)
bool | OpenGDCMFileForReading (std::ifstream &, const char *)
bool | OpenGDCMFileForWriting (std::ofstream &, const char *)
void | PrintSelf (std::ostream &os, Indent indent) const

## Protected Attributes

std::string | m_FrameOfReferenceInstanceUID
bool | m_KeepOriginalUID
double | m_RescaleIntercept
double | m_RescaleSlope
std::string | m_SeriesInstanceUID
std::string | m_StudyInstanceUID
std::string | m_UIDPrefix

## Detailed Description

ImageIO class for reading and writing DICOM V3.0 and ACR/NEMA (V1.0 & V2.0) images This class is only an adaptor to the gdcm library (currently gdcm 2.0 is used):

http://gdcm.sourceforge.net

Warning:
  this class is deprecated, as gdcm 2.x has been integrated in ITK starting ITK 3.12

## Member Typedef Documentation

typedef SmartPointer<Self> itk::GDCMImageIO2::Pointer

typedef GDCMImageIO2 itk::GDCMImageIO2::Self

Standard class typedefs.

typedef ImageIOBase itk::GDCMImageIO2::Superclass

## Member Enumeration Documentation

enum itk::GDCMImageIO2::TCompressionType

Set/Get a boolean to use the JPEG2000 compression or not.

Enumerator:

  JPEG |
  JPEG2000 |

## Constructor & Destructor Documentation

itk::GDCMImageIO2::GDCMImageIO2 | ( |  | ) | `[protected]`

itk::GDCMImageIO2::~GDCMImageIO2 | ( |  | ) | `[protected]`

## Member Function Documentation

virtual bool itk::GDCMImageIO2::CanReadFile | ( | const char * |  | ) | `[virtual]`

Determine the file type. Returns true if this ImageIO can read the file specified.

virtual bool itk::GDCMImageIO2::CanWriteFile | ( | const char * |  | ) | `[virtual]`

Determine the file type. Returns true if this ImageIO can write the file specified. GDCM triggers on ".dcm" and ".dicom".

void itk::GDCMImageIO2::GetBodyPart | ( | char * | part | ) |

void itk::GDCMImageIO2::GetInstitution | ( | char * | ins | ) |

static bool itk::GDCMImageIO2::GetLabelFromTag | ( | const std::string & | tag,
|  | std::string & | labelId
| ) |  | `[static]`

Method for consulting the DICOM dictionary and recovering the text description of a field using its numeric tag represented as a string. If the tagkey is not found in the dictionary then this static method return false and the value "Unknown " in the labelId. If the tagkey is found then this static method returns true and the actual string descriptor of the tagkey is returned in the variable labelId.

static bool itk::GDCMImageIO2::GetLoadPrivateTagsDefault | ( |  | ) | `[inline, static]`

static bool itk::GDCMImageIO2::GetLoadSequencesDefault | ( |  | ) | `[inline, static]`

void itk::GDCMImageIO2::GetManufacturer | ( | char * | manu | ) |

void itk::GDCMImageIO2::GetModality | ( | char * | modality | ) |

void itk::GDCMImageIO2::GetModel | ( | char * | model | ) |

void itk::GDCMImageIO2::GetNumberOfSeriesInStudy | ( | char * | series | ) |

void itk::GDCMImageIO2::GetNumberOfStudyRelatedSeries | ( | char * | series | ) |

void itk::GDCMImageIO2::GetPatientAge | ( | char * | age | ) |

void itk::GDCMImageIO2::GetPatientDOB | ( | char * | dob | ) |

void itk::GDCMImageIO2::GetPatientID | ( | char * | id | ) |

void itk::GDCMImageIO2::GetPatientName | ( | char * | name | ) |

Convenience methods to query patient information and scanner information. These methods are here for compatibility with the DICOMImageIO2 class.

void itk::GDCMImageIO2::GetPatientSex | ( | char * | sex | ) |

void itk::GDCMImageIO2::GetScanOptions | ( | char * | options | ) |

void itk::GDCMImageIO2::GetStudyDate | ( | char * | date | ) |

void itk::GDCMImageIO2::GetStudyDescription | ( | char * | desc | ) |

void itk::GDCMImageIO2::GetStudyID | ( | char * | id | ) |

bool itk::GDCMImageIO2::GetValueFromTag | ( | const std::string & | tag,
|  | std::string & | value
| ) |  |

More general method to retrieve an arbitrary DICOM value based on a DICOM Tag (eg "0123|4567"). WARNING: You need to use the lower case for hex 0x[a-f], for instance: "0020|000d" instead of "0020|000D" (the latter won't work)

void itk::GDCMImageIO2::InternalReadImageInformation | ( | std::ifstream & |  | ) | `[protected]`

itk::GDCMImageIO2::itkBooleanMacro | ( | KeepOriginalUID |  | ) |

itk::GDCMImageIO2::itkBooleanMacro | ( | LoadSequences |  | ) |

itk::GDCMImageIO2::itkBooleanMacro | ( | LoadPrivateTags |  | ) |

itk::GDCMImageIO2::itkGetEnumMacro | ( | CompressionType | ,
|  | TCompressionType |
| ) |  |

itk::GDCMImageIO2::itkGetMacro | ( | LoadPrivateTags | ,
|  | bool |
| ) |  |

itk::GDCMImageIO2::itkGetMacro | ( | RescaleSlope | ,
|  | double |
| ) |  |

Macro to access Rescale Slope and Rescale Intercept. Which are needed to rescale properly image when needed. User then need to Always check those value when access value from the DICOM header

itk::GDCMImageIO2::itkGetMacro | ( | KeepOriginalUID | ,
|  | bool |
| ) |  |

itk::GDCMImageIO2::itkGetMacro | ( | RescaleIntercept | ,
|  | double |
| ) |  |

itk::GDCMImageIO2::itkGetMacro | ( | LoadSequences | ,
|  | bool |
| ) |  |

itk::GDCMImageIO2::itkGetStringMacro | ( | UIDPrefix |  | ) |

Macro to access the DICOM UID prefix. By default this is the ITK root id. This default can be overriden if the exam is for example part of an existing study.

itk::GDCMImageIO2::itkGetStringMacro | ( | StudyInstanceUID |  | ) |

Access the generated DICOM UID's.

itk::GDCMImageIO2::itkGetStringMacro | ( | SeriesInstanceUID |  | ) |

itk::GDCMImageIO2::itkGetStringMacro | ( | FrameOfReferenceInstanceUID |  | ) |

itk::GDCMImageIO2::itkNewMacro | ( | Self |  | ) |

Method for creation through the object factory.

itk::GDCMImageIO2::itkSetEnumMacro | ( | CompressionType | ,
|  | TCompressionType |
| ) |  |

itk::GDCMImageIO2::itkSetMacro | ( | LoadSequences | ,
|  | bool |
| ) |  |

Parse any sequences in the DICOM file. Defaults to the value of LoadSequencesDefault. Loading DICOM files is faster when sequences are not needed.

itk::GDCMImageIO2::itkSetMacro | ( | MaxSizeLoadEntry | ,
|  | long |
| ) |  |

A DICOM file can contains multiple binary stream that can be very long For example an Overlay on the image. Most of the time user do not want to load this binary structure in memory since it can consume lot of memory. Therefore any field that is bigger than the default value 0xfff is discarded and just seek'd This method allow advanced user to force the reading of such field

itk::GDCMImageIO2::itkSetMacro | ( | KeepOriginalUID | ,
|  | bool |
| ) |  |

Preserve the original DICOM UID of the input files

itk::GDCMImageIO2::itkSetMacro | ( | LoadPrivateTags | ,
|  | bool |
| ) |  |

Parse any private tags in the DICOM file. Defaults to the value of LoadPrivateTagsDefault. Loading DICOM files is faster when private tags are not needed.

itk::GDCMImageIO2::itkSetStringMacro | ( | UIDPrefix |  | ) |

itk::GDCMImageIO2::itkTypeMacro | ( | GDCMImageIO2 | ,
|  | Superclass |
| ) |  |

Run-time type information (and related methods).

static void itk::GDCMImageIO2::LoadPrivateTagsDefaultOff | ( |  | ) | `[inline, static]`

static void itk::GDCMImageIO2::LoadPrivateTagsDefaultOn | ( |  | ) | `[inline, static]`

static void itk::GDCMImageIO2::LoadSequencesDefaultOff | ( |  | ) | `[inline, static]`

static void itk::GDCMImageIO2::LoadSequencesDefaultOn | ( |  | ) | `[inline, static]`

bool itk::GDCMImageIO2::OpenGDCMFileForReading | ( | std::ifstream & | ,
|  | const char * |
| ) |  | `[protected]`

bool itk::GDCMImageIO2::OpenGDCMFileForWriting | ( | std::ofstream & | ,
|  | const char * |
| ) |  | `[protected]`

void itk::GDCMImageIO2::PrintSelf | ( | std::ostream & | os,
|  | Indent | indent
| ) |  | const`[protected]`

virtual void itk::GDCMImageIO2::Read | ( | void * | buffer | ) | `[virtual]`

Reads the data from disk into the memory buffer provided.

virtual void itk::GDCMImageIO2::ReadImageInformation | ( |  | ) | `[virtual]`

Set the spacing and dimesion information for the current filename.

static void itk::GDCMImageIO2::SetLoadPrivateTagsDefault | ( | bool |  | ) | `[inline, static]`

Global method to define the default value for LoadPrivateTags. When instances of GDCMImageIO are created, the ivar LoadPrivateTags is initialized to the value of LoadPrivateTagsDefault. This method is useful when relying on the IO factory mechanism to load images rather than specifying a particular ImageIO object on the readers. Default is false.

static void itk::GDCMImageIO2::SetLoadSequencesDefault | ( | bool |  | ) | `[inline, static]`

Global method to define the default value for LoadSequences. When instances of GDCMImageIO are created, the ivar LoadSequences is initialized to the value of LoadSequencesDefault. This method is useful when relying on the IO factory mechanism to load images rather than specifying a particular ImageIO object on the readers. Default is false.

virtual void itk::GDCMImageIO2::Write | ( | const void * | buffer | ) | `[virtual]`

Writes the data to disk from the memory buffer provided. Make sure that the IORegion has been set properly.

virtual void itk::GDCMImageIO2::WriteImageInformation | ( |  | ) | `[virtual]`

Writes the spacing and dimentions of the image. Assumes SetFileName has been called with a valid file name.

## Member Data Documentation

std::string itk::GDCMImageIO2::m_FrameOfReferenceInstanceUID `[protected]`

bool itk::GDCMImageIO2::m_KeepOriginalUID `[protected]`

double itk::GDCMImageIO2::m_RescaleIntercept `[protected]`

double itk::GDCMImageIO2::m_RescaleSlope `[protected]`

std::string itk::GDCMImageIO2::m_SeriesInstanceUID `[protected]`

std::string itk::GDCMImageIO2::m_StudyInstanceUID `[protected]`

std::string itk::GDCMImageIO2::m_UIDPrefix `[protected]`

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

- itkGDCMImageIO2.h