GDCM: gdcm::ImageHelper Class Reference

GDCM 3.2.5

Static Public Member Functions | Static Protected Member Functions | List of all members
gdcm::ImageHelper Class Reference

ImageHelper (internal class, not intended for user level). More...

`#include <gdcmImageHelper.h>`

## Static Public Member Functions
static MediaStorage | ComputeMediaStorageFromModality (const char *modality, unsigned int dimension=2, PixelFormat const &pf=PixelFormat(), PhotometricInterpretation const &pi=PhotometricInterpretation(), double rescaleintercept=0, double rescaleslope=1)
| Moved from MediaStorage here, since we need extra info stored in PixelFormat & PhotometricInterpretation.
static bool | ComputeSpacingFromImagePositionPatient (const std::vector< double > &imageposition, std::vector< double > &spacing)
| DO NOT USE.
static std::vector< unsigned int > | GetDimensionsValue (const File &f)
static bool | GetDirectionCosinesFromDataSet (DataSet const &ds, std::vector< double > &dircos)
static std::vector< double > | GetDirectionCosinesValue (File const &f)
static bool | GetForcePixelSpacing ()
static bool | GetForceRescaleInterceptSlope ()
static SmartPointer< LookupTable > | GetLUT (File const &f)
| returns the lookup table of an image file
static std::vector< double > | GetOriginValue (File const &f)
| Set/Get Origin (IPP) from/to a file.
static PhotometricInterpretation | GetPhotometricInterpretationValue (File const &f)
static PixelFormat | GetPixelFormatValue (const File &f)
static unsigned int | GetPlanarConfigurationValue (const File &f)
static bool | GetPMSRescaleInterceptSlope ()
static const ByteValue * | GetPointerFromElement (Tag const &tag, File const &f)
static bool | GetRealWorldValueMappingContent (File const &f, RealWorldValueMappingContent &rwvmc)
static std::vector< double > | GetRescaleInterceptSlopeValue (File const &f)
static bool | GetSecondaryCaptureImagePlaneModule ()
static std::vector< double > | GetSpacingValue (File const &f)
| Set/Get Spacing from/to a File.
static void | SetDimensionsValue (File &f, const Pixmap &img)
static void | SetDirectionCosinesValue (DataSet &ds, const std::vector< double > &dircos)
static void | SetForcePixelSpacing (bool)
static void | SetForceRescaleInterceptSlope (bool)
static void | SetOriginValue (DataSet &ds, const Image &img)
static void | SetPMSRescaleInterceptSlope (bool)
static void | SetRescaleInterceptSlopeValue (File &f, const Image &img)
static void | SetSecondaryCaptureImagePlaneModule (bool)
static void | SetSpacingValue (DataSet &ds, const std::vector< double > &spacing)

## Static Protected Member Functions
static Tag | GetSpacingTagFromMediaStorage (MediaStorage const &ms)
static Tag | GetZSpacingTagFromMediaStorage (MediaStorage const &ms)

## Detailed Description

ImageHelper (internal class, not intended for user level).

Helper for writing World images in DICOM. DICOM has a 'template' approach to image where MR Image Storage are distinct object from Enhanced MR Image Storage. For example the Pixel Spacing in one object is not at the same position (ie Tag) as in the other this class is the central (read: fragile) place where all the dispatching is done from a unified view of a world image (typically VTK or ITK point of view) down to the low level DICOM point of view.

Warning
  : do not expect the API of this class to be maintained at any point, since as Modalities are added the API might have to be augmented or behavior changed to cope with new modalities.

Examples
  ExtractImageRegion.cs, ExtractImageRegionWithLUT.cs, and ExtractOneFrame.cs.

## Member Function Documentation

## ◆ ComputeMediaStorageFromModality()

MediaStorage gdcm::ImageHelper::ComputeMediaStorageFromModality | ( | const char * | modality,
|  | unsigned int | dimension = 2,
|  | PixelFormat const & | pf = PixelFormat(),
|  | PhotometricInterpretation const & | pi = PhotometricInterpretation(),
|  | double | rescaleintercept = 0,
|  | double | rescaleslope = 1 )
| static

