DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
DcmSegment Class Reference

Class that represents a Segment inside a Segmentation object. More...

## Public Member Functions
virtual | ~DcmSegment ()
| Destructor, frees memory.
virtual void | clearData ()
| Clears all data.
DcmSegment * | clone (DcmSegmentation *seg=NULL)
| Make a clone of this segment. More...
DcmSegment & | operator= (const DcmSegment &rhs)
| Assignment operator, performs deep copy. More...
| DcmSegment (const DcmSegment &rhs)
| Copy constructor. More...
OFCondition | write (DcmItem &item)
| Write segment to given item which is usually contained within within the Segment Sequence. More...
OFCondition | read (DcmItem &item, const OFBool clearOldData=OFTrue)
| Read segment from given item. More...
virtual Uint16 | getSegmentNumber ()
| Get Segment Number. More...
virtual OFCondition | getSegmentLabel (OFString &value, const signed long pos=0)
| Get Segment Label. More...
virtual OFCondition | getSegmentDescription (OFString &value, const signed long pos=0)
| Get Segment Description. More...
virtual DcmSegTypes::E_SegmentAlgoType | getSegmentAlgorithmType ()
| Get the Segment Algorithm Type. More...
virtual OFCondition | getSegmentAlgorithmName (OFString &value, const signed long pos=0)
| Get the Segment Algorithm Name. More...
virtual GeneralAnatomyMacro & | getGeneralAnatomyCode ()
| Get General Anatomy Code. More...
virtual CodeSequenceMacro & | getSegmentedPropertyCategoryCode ()
| Get Segmented Property Category Code. More...
virtual CodeSequenceMacro & | getSegmentedPropertyTypeCode ()
| Get Segmented Property Type Code. More...
virtual OFVector< CodeSequenceMacro * > & | getSegmentedPropertyTypeModifierCode ()
| Get Segmented Property Type Modifier Code. More...
virtual AlgorithmIdentificationMacro & | getSegmentationAlgorithmIdentification ()
| Get Segmentation Algorithm Identification. More...
virtual OFCondition | getRecommendedDisplayGrayscaleValue (Uint16 &value, const unsigned long pos=0)
| Get Recommended Display Grayscale Value. More...
virtual OFCondition | getRecommendedDisplayCIELabValue (Uint16 &L, Uint16 &a, Uint16 &b)
| Returns Recommended Display CIELab Value. More...
virtual OFCondition | getTrackingID (OFString &value, const signed long pos=0)
| Get Tracking ID. More...
virtual OFCondition | getTrackingUID (OFString &value, const signed long pos=0)
| Get Tracking UID. More...
virtual OFCondition | setSegmentLabel (const OFString &value, const OFBool checkValue=OFTrue)
| Set Segment Label. More...
virtual OFCondition | setSegmentDescription (const OFString &value, const OFBool checkValue=OFTrue)
| Set Segment Label. More...
virtual OFCondition | setSegmentAlgorithm (const DcmSegTypes::E_SegmentAlgoType algoType, const OFString &algoName, const OFBool checkValue=OFTrue)
| Set Segment Algorithm. More...
virtual OFCondition | setSegmentationAlgorithmIdentification (const AlgorithmIdentificationMacro &value, const OFBool checkValue=OFTrue)
| Set Segmentation Algorithm Identification. More...
virtual OFCondition | setRecommendedDisplayGrayscaleValue (const Uint16 value, const OFBool checkValue=OFTrue)
| Set Recommended Display Grayscale Value. More...
virtual OFCondition | setRecommendedDisplayCIELabValue (const Uint16 L, const Uint16 a, const Uint16 b, const OFBool checkValue=OFTrue)
| Set Recommended Display CIELab Value. More...
virtual OFCondition | setTrackingID (const OFString &value, const OFBool checkValue=OFTrue)
| Set Tracking ID. More...
virtual OFCondition | setTrackingUID (const OFString &value, const OFBool checkValue=OFTrue)
| Set Tracking UID. More...
virtual Uint16 | getSegmentNumberRead ()
| THIS IS ONLY FOR INTERNAL USE. More...

