GDCM: gdcm::IPPSorter Class Reference

GDCM 3.0.25

Public Member Functions | Protected Attributes | List of all members
gdcm::IPPSorter Class Reference

IPPSorter. More...

`#include <gdcmIPPSorter.h>`

Inheritance diagram for gdcm::IPPSorter:
[legend]
Collaboration diagram for gdcm::IPPSorter:
[legend]

## Public Member Functions
| IPPSorter ()
double | GetDirectionCosinesTolerance () const
double | GetZSpacing () const
double | GetZSpacingTolerance () const
void | SetComputeZSpacing (bool b)
void | SetDirectionCosinesTolerance (double tol)
void | SetDropDuplicatePositions (bool b)
void | SetZSpacingTolerance (double tol)
bool | Sort (std::vector< std::string > const &filenames) override
Public Member Functions inherited from gdcm::Sorter
| Sorter ()
virtual | ~Sorter ()
bool | AddSelect (Tag const &tag, const char *value)
| UNSUPPORTED FOR NOW.
const std::vector< std::string > & | GetFilenames () const
void | Print (std::ostream &os) const
| Print.
void | SetSortFunction (SortFunction f)
void | SetTagsToRead (std::set< Tag > const &tags)
virtual bool | StableSort (std::vector< std::string > const &filenames)

## Protected Attributes
bool | ComputeZSpacing
double | DirCosTolerance
bool | DropDuplicatePositions
double | ZSpacing
double | ZTolerance
Protected Attributes inherited from gdcm::Sorter
std::vector< std::string > | Filenames
std::map< Tag, std::string > | Selection
SortFunction | SortFunc
std::set< Tag > | TagsToRead

## Additional Inherited Members
Public Types inherited from gdcm::Sorter
typedef bool(* | SortFunction) (DataSet const &, DataSet const &)
| Set the sort function which compares one dataset to the other.
Protected Types inherited from gdcm::Sorter
typedef std::map< Tag, std::string > | SelectionMap

## Detailed Description

IPPSorter.

Implement a simple Image Position (Patient) sorter, along the Image Orientation (Patient) direction. This algorithm does NOT support duplicate and will FAIL in case of duplicate IPP.

Warning
  See special note for SetZSpacingTolerance when computing the ZSpacing from the IPP of each DICOM files (default tolerance for consistent spacing is: 1e-6mm)

For more information on Spacing, and how it is defined in DICOM, advanced users may refers to:

http://gdcm.sourceforge.net/wiki/index.php/Imager_Pixel_Spacing

Bug
  There are currently a couple of bugs in this implementation:

- Gantry Tilt is not considered (always an error)
- Application programmer should only sort valid DataSet (eg. MRImageStorage, CTImageStorage, PETImageStorage)

Examples
  Compute3DSpacing.cxx, VolumeSorter.cxx, and gdcmorthoplanes.cxx.

## Constructor & Destructor Documentation

## ◆ IPPSorter()

gdcm::IPPSorter::IPPSorter | ( |  | ) |

## Member Function Documentation

## ◆ GetDirectionCosinesTolerance()

double gdcm::IPPSorter::GetDirectionCosinesTolerance | ( |  | ) | const
| inline

References DirCosTolerance.

## ◆ GetZSpacing()

double gdcm::IPPSorter::GetZSpacing | ( |  | ) | const
| inline

Read-only function to provide access to the computed value for the Z-Spacing The ComputeZSpacing must have been set to true before execution of sort algorithm. Call this function after calling Sort(); Z-Spacing will be 0 on 2 occasions:

- Sorting simply failed, potentially duplicate IPP => ZSpacing = 0
- ZSpacing could not be computed (Z-Spacing is not constant, or ZTolerance is too low)

Examples
  Compute3DSpacing.cxx, gdcmorthoplanes.cxx, and reslicesphere.cxx.

References ZSpacing.

## ◆ GetZSpacingTolerance()