Moved from MediaStorage here, since we need extra info stored in PixelFormat & PhotometricInterpretation.

## ◆ ComputeSpacingFromImagePositionPatient()

bool gdcm::ImageHelper::ComputeSpacingFromImagePositionPatient | ( | const std::vector< double > & | imageposition,
|  | std::vector< double > & | spacing )
| static

DO NOT USE.

## ◆ GetDimensionsValue()

std::vector< unsigned int > gdcm::ImageHelper::GetDimensionsValue | ( | const File & | f | ) |
| static

This function checks tags (0x0028, 0x0010) and (0x0028, 0x0011) for the rows and columns of the image in pixels (as opposed to actual distances). The output is {col , row}

Examples
  ExtractImageRegion.cs, ExtractImageRegionWithLUT.cs, ExtractOneFrame.cs, Extracting_All_Resolution.cxx, Fake_Image_Using_Stream_Image_Writer.cxx, and StreamImageReaderTest.cxx.

## ◆ GetDirectionCosinesFromDataSet()

bool gdcm::ImageHelper::GetDirectionCosinesFromDataSet | ( | DataSet const & | ds,
|  | std::vector< double > & | dircos )
| static

## ◆ GetDirectionCosinesValue()

std::vector< double > gdcm::ImageHelper::GetDirectionCosinesValue | ( | File const & | f | ) |
| static

Get Direction Cosines (IOP) from/to a file Requires a file because mediastorage must be known

## ◆ GetForcePixelSpacing()

bool gdcm::ImageHelper::GetForcePixelSpacing | ( |  | ) |
| static

## ◆ GetForceRescaleInterceptSlope()

bool gdcm::ImageHelper::GetForceRescaleInterceptSlope | ( |  | ) |
| static

## ◆ GetLUT()

SmartPointer< LookupTable > gdcm::ImageHelper::GetLUT | ( | File const & | f | ) |
| static

returns the lookup table of an image file

## ◆ GetOriginValue()

std::vector< double > gdcm::ImageHelper::GetOriginValue | ( | File const & | f | ) |
| static

Set/Get Origin (IPP) from/to a file.

## ◆ GetPhotometricInterpretationValue()

PhotometricInterpretation gdcm::ImageHelper::GetPhotometricInterpretationValue | ( | File const & | f | ) |
| static

Examples
  ExtractImageRegion.cs.

## ◆ GetPixelFormatValue()

PixelFormat gdcm::ImageHelper::GetPixelFormatValue | ( | const File & | f | ) |
| static

This function returns pixel information about an image from its dataset That includes samples per pixel and bit depth (in that order)

Examples
  ExtractImageRegion.cs, ExtractImageRegionWithLUT.cs, and ExtractOneFrame.cs.

## ◆ GetPlanarConfigurationValue()

unsigned int gdcm::ImageHelper::GetPlanarConfigurationValue | ( | const File & | f | ) |
| static

## ◆ GetPMSRescaleInterceptSlope()

bool gdcm::ImageHelper::GetPMSRescaleInterceptSlope | ( |  | ) |
| static

## ◆ GetPointerFromElement()

const ByteValue * gdcm::ImageHelper::GetPointerFromElement | ( | Tag const & | tag,
|  | File const & | f )
| static

## ◆ GetRealWorldValueMappingContent()

bool gdcm::ImageHelper::GetRealWorldValueMappingContent | ( | File const & | f,
|  | RealWorldValueMappingContent & | rwvmc )
| static

## ◆ GetRescaleInterceptSlopeValue()

std::vector< double > gdcm::ImageHelper::GetRescaleInterceptSlopeValue | ( | File const & | f | ) |
| static

Set/Get shift/scale from/to a file