## Static Public Member Functions
static OFCondition | create (DcmSegment *&segment, const OFString &segmentLabel, const CodeSequenceMacro &segmentedPropertyCategory, const CodeSequenceMacro &segmentedPropertyType, const DcmSegTypes::E_SegmentAlgoType algoType, const OFString &algoName="")
| Factory method to create a Segment that expects the minimal parameters required. More...

## Protected Member Functions
| DcmSegment ()
| Protected default constructor.
virtual void | initIODRules ()
| Initialize IOD rules for this component.
void | referenceSegmentationDoc (DcmSegmentation *doc)
| Set reference to the Segmentation object that this segment belongs to. More...

## Private Attributes
DcmSegmentation * | m_SegmentationDoc
| The segmentation document where this segment is located in.
DcmUnsignedShort | m_SegmentNumber
| The segment number as read from the Segment Number attribute. More...
SegmentDescriptionMacro | m_SegmentDescription
| Segment Description Macro.
DcmLongString | m_SegmentAlgorithmName
| Segment Algorithm Name: (LO, 1, 1C)
AlgorithmIdentificationMacro | m_SegmentationAlgorithmIdentification
| Segmentation Algorithm Identification (SQ, 1, 3). More...
DcmUnsignedShort | m_RecommendedDisplayGrayscaleValue
| Recommended Display Grayscale Value (US, 1, 3)
DcmUnsignedShort | m_RecommendedDisplayCIELabValue
| Recommended Display CIELab Value (US, 3, 3)
DcmUnlimitedText | m_TrackingID
| Tracking ID (UT, 1, 1C)
DcmUniqueIdentifier | m_TrackingUID
| Tracking UID (UI, 1, 1C)
OFshared_ptr< IODRules > | m_Rules
| Rules for data elements within this IOD.

## Friends
class | DcmIODUtil
| The utility class must access the protected default constructor.

## Detailed Description

Class that represents a Segment inside a Segmentation object.

It mostly represents data as found in an item of the Segment Identification Sequence (Segmentation Image Module).

## Constructor & Destructor Documentation

## ◆ DcmSegment()

DcmSegment::DcmSegment | ( | const DcmSegment & | rhs | ) |

Copy constructor.

Parameters

  rhs | The right-hand side segment to copy from

## Member Function Documentation

## ◆ clone()

DcmSegment* DcmSegment::clone | ( | DcmSegmentation * | seg = `NULL` | ) |

Make a clone of this segment.

Note that the reference to DcmSegmentation is copied, if not provided in the parameter.

Parameters

  seg | Pointer to the DcmSegmentation object to associate with the cloned segment, copied from the original segment if not provided

Returns
  Pointer to the cloned segment if successful, OFnullptr otherwise

## ◆ create()

static OFCondition DcmSegment::create | ( | DcmSegment *& | segment,
|  | const OFString & | segmentLabel,
|  | const CodeSequenceMacro & | segmentedPropertyCategory,
|  | const CodeSequenceMacro & | segmentedPropertyType,
|  | const DcmSegTypes::E_SegmentAlgoType | algoType,
|  | const OFString & | algoName = `""`
| ) |  |
| static

Factory method to create a Segment that expects the minimal parameters required.

Parameters

  segment | Pointer to the resulting segment if creation was successful; memory is allocated by the function
  segmentLabel | Free text label for the segment
  segmentedPropertyCategory | The segmented property category. Baseline CID 7150 "Segmentation Property Categories" should be used.
  segmentedPropertyType | The segmented property type. Baseline CID 7151 "Segmentation Property Types"
  algoType | The algorithm type used for segmenting this segment
  algoName | Algorithm name (required if algoType is not MANUAL)

Returns
  EC_Normal if creation was successful, error otherwise

## ◆ getGeneralAnatomyCode()

