DCMTK: DcmSegUtils Class Reference

DCMTK Version 3.7.0 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
DcmSegUtils Class Reference

Class that contains helper functionality for the dcmseg module. More...

## Public Member Functions
template<>
DcmIODTypes::Frame< Uint8 > * | packBinaryFrame (const Uint8 *pixelData, const Uint16 rows, const Uint16 columns)
| Pack the given segmentation pixel data, provided "unpacked", into the packed format expected by DICOM.

## Static Public Member Functions
template<typename T>
static DcmIODTypes::Frame< T > * | packBinaryFrame (const T *pixelData, const Uint16 rows, const Uint16 columns)
| Pack the given segmentation pixel data, provided "unpacked", into the packed format expected by DICOM.
static OFCondition | concatBinaryFrames (const OFVector< DcmIODTypes::FrameBase * > &frames, const Uint16 rows, const Uint16 cols, Uint8 *pixData, const size_t pixDataLength)
| Concatenate given frames into a single bit array.
static DcmIODTypes::Frame< Uint8 > * | unpackBinaryFrame (const DcmIODTypes::Frame< Uint8 > *frame, Uint16 rows, Uint16 cols)
| Unpacks a binary segmentation frame into a "sparse" pixel data frame where every resulting byte represents a single bit of the frame being either 0 (not set) or 1 (set).
static OFString | debugByte2Bin (Uint8 b)
| Dumps a byte as binary number to a string.
static void | debugDumpBin (Uint8 *buffer, size_t length, const OFString &what, const OFBool raw)
| Dumps a memory block byte for byte to the debug log stream.

## Detailed Description

Class that contains helper functionality for the dcmseg module.

## Member Function Documentation

## ◆ concatBinaryFrames()

OFCondition DcmSegUtils::concatBinaryFrames | ( | const OFVector< DcmIODTypes::FrameBase * > & | frames,
|  | const Uint16 | rows,
|  | const Uint16 | cols,
|  | Uint8 * | pixData,
|  | const size_t | pixDataLength )
| static

Concatenate given frames into a single bit array.

Parameters

  frames | The frames to concatenate. Each frame is expected to be in packed format (1 bit per pixel), with the last byte padded with 0s if necessary
  rows | The number of rows in the frames
  cols | The number of columns in the frames
  pixData | The buffer to store the concatenated frames. Must be pre-allocated and have a size of at least pixDataLength bytes. Bytes are set to 0 before concatenation.
  pixDataLength | The length of the pixData buffer in bytes

Returns
  EC_Normal if successful, an error code otherwise

## ◆ debugByte2Bin()

OFString DcmSegUtils::debugByte2Bin | ( | Uint8 | b | ) |
| static

Dumps a byte as binary number to a string.

Only useful for debugging purposes.

Parameters

  b | The byte to dump

Returns
  A string containing b as a binary number

Referenced by packBinaryFrame().

## ◆ debugDumpBin()

void DcmSegUtils::debugDumpBin | ( | Uint8 * | buffer,
|  | size_t | length,
|  | const OFString & | what,
|  | const OFBool | raw )
| static

Dumps a memory block byte for byte to the debug log stream.

Only useful for debugging purposes.

Parameters

  buffer | The address of the memory block to dump
  length | The length of memory to be dumped
  what | String describing what is dumped
  raw | If OFTrue, no additional information is added to the output, otherwise bytes are enumerated

## ◆ packBinaryFrame() [1/2]

template<typename T>

DcmIODTypes::Frame< T > * DcmSegUtils::packBinaryFrame | ( | const T * | pixelData,
|  | const Uint16 | rows,
|  | const Uint16 | columns )
| static

Pack the given segmentation pixel data, provided "unpacked", into the packed format expected by DICOM.

Parameters

  pixelData | Pixel data in unpacked format, i.e on byte per pixel, either 0 (not set) or non-0 (set)
  rows | Number of rows in the pixel data
  columns | The number of columns in the pixel data

Returns
  The frame data if successful, NULL if an error occurs

This is the default version which prints an error and returns NULL.

Returns
  Returns NULL

Referenced by DcmSegmentation::addFrame().

## ◆ packBinaryFrame() [2/2]

template<>

DcmIODTypes::Frame< Uint8 > * DcmSegUtils::packBinaryFrame | ( | const Uint8 * | pixelData,
|  | const Uint16 | rows,
|  | const Uint16 | columns )
| inline

Pack the given segmentation pixel data, provided "unpacked", into the packed format expected by DICOM.

This is the 8 bit version which is the only version actually used for segmentation objects.

Parameters

  pixelData | Pixel data in unpacked format, i.e on byte per pixel, either 0 (not set) or non-0 (set)
  rows | Number of rows in the pixel data
  columns | The number of columns in the pixel data

Returns
  Frame data if successful, NULL if an error occurs

References debugByte2Bin(), DcmIODTypes::Frame< PixelType >::m_numPixels, and DcmIODTypes::Frame< PixelType >::m_pixData.

## ◆ unpackBinaryFrame()

DcmIODTypes::Frame< Uint8 > * DcmSegUtils::unpackBinaryFrame | ( | const DcmIODTypes::Frame< Uint8 > * | frame,
|  | Uint16 | rows,
|  | Uint16 | cols )
| static

Unpacks a binary segmentation frame into a "sparse" pixel data frame where every resulting byte represents a single bit of the frame being either 0 (not set) or 1 (set).

Parameters

  frame | The input buffer with the frame in packed format
  rows | The rows of the frame
  cols | The cols of the frame

Returns
  The segmentation frame in unpacked format. NULL in case of error.

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

- dcmseg/include/dcmtk/dcmseg/segutils.h

Generated on for DCMTK Version 3.7.0 by Doxygen 1.16.1