DCMTK: DcmSegmentation Class Reference

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
DcmSegmentation Class Reference

Class representing an object of the "Segmentation SOP Class". More...

Inheritance diagram for DcmSegmentation:

## Public Member Functions
virtual | ~DcmSegmentation ()
| Destructor, frees memory.
OFCondition | saveFile (const OFString &filename, const E_TransferSyntax writeXfer=EXS_LittleEndianExplicit)
| Save current object to given filename.
OFCondition | writeDataset (DcmItem &dataset)
| Write current object to given item.
OFCondition | writeConcatenation (ConcatenationCreator &cc)
| Write current object to a Concatenation.
virtual void | setCheckFGOnWrite (const OFBool doCheck)
| If enabled, functional group structure is checked before actual writing is performed in the write() method.
virtual OFBool | getCheckFGOnWrite ()
| Returns whether functional group structure is checked before actual writing is performed in the write() method.
virtual void | setCheckDimensionsOnWrite (const OFBool doCheck)
| If enabled, dimensions are checked before actual writing.
virtual OFBool | getCheckDimensionsOnWrite ()
| Returns whether dimensions are checked before actual writing is performed in the write() method.
size_t | getNumberOfFrames ()
| Get number of frames, based on the number of items in the shared functional functional groups sequence (i.e. the attribute Number of Frames) is not trusted).
DcmSegTypes::E_SegmentationType | getSegmentationType ()
| Get Segmentation Type.
DcmSegTypes::E_SegmentationFractionalType | getSegmentationFractionalType ()
| Get Fractional Segmentation Type.
size_t | getNumberOfSegments ()
| Get the Number of Segments.
virtual OFBool | check (const OFBool checkFGStructure=OFTrue)
| Perform some basic checking.
virtual FGInterface & | getFunctionalGroups ()
| Get access to functional groups.
virtual IODMultiFrameFGModule::ConcatenationInfo & | getConcatenationInfo ()
| Get reference t Concatenation information.
virtual IODGeneralEquipmentModule & | getEquipment ()
| Get General Equipment Module.
virtual IODSegmentationSeriesModule & | getSegmentationSeriesModule ()
| Get Segmentation Series Module.
virtual OFCondition | getModality (OFString &value, const signed long pos=0) const
| Get modality (overwrite from DcmIODCommon.
virtual DcmSegment * | getSegment (const size_t segmentNumber)
| Get segment by providing the logical segment number.
virtual OFBool | getSegmentNumber (const DcmSegment *segment, size_t &segmentNumber)
| Get logical segment number by providing a pointer to a given segment.
virtual SOPInstanceReferenceMacro & | getReferencedPPS ()
| Reference to the Performed Procedure Step that led to the creation of this segmentation object.
virtual const DcmIODTypes::Frame * | getFrame (const size_t &frameNo)
| Get (const) frame data of a specific frame.
virtual void | getFramesForSegment (const size_t &segmentNumber, OFVector< size_t > &frameNumbers)
| Get the frame numbers that belong to a specific segment number.
virtual OFCondition | addSegment (DcmSegment *seg, Uint16 &segmentNumber)
| Add segment to segmentation object.
virtual OFCondition | addForAllFrames (const FGBase &group)
| Add a functional group for all frames.
virtual OFCondition | addFrame (Uint8 *pixData, const Uint16 segmentNumber, const OFVector< FGBase * > &perFrameInformation)
| Add frame to segmentation object.
virtual ContentIdentificationMacro & | getContentIdentification ()
| Return reference to content content identification of this segmentation object.
virtual IODMultiframeDimensionModule & | getDimensions ()
| Return reference to multi-fame dimension module.
virtual OFCondition | setLossyImageCompressionFlag (const OFString &ratios, const OFString &methods, const OFBool checkValues=OFTrue)
| Set lossy compression flag of the segmentation object to "01".
virtual OFCondition | setEquipmentInfo (const IODGeneralEquipmentModule::EquipmentInfo &equipmentInfo, const OFBool checkValue=OFTrue)
| Set equipment info for this segmentation object.
virtual OFCondition | setContentIdentification (const ContentIdentificationMacro &contentIdentification, const OFBool checkValue=OFTrue)
| Set content identification info for this segmentation object.
virtual OFCondition | importFromSourceImage (DcmItem &dataset, const OFBool takeOverCharset=OFTrue)
| Import Patient, Study, and Frame of Reference level information from the given item.
virtual OFCondition | importFromSourceImage (const OFString &filename, const OFBool takeOverCharset=OFTrue)
| Import Patient, Study, and Frame of Reference level information from the given item.
Public Member Functions inherited from DcmIODImage< IODImagePixelModule< Uint8 > >
| DcmIODImage ()
| Constructor, creates new DcmIODImage instance with integer-based pixel data.
| DcmIODImage (OFin_place_type_t(ImagePixel))
| Constructor, constructs new DcmIODImage instance with integer, float or double based Image Pixel Module (i.
virtual | ~DcmIODImage ()
| Virtual Destructor.
IODGeneralImageModule & | getGeneralImage ()
| Get General Image Module.
IODImagePixelModuleType & | getImagePixel ()
| Get Image Pixel Module (variant)
virtual OFCondition | write (DcmItem &dataset)
| Write current common image module's attributes to DICOM dataset.
Public Member Functions inherited from DcmIODCommon
| DcmIODCommon ()
| Constructor.
| DcmIODCommon (const DcmIODCommon &rhs)
| Copy Constructor.
OFshared_ptr< IODRules > | getRules ()
| Get rules handled by this IOD.
OFshared_ptr< DcmItem > | getData ()
| Get item managed by this IOD.
IODPatientModule & | getPatient ()
| Get Patient Module.
IODPatientStudyModule & | getPatientStudy ()
| Get Patient Study Module.
IODGeneralStudyModule & | getStudy ()
| Get General Study Module.
IODGeneralEquipmentModule & | getEquipment ()
| Get General Equipment Module.
IODGeneralSeriesModule & | getSeries ()
| Get Series Module.
IODFoRModule & | getFrameOfReference ()
| Get Frame of Reference Module.
IODSOPCommonModule & | getSOPCommon ()
| Get SOP Common Module.
IODCommonInstanceReferenceModule & | getCommonInstanceReference ()
| Get Common Instance Reference Module.
virtual | ~DcmIODCommon ()
| Destructor.
virtual void | createNewStudy (const OFBool clearEquipment=OFTrue)
| Create new study.
virtual void | createNewSeries (const OFBool clearFoR=OFTrue)
| Create a new series.
virtual void | createNewSOPInstance ()
| Create a new SOP instance.
virtual void | ensureInstanceUIDs (const OFBool correctInvalid=OFFalse)
| Make sure that the IOD contains a SOP Instance, Series Instance and Study Instance UID.
virtual OFCondition | importHierarchy (DcmItem &dataset, const OFBool readPatient, const OFBool readStudy, const OFBool readFoR=OFFalse, const OFBool readSeries=OFFalse, const OFBool takeOverCharset=OFTrue)
| Import common module attributes from dataset but only read Patient, Study, Series and/or Frame of Reference level portions.
virtual OFCondition | importHierarchy (const OFString &filename, const OFBool readPatient, const OFBool readStudy, const OFBool readFoR=OFFalse, const OFBool readSeries=OFFalse, const OFBool takeOverCharset=OFTrue)
| CAUTION: Parameter order (readFoR and readSeries) changed compared to the old import() function.
virtual void | setValueCheckOnWrite (const OFBool checkValue)
| Set whether attribute values should be checked on writing, i.e.
virtual OFBool | getValueCheckOnWrite () const
| Get whether attribute value errors will be handled as errors on writing.

## Static Public Member Functions
static OFCondition | loadFile (const OFString &filename, DcmSegmentation *&segmentation)
| Static method to load a Segmentation object from a file.
static OFCondition | loadDataset (DcmDataset &dataset, DcmSegmentation *&segmentation)
| Static method to load a Segmentation object from a dataset object.
static OFCondition | loadConcatenation (ConcatenationLoader &cl, const OFString &concatenationUID, DcmSegmentation *&segmentation)
| Static method to load a concatenation of a DICOM Segmentation instance into a DcmSegmentation object.
static OFCondition | createBinarySegmentation (DcmSegmentation *&segmentation, const Uint16 rows, const Uint16 columns, const IODGeneralEquipmentModule::EquipmentInfo &equipmentInfo, const ContentIdentificationMacro &contentIdentification)
| Factory method to create a binary segmentation object from the minimal set of information required.
static OFCondition | createFractionalSegmentation (DcmSegmentation *&segmentation, const Uint16 rows, const Uint16 columns, const DcmSegTypes::E_SegmentationFractionalType fractType, const Uint16 &maxFractionalValue, const IODGeneralEquipmentModule::EquipmentInfo &equipmentInfo, const ContentIdentificationMacro &contentIdentification)
| Factory method to create a fractional segmentation object from the minimal set of information required.
static FGDerivationImage * | createDerivationImageFG (const OFVector< ImageSOPInstanceReferenceMacro > &derivationImages, const OFString &derivationDescription)
| Helps to create a valid Derivation Image Functional Group Macro The memory of the resulting functional group object has to be freed by the caller.

## Protected Member Functions
| DcmSegmentation ()
| Protected default constructor.
OFCondition | read (DcmItem &dataset)
| Overwrites DcmIODImage::read()
OFCondition | readWithoutPixelData (DcmItem &dataset)
| Reads dataset without pixel data.
OFCondition | writeWithSeparatePixelData (DcmItem &dataset, Uint8 *&pixData, size_t &pixDataLength)
| Writes the complete dataset without pixel data.
virtual IODImagePixelModule< Uint8 > & | getImagePixel ()
| Hide same function from IODImage since do not want the user to access the image pixel module manually.
virtual void | initIODRules ()
| Initialize IOD rules.
virtual OFCondition | readSegments (DcmItem &item)
| Read segments from given item.
OFCondition | writeFractionalFrames (Uint8 *pixData)
| Write fractional frames to given pixel data buffer.
virtual OFCondition | writeBinaryFrames (Uint8 *pixData, Uint16 rows, Uint16 cols, const size_t pixDataLength)
| Write binary frames to given given pixel data buffer.
virtual OFCondition | writeSegmentationImageModule (DcmItem &dataset)
| Write Segmentation Image Module.
virtual OFCondition | writeSegments (DcmItem &item)
| Write Segments.
virtual OFCondition | writeMultiFrameFunctionalGroupsModule (DcmItem &dataset)
| Write Multi-Frame Functional Groups.
virtual OFCondition | writeMultiFrameDimensionModule (DcmItem &dataset)
| Write Multi-Frame Dimension Module.
virtual OFCondition | readFrames (DcmItem &dataset)
| Read frames.
OFCondition | getAndCheckImagePixelAttributes (DcmItem &dataset, Uint16 &allocated, Uint16 &stored, Uint16 &high, Uint16 &spp, Uint16 &pixelRep, Uint16 &rows, Uint16 &cols, Uint32 &numberOfFrames, OFString &colorModel)
| Get Image Pixel module attributes and perform some basic checking.
virtual OFCondition | addFrame (Uint8 *pixData)
| Add frame to segmentation object.

## Static Protected Member Functions
static OFCondition | createCommon (DcmSegmentation *&segmentation, const Uint16 rows, const Uint16 columns, const IODGeneralEquipmentModule::EquipmentInfo &equipmentInfo, const ContentIdentificationMacro &contentIdentification)
| Create those data structures common for binary and fractional segmentations.

## Private Member Functions
void | clearData ()
| Clear old data.
OFBool | checkPixDataLength (DcmElement *pixelData, const Uint16 rows, const Uint16 cols, const Uint32 &numberOfFrames)
| Check the length of the pixel data.
OFCondition | getTotalBytesRequired (const Uint16 &rows, const Uint16 &cols, const Uint32 &numberOfFrames, size_t &bytesRequired)
| Computes the number of total bytes required for the frame data of this segmentation object.
OFCondition | readSegmentationFractionalType (DcmItem &item)
| Read Fractional Type of segmentation.
OFCondition | readSegmentationType (DcmItem &item)
| Read Segmentation Type of segmentation object.

## Static Private Member Functions
static OFCondition | loadFile (DcmFileFormat &dcmff, const OFString &filename, DcmDataset *&dset)
| Loads file.
static OFCondition | decompress (DcmDataset &dset)
| Decompress the given dataset, if compressed in Deflated or RLE transfer syntax.

## Private Attributes
IODSegmentationSeriesModule | m_SegmentationSeries
| Segmentation Series Module.
IODEnhGeneralEquipmentModule | m_EnhancedGeneralEquipmentModule
| IODEnhancedEquipmentModule.
IODMultiFrameFGModule | m_FG
| Multi-frame Functional Groups module.
IODMultiframeDimensionModule | m_DimensionModule
| Multi-frame Dimension Module.
OFVector< DcmIODTypes::Frame * > | m_Frames
| Binary frame data.
const OFString | m_ImageType
| Image Type: (CS, VM 2-n, Type 1), in Segmentations fixed to "DERIVED\PRIMARY".
ContentIdentificationMacro | m_ContentIdentificationMacro
| Content Identification Macro.
DcmSegTypes::E_SegmentationType | m_SegmentationType
| Segmentation Type: (CS, 1, 1)
DcmSegTypes::E_SegmentationFractionalType | m_SegmentationFractionalType
| Segmentation Fractional Type: (CS, 1, 1C) (required if FRACTIONAL)
DcmUnsignedShort | m_MaximumFractionalValue
| Maximum Fractional Value: (US, 1, 1C) (required if fractional type is FRACTIONAL)
OFVector< DcmSegment * > | m_Segments
| Segment descriptions from Segment Sequence.
FGInterface | m_FGInterface
| Multi-frame Functional Groups high level interface.

## Additional Inherited Members
Public Types inherited from DcmIODImage< IODImagePixelModule< Uint8 > >
typedef DcmIODImage | IODImage
| typedef for old compilers that do not define the type 'DcmIODImage' in derived classes.
typedef IODImagePixelVariant< OFVARIADIC_TEMPLATE_PARAMETER_PACK(T)> | IODImagePixelModuleType
| A good comment would be nice, but I have nothing in mind.

## Detailed Description

Class representing an object of the "Segmentation SOP Class".

## Constructor & Destructor Documentation

## ◆ DcmSegmentation()

DcmSegmentation::DcmSegmentation | ( |  | ) |
| protected

Protected default constructor.

Library users should the factory create..() method in order to create an object from scratch

Referenced by createBinarySegmentation(), createCommon(), createFractionalSegmentation(), loadConcatenation(), loadDataset(), and loadFile().

## Member Function Documentation

## ◆ addForAllFrames()

virtual OFCondition DcmSegmentation::addForAllFrames | ( | const FGBase & | group | ) |
| virtual

Add a functional group for all frames.

Parameters

  group | The group to be added as shared functional group. The

Returns
  EC_Normal if adding was successful, error otherwise

## ◆ addFrame() [1/2]

virtual OFCondition DcmSegmentation::addFrame | ( | Uint8 * | pixData | ) |
| protectedvirtual

Add frame to segmentation object.

Parameters

  pixData | Pixel data to be added. Length must be rows*columns bytes. Pixel data is copied so it must be freed by the caller.

Returns
  EC_Normal if adding was successful, error otherwise

## ◆ addFrame() [2/2]

virtual OFCondition DcmSegmentation::addFrame | ( | Uint8 * | pixData,
|  | const Uint16 | segmentNumber,
|  | const OFVector< FGBase * > & | perFrameInformation )
| virtual

Add frame to segmentation object.

Parameters

  pixData | Pixel data to be added. Length must be rows*columns bytes. For binary segmentations (bit depth i.e. Bits Allocated/Stored=1), each byte equal to 0 will be interpreted as "not set", while every other value is interpreted as "set". For fractional segmentations the full byte is copied as is.
  segmentNumber | The logical segment number (>=1) this frame refers to. The segment identified by the segmentNumber must already exist.
  perFrameInformation | The functional groups that identify this frame (i.e. which are planned to be not common for all other frames). The functional groups are copied, so ownership of each group stays with the caller no matter what the method returns.

Returns
  EC_Normal if adding was successful, error otherwise

## ◆ addSegment()

virtual OFCondition DcmSegmentation::addSegment | ( | DcmSegment * | seg,
|  | Uint16 & | segmentNumber )
| virtual

Add segment to segmentation object.

Parameters

  seg | The segment that should be added
  segmentNumber | The logical segment number that was assigned for this segment. Contains 0 if adding failed.

Returns
  EC_Normal if adding was successful, error otherwise

## ◆ check()

virtual OFBool DcmSegmentation::check | ( | const OFBool | checkFGStructure = OFTrue | ) |
| virtual

Perform some basic checking.

This method is also invoked when writing the object to a DICOM dataset or file.

Parameters

  checkFGStructure | If OFTrue (default), structure of functional groups is checked, too.

Returns
  OFTrue, if no errors were found, OFFalse otherwise.

## ◆ checkPixDataLength()

OFBool DcmSegmentation::checkPixDataLength | ( | DcmElement * | pixelData,
|  | const Uint16 | rows,
|  | const Uint16 | cols,
|  | const Uint32 & | numberOfFrames )
| private

Check the length of the pixel data.

Parameters

  pixelData | The Pixel Data element
  rows | Number of rows
  cols | Number of columns
  numberOfFrames | Number of frames

Returns
  OFTrue if length is valid, OFFalse otherwise

## ◆ createBinarySegmentation()

static OFCondition DcmSegmentation::createBinarySegmentation | ( | DcmSegmentation *& | segmentation,
|  | const Uint16 | rows,
|  | const Uint16 | columns,
|  | const IODGeneralEquipmentModule::EquipmentInfo & | equipmentInfo,
|  | const ContentIdentificationMacro & | contentIdentification )
| static

Factory method to create a binary segmentation object from the minimal set of information required.

The actual segments and the frame data is added separately. The memory of the resulting Segmentation object has to be freed by the caller.

Parameters

  segmentation | The resulting segmentation object if provided data is valid. Otherwise NULL is returned.
  rows | Number of rows of segmentation frame data
  columns | Number of rows of segmentation frame data
  equipmentInfo | Equipment that is responsible for creating the segmentation. All attributes in equipmentInfo must have non-empty values.
  contentIdentification | Basic content identification information

Returns
  EC_Normal if creation was successful, error otherwise

References DcmSegmentation().

## ◆ createCommon()

static OFCondition DcmSegmentation::createCommon | ( | DcmSegmentation *& | segmentation,
|  | const Uint16 | rows,
|  | const Uint16 | columns,
|  | const IODGeneralEquipmentModule::EquipmentInfo & | equipmentInfo,
|  | const ContentIdentificationMacro & | contentIdentification )
| staticprotected

Create those data structures common for binary and fractional segmentations.

Parameters

  segmentation | The segmentation object created
  rows | The number of rows for the segmentation
  columns | The number of columns for the segmentation
  equipmentInfo | Equipment information
  contentIdentification | Content meta information

Returns
  EC_Normal if creation was successful, error otherwise

References DcmSegmentation().

## ◆ createDerivationImageFG()

static FGDerivationImage * DcmSegmentation::createDerivationImageFG | ( | const OFVector< ImageSOPInstanceReferenceMacro > & | derivationImages,
|  | const OFString & | derivationDescription )
| static

Helps to create a valid Derivation Image Functional Group Macro The memory of the resulting functional group object has to be freed by the caller.

Parameters

  derivationImages | to image SOP instances
  derivationDescription | Free text describing how the derivation was achieved.

Returns
  The created functional group, or NULL if not successful

## ◆ createFractionalSegmentation()

static OFCondition DcmSegmentation::createFractionalSegmentation | ( | DcmSegmentation *& | segmentation,
|  | const Uint16 | rows,
|  | const Uint16 | columns,
|  | const DcmSegTypes::E_SegmentationFractionalType | fractType,
|  | const Uint16 & | maxFractionalValue,
|  | const IODGeneralEquipmentModule::EquipmentInfo & | equipmentInfo,
|  | const ContentIdentificationMacro & | contentIdentification )
| static

Factory method to create a fractional segmentation object from the minimal set of information required.

The actual segments and the frame data is added separately. The memory of the resulting Segmentation object has to be freed by the caller.

Parameters

  segmentation | The resulting segmentation object if provided data is valid. Otherwise NULL is returned.
  rows | Number of rows of segmentation frame data
  columns | Number of rows of segmentation frame data
  fractType | Either probability (SFT_PROBABILITY) or occupancy (SFT_OCCUPANCY)
  maxFractionalValue | The value inside the frame data of this segmentation that represents 100% occupancy/probability
  equipmentInfo | Equipment that is responsible for creating the segmentation. All attributes in equipmentInfo must have non-empty values.
  contentIdentification | Basic content identification information

Returns
  EC_Normal if creation was successful, error otherwise

References DcmSegmentation().

## ◆ decompress()

static OFCondition DcmSegmentation::decompress | ( | DcmDataset & | dset | ) |
| staticprivate

Decompress the given dataset, if compressed in Deflated or RLE transfer syntax.

Parameters

  dset | The dataset to be decompressed

Returns
  EC_Normal if decompression worked (or dataset has already been decompressed), IOD_EC_CannotDecompress otherwise

## ◆ getAndCheckImagePixelAttributes()

OFCondition DcmSegmentation::getAndCheckImagePixelAttributes | ( | DcmItem & | dataset,
|  | Uint16 & | allocated,
|  | Uint16 & | stored,
|  | Uint16 & | high,
|  | Uint16 & | spp,
|  | Uint16 & | pixelRep,
|  | Uint16 & | rows,
|  | Uint16 & | cols,
|  | Uint32 & | numberOfFrames,
|  | OFString & | colorModel )
| protected

Get Image Pixel module attributes and perform some basic checking.

Parameters

  dataset | Item to read from, usually main dataset level
  allocated | Bits Allocated
  stored | Bits Stored
  high | High Bit
  spp | Samples Per Pixel
  pixelRep | Pixel Representation
  rows | Rows
  cols | Columns
  numberOfFrames | The number of frames (as set in the dataset)
  colorModel | The color model used

Returns
  EC_Normal if reading/checking was successful, error otherwise

## ◆ getCheckDimensionsOnWrite()

virtual OFBool DcmSegmentation::getCheckDimensionsOnWrite | ( |  | ) |
| virtual

Returns whether dimensions are checked before actual writing is performed in the write() method.

Returns
  OFTrue if checking is performed, OFFalse otherwise

## ◆ getCheckFGOnWrite()

virtual OFBool DcmSegmentation::getCheckFGOnWrite | ( |  | ) |
| virtual

Returns whether functional group structure is checked before actual writing is performed in the write() method.

Returns
  OFTrue if checking is performed, OFFalse otherwise

## ◆ getConcatenationInfo()

virtual IODMultiFrameFGModule::ConcatenationInfo & DcmSegmentation::getConcatenationInfo | ( |  | ) |
| virtual

Get reference t Concatenation information.

Returns
  Reference to ConcatenationInfo object

## ◆ getContentIdentification()

virtual ContentIdentificationMacro & DcmSegmentation::getContentIdentification | ( |  | ) |
| virtual

Return reference to content content identification of this segmentation object.

Returns
  Reference to content identification data

## ◆ getDimensions()

virtual IODMultiframeDimensionModule & DcmSegmentation::getDimensions | ( |  | ) |
| virtual

Return reference to multi-fame dimension module.

Returns
  Reference to multi-frame dimension module

## ◆ getEquipment()

virtual IODGeneralEquipmentModule & DcmSegmentation::getEquipment | ( |  | ) |
| virtual

Get General Equipment Module.

Returns
  General Equipment Module

## ◆ getFrame()

virtual const DcmIODTypes::Frame * DcmSegmentation::getFrame | ( | const size_t & | frameNo | ) |
| virtual

Get (const) frame data of a specific frame.

Parameters

  frameNo | The number of the frame to get (starting with 0)

Returns
  The frame requested or NULL if not existing

## ◆ getFramesForSegment()

virtual void DcmSegmentation::getFramesForSegment | ( | const size_t & | segmentNumber,
|  | OFVector< size_t > & | frameNumbers )
| virtual

Get the frame numbers that belong to a specific segment number.

Parameters

  segmentNumber | The segment to search frames for
  frameNumbers | The frame numbers belonging to that segment

## ◆ getFunctionalGroups()

virtual FGInterface & DcmSegmentation::getFunctionalGroups | ( |  | ) |
| virtual

Get access to functional groups.

This is meant for reading data from functional groups that are not actively managed, i.e. made accessible by DcmSegmentation. In rare cases, however, it makes sense to access it for writing too, e.g. in order to add Stacks; use with care!

Returns
  Reference to the functional groups

## ◆ getImagePixel()

virtual IODImagePixelModule< Uint8 > & DcmSegmentation::getImagePixel | ( |  | ) |
| protectedvirtual

Hide same function from IODImage since do not want the user to access the image pixel module manually.

Returns
  The Image Pixel Module

## ◆ getModality()

virtual OFCondition DcmSegmentation::getModality | ( | OFString & | value,
|  | const signed long | pos = 0 ) const
| virtual

Get modality (overwrite from DcmIODCommon.

We always return "SEG" here)

Parameters

  value | Reference to variable in which the value should be stored
  pos | Index of the value to get. Not evaluated (here for consistency with other setter functions).

Returns
  status, EC_Normal if successful, an error code otherwise

## ◆ getNumberOfFrames()

size_t DcmSegmentation::getNumberOfFrames | ( |  | ) |

Get number of frames, based on the number of items in the shared functional functional groups sequence (i.e. the attribute Number of Frames) is not trusted).

Note that this returns the numbers of frames present in memory. In practice (i.e. for writing later on), the number of frames must not exceed 2^31-1 (maximum value of Number of Frames attribute, enforced by writing routines).

Returns
  The number of frames handled by this object

## ◆ getNumberOfSegments()

size_t DcmSegmentation::getNumberOfSegments | ( |  | ) |

Get the Number of Segments.

Note that this returns the numbers of Segments present in memory. In practice, the number of segments must not exceed 2^16-1 (enforced by writing routines).

Returns
  The number of segments handled by this object

## ◆ getReferencedPPS()

virtual SOPInstanceReferenceMacro & DcmSegmentation::getReferencedPPS | ( |  | ) |
| virtual

Reference to the Performed Procedure Step that led to the creation of this segmentation object.

This is required if this object is created in an MPPS or GPPS workflow.

Returns
  Reference to the referenced PPS object

## ◆ getSegment()

virtual DcmSegment * DcmSegmentation::getSegment | ( | const size_t | segmentNumber | ) |
| virtual

Get segment by providing the logical segment number.

Parameters

  segmentNumber | The logical segment number

Returns
  The segment if segment number is valid, NULL otherwise

## ◆ getSegmentationFractionalType()

DcmSegTypes::E_SegmentationFractionalType DcmSegmentation::getSegmentationFractionalType | ( |  | ) |
| inline

Get Fractional Segmentation Type.

Returns
  Type of the segmentation, as defined by DcmSegTypes::E_SegmentationFractionalTypes (returns SFT_UNKNOWN if not fractional at all)

References m_SegmentationFractionalType.

## ◆ getSegmentationSeriesModule()

virtual IODSegmentationSeriesModule & DcmSegmentation::getSegmentationSeriesModule | ( |  | ) |
| virtual

Get Segmentation Series Module.

Returns
  Segmentation Series Module

## ◆ getSegmentationType()

DcmSegTypes::E_SegmentationType DcmSegmentation::getSegmentationType | ( |  | ) |
| inline

Get Segmentation Type.

Returns
  Type of the segmentation, as defined by DcmSegTypes::E_SegmentationType

References m_SegmentationType.

## ◆ getSegmentNumber()

virtual OFBool DcmSegmentation::getSegmentNumber | ( | const DcmSegment * | segment,
|  | size_t & | segmentNumber )
| virtual

Get logical segment number by providing a pointer to a given segment.

Parameters

  segment | The segment to find the logical segment number for
  segmentNumber | The segment number. 0 if segment could not be found.

Returns
  OFTrue if segment could be found, OFFalse otherwise.

## ◆ getTotalBytesRequired()

OFCondition DcmSegmentation::getTotalBytesRequired | ( | const Uint16 & | rows,
|  | const Uint16 & | cols,
|  | const Uint32 & | numberOfFrames,
|  | size_t & | bytesRequired )
| private

Computes the number of total bytes required for the frame data of this segmentation object.

Takes into account dimensions and number of frames, as well as the type of segmentation (member variables). May file if size_t type is not able to hold the result of intermediate computations.

Parameters

  rows | Number of rows of a frame
  cols | Number of cols of a frame
  numberOfFrames | The number of frames of the object
  bytesRequired | Will hold the result of the computation, if successful. Does not any padding into account.

Returns
  EC_Normal if computation was possible, EC_TooManyBytesRequested otherwise.

## ◆ importFromSourceImage() [1/2]

virtual OFCondition DcmSegmentation::importFromSourceImage | ( | const OFString & | filename,
|  | const OFBool | takeOverCharset = OFTrue )
| virtual

Import Patient, Study, and Frame of Reference level information from the given item.

The method does only import Frame of Reference if Frame of Reference UID is found in the image (and no error is reported if not). The reason is that if the source images of the segmentation do have an FoR, the segmentation object must have the same one, so we must import it. If the images do not have an FoR, we must not try at all importing it. The current content of this object is not deleted before reading. If the log stream is set and valid the, the reason for any error might be obtained from the error/warning output.

Parameters

  filename | Reference to DICOM dataset from which the document should be read
  takeOverCharset | If OFTrue (default), Specific Character Set is taken over from imported dataset. If it's not present or empty (invalid), the attribute will not be present in this class either.

Returns
  EC_Normal if successful, an error code otherwise

## ◆ importFromSourceImage() [2/2]

virtual OFCondition DcmSegmentation::importFromSourceImage | ( | DcmItem & | dataset,
|  | const OFBool | takeOverCharset = OFTrue )
| virtual

Import Patient, Study, and Frame of Reference level information from the given item.

The method does only import Frame of Reference if Frame of Reference (FoR) UID is found in the image (and no error is reported if not). The reason is that if the source images of the segmentation do have an FoR, the segmentation object must have the same one, so we must import it. If the images do not have an FoR, we must not try at all importing it. If the log stream is set and valid the, the reason for any error might be obtained from the error/warning output.

Parameters

  dataset | Reference to DICOM dataset from which the document should be read
  takeOverCharset | If OFTrue (default), Specific Character Set is taken over from imported dataset. If it's not present or empty (invalid), the attribute will not be present in this class either.

Returns
  EC_Normal if successful, an error code otherwise

## ◆ loadConcatenation()

static OFCondition DcmSegmentation::loadConcatenation | ( | ConcatenationLoader & | cl,
|  | const OFString & | concatenationUID,
|  | DcmSegmentation *& | segmentation )
| static

Static method to load a concatenation of a DICOM Segmentation instance into a DcmSegmentation object.

Parameters

  cl | The ConcatenationLoader instance to be used. Must be configured so that load() can be called.
  concatenationUID | The Concatenation UID identifying the Concatenation within the Concatenations know to ConcatenationLoader cl.
  segmentation | The resulting Segmentation object, if loading was successful

Returns
  EC_Normal if loading was successful, error otherwise

References DcmSegmentation().

## ◆ loadDataset()

static OFCondition DcmSegmentation::loadDataset | ( | DcmDataset & | dataset,
|  | DcmSegmentation *& | segmentation )
| static

Static method to load a Segmentation object from a dataset object.

The memory of the resulting Segmentation object has to be freed by the caller.

Parameters

  dataset | The dataset to read from
  segmentation | The resulting segmentation object. NULL if dataset could not be read successfully.

Returns
  EC_Normal if reading was successful, error otherwise

References DcmSegmentation().

## ◆ loadFile() [1/2]

static OFCondition DcmSegmentation::loadFile | ( | const OFString & | filename,
|  | DcmSegmentation *& | segmentation )
| static

Static method to load a Segmentation object from a file.

The memory of the resulting Segmentation object has to be freed by the caller.

Parameters

  filename | The file to read from
  segmentation | The resulting segmentation object. NULL if dataset could not be read successfully.

Returns
  EC_Normal if reading was successful, error otherwise

References DcmSegmentation().

## ◆ loadFile() [2/2]

static OFCondition DcmSegmentation::loadFile | ( | DcmFileFormat & | dcmff,
|  | const OFString & | filename,
|  | DcmDataset *& | dset )
| staticprivate

Loads file.

Parameters

  dcmff | The file format to load into
  filename | The filename of the file to load
  dset | Pointer to dataset after loading

Returns
  EC_Normal if loading was successful, error otherwise

## ◆ read()

OFCondition DcmSegmentation::read | ( | DcmItem & | dataset | ) |
| protectedvirtual

Overwrites DcmIODImage::read()

Parameters

  dataset | The dataset to read from

Returns
  EC_Normal if reading succeeded, error otherwise

Reimplemented from DcmIODImage< IODImagePixelModule< Uint8 > >.

## ◆ readFrames()

virtual OFCondition DcmSegmentation::readFrames | ( | DcmItem & | dataset | ) |
| protectedvirtual

Read frames.

Parameters

  dataset | Item to read from, usually main dataset level

Returns
  EC_Normal if reading was successful, error otherwise

## ◆ readSegmentationFractionalType()

OFCondition DcmSegmentation::readSegmentationFractionalType | ( | DcmItem & | item | ) |
| private

Read Fractional Type of segmentation.

Parameters

  item | The item to read from

Returns
  EC_Normal if type could be read, EC_TagNotFound if tag is not present, error otherwise

## ◆ readSegmentationType()

OFCondition DcmSegmentation::readSegmentationType | ( | DcmItem & | item | ) |
| private

Read Segmentation Type of segmentation object.

Parameters

  item | The item to read from

Returns
  EC_Normal if type could be read, EC_TagNotFound if tag is not present, error otherwise

## ◆ readSegments()

virtual OFCondition DcmSegmentation::readSegments | ( | DcmItem & | item | ) |
| protectedvirtual

Read segments from given item.

Parameters

  item | The item to read from

Returns
  EC_Normal if reading was successful, error otherwise

## ◆ readWithoutPixelData()

OFCondition DcmSegmentation::readWithoutPixelData | ( | DcmItem & | dataset | ) |
| protected

Reads dataset without pixel data.

Parameters

  dataset | The dataset to read from

Returns
  EC_Normal if reading succeeded, error otherwise

## ◆ saveFile()

OFCondition DcmSegmentation::saveFile | ( | const OFString & | filename,
|  | const E_TransferSyntax | writeXfer = EXS_LittleEndianExplicit )

Save current object to given filename.

Parameters

  filename | The file to write to
  writeXfer | The transfer syntax to be used

Returns
  EC_Normal if writing was successful, error otherwise.

References EXS_LittleEndianExplicit.

## ◆ setCheckDimensionsOnWrite()

virtual void DcmSegmentation::setCheckDimensionsOnWrite | ( | const OFBool | doCheck | ) |
| virtual

If enabled, dimensions are checked before actual writing.

This can be very time-consuming if many frames are present. Disabling should only be done if the user knows that the functional groups are valid, wants to to adapt the functional groups manually after calling write() or knows what he's doing otherwise.
Per default, checking is enabled.

Parameters

  doCheck | If OFTrue, checking will be performed. If OFFalse, no checks are performed.

## ◆ setCheckFGOnWrite()

virtual void DcmSegmentation::setCheckFGOnWrite | ( | const OFBool | doCheck | ) |
| virtual

If enabled, functional group structure is checked before actual writing is performed in the write() method.

Checking might be time consuming on functional groups with many frames, though disabling might result in invalid functional group structures. Disabling should only be done if the user knows that the functional groups are valid, wants to to adapt the functional groups manually after calling write() or knows what he's doing otherwise.
Per default, checking is enabled.

Parameters

  doCheck | If OFTrue, checking will be performed. If OFFalse, no checks are performed.

## ◆ setContentIdentification()

virtual OFCondition DcmSegmentation::setContentIdentification | ( | const ContentIdentificationMacro & | contentIdentification,
|  | const OFBool | checkValue = OFTrue )
| virtual

Set content identification info for this segmentation object.

Parameters

  contentIdentification | The content identification of this segmentation
  checkValue | If OFTrue, the data provided is checked for validity (as possible)

Returns
  EC_Normal if content identification could be set correctly, OFFalse otherwise

## ◆ setEquipmentInfo()

virtual OFCondition DcmSegmentation::setEquipmentInfo | ( | const IODGeneralEquipmentModule::EquipmentInfo & | equipmentInfo,
|  | const OFBool | checkValue = OFTrue )
| virtual

Set equipment info for this segmentation object.

Parameters

  equipmentInfo | The description of the equipment used to create this segmentation
  checkValue | If OFTrue, the data provided is checked for validity

Returns
  EC_Normal if equipment information could be set successfully, error otherwise

## ◆ setLossyImageCompressionFlag()

virtual OFCondition DcmSegmentation::setLossyImageCompressionFlag | ( | const OFString & | ratios,
|  | const OFString & | methods,
|  | const OFBool | checkValues = OFTrue )
| virtual

Set lossy compression flag of the segmentation object to "01".

If one of the source images of this segmentation has undergone lossy compression then this function should be called.

Parameters

  ratios | Compression ratios (separated by backslash) of the applied lossy compression steps. Only one value (and no backslash) if only one step was performed.
  methods | Methods (separated by backslash) of the applied lossy compression steps. Only one value (and no backslash) if only one step was performed.
  checkValues | If OFTrue, the data provided is checked for validity

Returns
  EC_Normal if lossy compression info could be set, error code otherwise

## ◆ writeBinaryFrames()

virtual OFCondition DcmSegmentation::writeBinaryFrames | ( | Uint8 * | pixData,
|  | Uint16 | rows,
|  | Uint16 | cols,
|  | const size_t | pixDataLength )
| protectedvirtual

Write binary frames to given given pixel data buffer.

Parameters

  pixData | The filled pixel data buffer returned by the method
  rows | Number of rows in frame
  cols | Number of columns in frame
  pixDataLength | The length of buffer in pixData (in bytes) returned by this method.

Returns
  EC_Normal if writing was successful, error otherwise

## ◆ writeConcatenation()

OFCondition DcmSegmentation::writeConcatenation | ( | ConcatenationCreator & | cc | ) |

Write current object to a Concatenation.

Parameters

  cc | The Concatenation Creator object to be used. Must be configured so that writeNextInstance() is ready to be called.

Returns
  EC_Normal if writing was successful, error otherwise.

## ◆ writeDataset()

OFCondition DcmSegmentation::writeDataset | ( | DcmItem & | dataset | ) |

Write current object to given item.

Parameters

  dataset | The item to write to

Returns
  EC_Normal if writing was successful, error otherwise.

## ◆ writeFractionalFrames()

OFCondition DcmSegmentation::writeFractionalFrames | ( | Uint8 * | pixData | ) |
| protected

Write fractional frames to given pixel data buffer.

Parameters

  pixData | The filled pixel data buffer returned by the method

Returns
  EC_Normal if writing was successful, error otherwise

## ◆ writeMultiFrameDimensionModule()

virtual OFCondition DcmSegmentation::writeMultiFrameDimensionModule | ( | DcmItem & | dataset | ) |
| protectedvirtual

Write Multi-Frame Dimension Module.

Parameters

  dataset | The item to write to, usually main dataset level

Returns
  EC_Normal if writing was successful, error otherwise

## ◆ writeMultiFrameFunctionalGroupsModule()

virtual OFCondition DcmSegmentation::writeMultiFrameFunctionalGroupsModule | ( | DcmItem & | dataset | ) |
| protectedvirtual

Write Multi-Frame Functional Groups.

Parameters

  dataset | The item to write to, usually main dataset level

Returns
  EC_Normal if writing was successful, error otherwise

## ◆ writeSegmentationImageModule()

virtual OFCondition DcmSegmentation::writeSegmentationImageModule | ( | DcmItem & | dataset | ) |
| protectedvirtual

Write Segmentation Image Module.

Parameters

  dataset | The item to write to, usually main dataset level

Returns
  EC_Normal if writing was successful, error otherwise

## ◆ writeSegments()

virtual OFCondition DcmSegmentation::writeSegments | ( | DcmItem & | item | ) |
| protectedvirtual

Write Segments.

Parameters

  item | The item to write to

Returns
  EC_Normal if writing was successful, error otherwise

## ◆ writeWithSeparatePixelData()

OFCondition DcmSegmentation::writeWithSeparatePixelData | ( | DcmItem & | dataset,
|  | Uint8 *& | pixData,
|  | size_t & | pixDataLength )
| protected

Writes the complete dataset without pixel data.

Parameters

  dataset | The dataset to write to
  pixData | Buffer for pixel data to write to
  pixDataLength | Length of pixData buffer

Returns
  EC_Normal if writing succeeded, error otherwise

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

- dcmseg/include/dcmtk/dcmseg/segdoc.h

Generated on Wed Apr 30 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2