virtual GeneralAnatomyMacro& DcmSegment::getGeneralAnatomyCode | ( |  | ) |
| virtual

Get General Anatomy Code.

Returns
  Reference to the General Anatomy Macro, may be unset

## ◆ getRecommendedDisplayCIELabValue()

virtual OFCondition DcmSegment::getRecommendedDisplayCIELabValue | ( | Uint16 & | L,
|  | Uint16 & | a,
|  | Uint16 & | b
| ) |  |
| virtual

Returns Recommended Display CIELab Value.

Parameters

  L | The L component
  a | The a* component
  b | The b* component

Returns
  EC_Normal if values could be returned

## ◆ getRecommendedDisplayGrayscaleValue()

virtual OFCondition DcmSegment::getRecommendedDisplayGrayscaleValue | ( | Uint16 & | value,
|  | const unsigned long | pos = `0`
| ) |  |
| virtual

Get Recommended Display Grayscale Value.

Parameters

  value | Reference to variable in which the value should be stored
  pos | Index of the value to get (0..vm-1)

Returns
  EC_Normal if successful, an error code otherwise

## ◆ getSegmentAlgorithmName()

virtual OFCondition DcmSegment::getSegmentAlgorithmName | ( | OFString & | value,
|  | const signed long | pos = `0`
| ) |  |
| virtual

Get the Segment Algorithm Name.

Parameters

  value | Reference to variable in which the value should be stored
  pos | Index of the value to get (0..vm-1), -1 for all components

Returns
  EC_Normal if successful, an error code otherwise

## ◆ getSegmentAlgorithmType()

virtual DcmSegTypes::E_SegmentAlgoType DcmSegment::getSegmentAlgorithmType | ( |  | ) |
| virtual

Get the Segment Algorithm Type.

Returns
  The Algorithm Type

## ◆ getSegmentationAlgorithmIdentification()

virtual AlgorithmIdentificationMacro& DcmSegment::getSegmentationAlgorithmIdentification | ( |  | ) |
| virtual

Get Segmentation Algorithm Identification.

Warning
  This method has earlier been named getSegmentSurfaceGenerationAlgorithmIdentification() which has changed due to DICOM CP-1597. The code value returned is now taken from the "Segmentation Algorithm Identification Sequence" instead of the "Segment Surface Generation Algorithm Identification Sequence".

Returns
  Reference to the Segmentation Algorithm Identification Identification, may be unset

## ◆ getSegmentDescription()

virtual OFCondition DcmSegment::getSegmentDescription | ( | OFString & | value,
|  | const signed long | pos = `0`
| ) |  |
| virtual

Get Segment Description.

Parameters

  value | Reference to variable in which the value should be stored
  pos | Index of the value to get (0..vm-1), -1 for all components

Returns
  EC_Normal if successful, an error code otherwise

## ◆ getSegmentedPropertyCategoryCode()

virtual CodeSequenceMacro& DcmSegment::getSegmentedPropertyCategoryCode | ( |  | ) |
| virtual

Get Segmented Property Category Code.

Returns
  Reference to the Segmented Property Category Code, may be unset

## ◆ getSegmentedPropertyTypeCode()

virtual CodeSequenceMacro& DcmSegment::getSegmentedPropertyTypeCode | ( |  | ) |
| virtual

Get Segmented Property Type Code.

Returns
  Reference to the Segmented Property Type Code, may be unset

## ◆ getSegmentedPropertyTypeModifierCode()

virtual OFVector<CodeSequenceMacro*>& DcmSegment::getSegmentedPropertyTypeModifierCode | ( |  | ) |
| virtual

Get Segmented Property Type Modifier Code.

Returns
  Reference to the Segmented Property Type Modifier Code, may be unset

## ◆ getSegmentLabel()

virtual OFCondition DcmSegment::getSegmentLabel | ( | OFString & | value,
|  | const signed long | pos = `0`
| ) |  |
| virtual

Get Segment Label.