double gdcm::IPPSorter::GetZSpacingTolerance | ( |  | ) | const
| inline

References ZTolerance.

## ◆ SetComputeZSpacing()

void gdcm::IPPSorter::SetComputeZSpacing | ( | bool | b | ) |
| inline

Functions related to Z-Spacing computation Set to true when sort algorithm should also perform a regular Z-Spacing computation using the Image Position (Patient) Potential reason for failure:

1. ALL slices are taken into account, if one slice if missing then ZSpacing will be set to 0 since the spacing will not be found to be regular along the Series

Examples
  Compute3DSpacing.cxx, VolumeSorter.cxx, gdcmorthoplanes.cxx, and reslicesphere.cxx.

References ComputeZSpacing.

## ◆ SetDirectionCosinesTolerance()

void gdcm::IPPSorter::SetDirectionCosinesTolerance | ( | double | tol | ) |
| inline

Sometimes IOP along a series is slightly changing for example: "0.999081\\0.0426953\\0.00369272\\-0.0419025\\0.955059\\0.293439", "0.999081\\0.0426953\\0.00369275\\-0.0419025\\0.955059\\0.293439", "0.999081\\0.0426952\\0.00369272\\-0.0419025\\0.955059\\0.293439", We need an API to define the tolerance which is allowed. Internally the cross vector of each direction cosines is computed. The tolerance then define the distance in between 1.0 to the dot product of those cross vectors. In a perfect world this dot product is of course 1.0 which imply a DirectionCosines tolerance of exactly 0.0 (default).

References DirCosTolerance.

## ◆ SetDropDuplicatePositions()

void gdcm::IPPSorter::SetDropDuplicatePositions | ( | bool | b | ) |
| inline

Makes the IPPSorter ignore multiple images located at the same position. Only the first occurrence will be kept. DropDuplicatePositions defaults to false.

References DropDuplicatePositions.

## ◆ SetZSpacingTolerance()

void gdcm::IPPSorter::SetZSpacingTolerance | ( | double | tol | ) |
| inline

1. Another reason for failure is that that Z-Spacing is only slightly changing (eg 1e-3) along the series, a human can determine that this is ok and change the tolerance from its default value: 1e-6

Examples
  Compute3DSpacing.cxx, gdcmorthoplanes.cxx, and reslicesphere.cxx.

References ZTolerance.

## ◆ Sort()

bool gdcm::IPPSorter::Sort | ( | std::vector< std::string > const & | filenames | ) |
| overridevirtual

Main entry point to the sorter. It will execute the filter, option should be set before running this function (SetZSpacingTolerance, ...) Return value indicate if sorting could be achieved,. Warning this does NOT imply that spacing is consistent, it only means the file are sorted according to IPP You should check if ZSpacing is 0 or not to deduce if file are actually a 3D volume

Reimplemented from gdcm::Sorter.

Examples
  Compute3DSpacing.cxx, VolumeSorter.cxx, gdcmorthoplanes.cxx, and reslicesphere.cxx.

## Member Data Documentation

## ◆ ComputeZSpacing

bool gdcm::IPPSorter::ComputeZSpacing
| protected

Referenced by SetComputeZSpacing().

## ◆ DirCosTolerance

double gdcm::IPPSorter::DirCosTolerance
| protected

Referenced by GetDirectionCosinesTolerance(), and SetDirectionCosinesTolerance().

## ◆ DropDuplicatePositions

bool gdcm::IPPSorter::DropDuplicatePositions
| protected

Referenced by SetDropDuplicatePositions().

## ◆ ZSpacing

double gdcm::IPPSorter::ZSpacing
| protected

Referenced by GetZSpacing().

## ◆ ZTolerance

double gdcm::IPPSorter::ZTolerance
| protected

Referenced by GetZSpacingTolerance(), and SetZSpacingTolerance().

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

- gdcmIPPSorter.h