Warning
  this function reads/sets the Slope/Intercept in appropriate class storage, but also Grid Scaling in RT Dose Storage Can't take a dataset because the mediastorage of the file must be known

## ◆ GetSecondaryCaptureImagePlaneModule()

bool gdcm::ImageHelper::GetSecondaryCaptureImagePlaneModule | ( |  | ) |
| static

## ◆ GetSpacingTagFromMediaStorage()

Tag gdcm::ImageHelper::GetSpacingTagFromMediaStorage | ( | MediaStorage const & | ms | ) |
| staticprotected

## ◆ GetSpacingValue()

std::vector< double > gdcm::ImageHelper::GetSpacingValue | ( | File const & | f | ) |
| static

Set/Get Spacing from/to a File.

## ◆ GetZSpacingTagFromMediaStorage()

Tag gdcm::ImageHelper::GetZSpacingTagFromMediaStorage | ( | MediaStorage const & | ms | ) |
| staticprotected

## ◆ SetDimensionsValue()

void gdcm::ImageHelper::SetDimensionsValue | ( | File & | f,
|  | const Pixmap & | img )
| static

## ◆ SetDirectionCosinesValue()

void gdcm::ImageHelper::SetDirectionCosinesValue | ( | DataSet & | ds,
|  | const std::vector< double > & | dircos )
| static

Set Direction Cosines (IOP) from/to a file When IOD does not defines what is IOP (eg. typically Secondary Capture Image Storage) this call will simply remove the IOP attribute. Else in case of MR/CT image storage, this call will properly lookup the correct attribute to store the IOP.

## ◆ SetForcePixelSpacing()

void gdcm::ImageHelper::SetForcePixelSpacing | ( | bool |  | ) |
| static

GDCM 1.x compatibility issue: When using ReWrite an MR Image Storage would be rewritten as Secondary Capture Object while still having a Pixel Spacing tag (0028,0030). If you have deal with those files, use this very special flag to handle them Unless explicitly set elsewhere by the standard, it will use value from 0028,0030 / 0018,0088 for the Pixel Spacing of the Image

## ◆ SetForceRescaleInterceptSlope()

void gdcm::ImageHelper::SetForceRescaleInterceptSlope | ( | bool |  | ) |
| static

GDCM 1.x compatibility issue: Do not use anymore. This hack was used for some MR Image Storage generated by Philips Modality. When "Combine MR Rescaling" is set to TRUE, rescaling is removed. But when set to FALSE, the Modality LUT was exported. Internally GDCM now handles this gracefully.

## ◆ SetOriginValue()

void gdcm::ImageHelper::SetOriginValue | ( | DataSet & | ds,
|  | const Image & | img )
| static

## ◆ SetPMSRescaleInterceptSlope()

void gdcm::ImageHelper::SetPMSRescaleInterceptSlope | ( | bool |  | ) |
| static

Since GDCM 2.6.1 Philips Medical System are read using the Private Field For Rescale Slope/Intercept by default. This mechanism can be deactivated using the following API: This option has no effect when ForceRescaleInterceptSlope is set to true GDCM will only read those private attribute but never write them out.

## ◆ SetRescaleInterceptSlopeValue()

void gdcm::ImageHelper::SetRescaleInterceptSlopeValue | ( | File & | f,
|  | const Image & | img )
| static

## ◆ SetSecondaryCaptureImagePlaneModule()

void gdcm::ImageHelper::SetSecondaryCaptureImagePlaneModule | ( | bool |  | ) |
| static

Opt into Image Plane Module for Secondary Capture Image Storage Enable reading Image Position Patient (IPP), Image Orientation Patient (IOP) and Pixel Spacing (0028,0030) This is a custom extension for some existing dataset (academic)

## ◆ SetSpacingValue()

void gdcm::ImageHelper::SetSpacingValue | ( | DataSet & | ds,
|  | const std::vector< double > & | spacing )
| static

Warning
  You need to call SetSpacingValue after SetOriginValue / SetDirectionCosinesValue

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

- gdcmImageHelper.h