Parameters

  value | Reference to variable in which the value should be stored
  pos | Index of the value to get (0..vm-1), -1 for all components

Returns
  EC_Normal if successful, an error code otherwise

## ◆ getSegmentNumber()

virtual Uint16 DcmSegment::getSegmentNumber | ( |  | ) |
| virtual

Get Segment Number.

Returns
  The Segment number

## ◆ getSegmentNumberRead()

virtual Uint16 DcmSegment::getSegmentNumberRead | ( |  | ) |
| virtual

THIS IS ONLY FOR INTERNAL USE.

DO NOT USE this as a regular API user. Get Segment Number as read from the Segment Sequence for this segment. It may be different from the Segment Number as returned by getSegmentNumber(), i.e. do not rely on this method for anything.

Returns
  EC_Normal if successful, an error code otherwise

## ◆ getTrackingID()

virtual OFCondition DcmSegment::getTrackingID | ( | OFString & | value,
|  | const signed long | pos = `0`
| ) |  |
| virtual

Get Tracking ID.

Parameters

  value | Reference to variable in which the value should be stored
  pos | Index of the value to get (0..vm-1), -1 for all components

Returns
  EC_Normal if successful, an error code otherwise

## ◆ getTrackingUID()

virtual OFCondition DcmSegment::getTrackingUID | ( | OFString & | value,
|  | const signed long | pos = `0`
| ) |  |
| virtual

Get Tracking UID.

Parameters

  value | Reference to variable in which the value should be stored
  pos | Index of the value to get (0..vm-1), -1 for all components

Returns
  EC_Normal if successful, an error code otherwise

## ◆ operator=()

DcmSegment& DcmSegment::operator= | ( | const DcmSegment & | rhs | ) |

Assignment operator, performs deep copy.

Parameters

  rhs | The right-hand side segment to assign from

Returns
  Reference to this segment

## ◆ read()

OFCondition DcmSegment::read | ( | DcmItem & | item,
|  | const OFBool | clearOldData = `OFTrue`
| ) |  |

Read segment from given item.

Parameters

  item | The item to read from (must be item as found in the Segment Identification Sequence)
  clearOldData | If true, old data is deleted first

Returns
  EC_Normal if reading was successful, error otherwise

## ◆ referenceSegmentationDoc()

void DcmSegment::referenceSegmentationDoc | ( | DcmSegmentation * | doc | ) |
| protected

Set reference to the Segmentation object that this segment belongs to.

This is used to find the Segment Number this Segment has within the Segmentation.

Parameters

  doc | Pointer to the Segmentation object

## ◆ setRecommendedDisplayCIELabValue()

virtual OFCondition DcmSegment::setRecommendedDisplayCIELabValue | ( | const Uint16 | L,
|  | const Uint16 | a,
|  | const Uint16 | b,
|  | const OFBool | checkValue = `OFTrue`
| ) |  |
| virtual

Set Recommended Display CIELab Value.

Parameters

  L | L component
  a | a component
  b | b component
  checkValue | Check 'value' for validity if enabled

Returns
  EC_Normal if successful, an error code otherwise

## ◆ setRecommendedDisplayGrayscaleValue()

virtual OFCondition DcmSegment::setRecommendedDisplayGrayscaleValue | ( | const Uint16 | value,
|  | const OFBool | checkValue = `OFTrue`
| ) |  |
| virtual

Set Recommended Display Grayscale Value.

Parameters

  value | Value to be set (single value only) or "" for no value
  checkValue | Check 'value' for validity if enabled

Returns
  EC_Normal if successful, an error code otherwise

## ◆ setSegmentAlgorithm()

virtual OFCondition DcmSegment::setSegmentAlgorithm | ( | const DcmSegTypes::E_SegmentAlgoType | algoType,
|  | const OFString & | algoName,
|  | const OFBool | checkValue = `OFTrue`
| ) |  |
| virtual

Set Segment Algorithm.

Parameters

  algoType | Algorithm type used to find segment
  algoName | Name of the algorithm used (required if algorithm type is not MANUAL
  checkValue | If OFTrue, input is checked for validity

Returns
  EC_Normal if setting was successful, error otherwise

## ◆ setSegmentationAlgorithmIdentification()

virtual OFCondition DcmSegment::setSegmentationAlgorithmIdentification | ( | const AlgorithmIdentificationMacro & | value,
|  | const OFBool | checkValue = `OFTrue`
| ) |  |
| virtual

Set Segmentation Algorithm Identification.

Warning
  This method has earlier been named setSegmentSurfaceGenerationAlgorithmIdentification() which has changed due to DICOM CP-1597. The resulting code value is now written to the "Segmentation Algorithm Identification Sequence" instead of the "Segment Surface Generation Algorithm Identification Sequence".

Parameters

  value | The algorithm identification
  checkValue | If OFTrue, value undergoes some validity checks

Returns
  EC_Normal if setting was successful, error otherwise

## ◆ setSegmentDescription()

virtual OFCondition DcmSegment::setSegmentDescription | ( | const OFString & | value,
|  | const OFBool | checkValue = `OFTrue`
| ) |  |
| virtual

Set Segment Label.

Parameters

  value | Value to be set (single value only) or "" for no value
  checkValue | Check 'value' for conformance with VR (ST) and VM (1) if enabled

Returns
  EC_Normal if successful, an error code otherwise

## ◆ setSegmentLabel()

virtual OFCondition DcmSegment::setSegmentLabel | ( | const OFString & | value,
|  | const OFBool | checkValue = `OFTrue`
| ) |  |
| virtual

Set Segment Label.

Parameters

  value | Value to be set (single value only) or "" for no value
  checkValue | Check 'value' for conformance with VR (LO) and VM (1) if enabled

Returns
  EC_Normal if successful, an error code otherwise

## ◆ setTrackingID()

virtual OFCondition DcmSegment::setTrackingID | ( | const OFString & | value,
|  | const OFBool | checkValue = `OFTrue`
| ) |  |
| virtual

Set Tracking ID.

Parameters

  value | Value to be set (single value only) or "" for no value
  checkValue | Check 'value'. Not evaluated (here for consistency with other setter functions).

Returns
  EC_Normal if successful, an error code otherwise

## ◆ setTrackingUID()

virtual OFCondition DcmSegment::setTrackingUID | ( | const OFString & | value,
|  | const OFBool | checkValue = `OFTrue`
| ) |  |
| virtual

Set Tracking UID.

Parameters

  value | Value to be set (single value only) or "" for no value
  checkValue | Check 'value' for conformance with VR (UI) and VM (1) if enabled

Returns
  EC_Normal if successful, an error code otherwise

## ◆ write()

OFCondition DcmSegment::write | ( | DcmItem & | item | ) |

Write segment to given item which is usually contained within within the Segment Sequence.

Parameters

  item | The item to write to

Returns
  EC_Normal if successful, error otherwise

## Member Data Documentation

## ◆ m_SegmentationAlgorithmIdentification

AlgorithmIdentificationMacro DcmSegment::m_SegmentationAlgorithmIdentification
| private

Segmentation Algorithm Identification (SQ, 1, 3).

This attribute has earlier been named m_SegmentationSurfaceGenerationAlgorithmIdentification representing the related sequence. This has been changed in favor of the Segmentation Algorithm Identification Sequence due to DICOM CP-1597.

## ◆ m_SegmentNumber

DcmUnsignedShort DcmSegment::m_SegmentNumber
| private

The segment number as read from the Segment Number attribute.

This attribute only holds the number read from the file/item, and will be updated only during a write process. It is not meant to be used by the API user at all but only for internal purposes.

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

- dcmseg/include/dcmtk/dcmseg/segment.h

Generated on Mon Dec 15 2025 for DCMTK Version 3.7.0 by Doxygen 1.9.1