PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::encoding::compression::image_params Struct Reference

Parameters describing image pixel data. More...

#include <image_params.h>

Collaboration diagram for kcenon::pacs::encoding::compression::image_params:
Collaboration graph

Public Member Functions

size_t frame_size_bytes () const noexcept
 Calculates the size of uncompressed pixel data in bytes.
 
bool is_grayscale () const noexcept
 Checks if the image is grayscale (single sample per pixel).
 
bool is_color () const noexcept
 Checks if the image is color (multiple samples per pixel).
 
bool is_signed () const noexcept
 Checks if pixel values are signed integers.
 
bool valid_for_jpeg_baseline () const noexcept
 Validates image parameters for JPEG Baseline compression.
 
bool valid_for_jpeg_lossless () const noexcept
 Validates image parameters for JPEG Lossless compression.
 
bool valid_for_jpeg2000 () const noexcept
 Validates image parameters for JPEG 2000 compression.
 
bool valid_for_jpeg_ls () const noexcept
 Validates image parameters for JPEG-LS compression.
 
bool valid_for_rle () const noexcept
 Validates image parameters for RLE Lossless compression.
 

Public Attributes

uint16_t width {0}
 Image width in pixels (Columns - 0028,0011)
 
uint16_t height {0}
 Image height in pixels (Rows - 0028,0010)
 
uint16_t bits_allocated {0}
 Bits allocated per pixel sample (0028,0100) Valid values: 8, 16.
 
uint16_t bits_stored {0}
 Bits stored per pixel sample (0028,0101) Must be <= bits_allocated.
 
uint16_t high_bit {0}
 High bit position (0028,0102) Typically bits_stored - 1.
 
uint16_t samples_per_pixel {1}
 Number of samples per pixel (0028,0002) 1 for grayscale, 3 for color.
 
uint16_t planar_configuration {0}
 Planar configuration (0028,0006) 0 = interleaved (R1G1B1R2G2B2...), 1 = separate planes (RRR...GGG...BBB...)
 
uint16_t pixel_representation {0}
 Pixel representation (0028,0103) 0 = unsigned, 1 = signed.
 
photometric_interpretation photometric {photometric_interpretation::monochrome2}
 Photometric interpretation (0028,0004)
 
uint32_t number_of_frames {1}
 Number of frames in multi-frame image (0028,0008)
 

Detailed Description

Parameters describing image pixel data.

Contains all DICOM attributes needed for image compression/decompression. Maps directly to DICOM tags in Image Pixel Module (C.7.6.3).

Definition at line 81 of file image_params.h.

Member Function Documentation

◆ frame_size_bytes()

size_t kcenon::pacs::encoding::compression::image_params::frame_size_bytes ( ) const
inlinenodiscardnoexcept

Calculates the size of uncompressed pixel data in bytes.

Returns
Size in bytes for a single frame

Definition at line 122 of file image_params.h.

122 {
123 size_t bits_per_pixel = static_cast<size_t>(bits_allocated) * samples_per_pixel;
124 size_t total_bits = static_cast<size_t>(width) * height * bits_per_pixel;
125 return (total_bits + 7) / 8; // Round up to byte boundary
126 }
uint16_t samples_per_pixel
Number of samples per pixel (0028,0002) 1 for grayscale, 3 for color.
uint16_t bits_allocated
Bits allocated per pixel sample (0028,0100) Valid values: 8, 16.
uint16_t height
Image height in pixels (Rows - 0028,0010)
uint16_t width
Image width in pixels (Columns - 0028,0011)

References bits_allocated, height, samples_per_pixel, and width.

Referenced by kcenon::pacs::encoding::compression::jpeg_baseline_codec::impl::encode(), kcenon::pacs::encoding::compression::jpeg_lossless_codec::impl::encode(), and kcenon::pacs::encoding::compression::rle_codec::impl::encode().

Here is the caller graph for this function:

◆ is_color()

bool kcenon::pacs::encoding::compression::image_params::is_color ( ) const
inlinenodiscardnoexcept

Checks if the image is color (multiple samples per pixel).

Returns
true if color

Definition at line 140 of file image_params.h.

140 {
141 return samples_per_pixel > 1;
142 }

References samples_per_pixel.

◆ is_grayscale()

bool kcenon::pacs::encoding::compression::image_params::is_grayscale ( ) const
inlinenodiscardnoexcept

Checks if the image is grayscale (single sample per pixel).

Returns
true if grayscale

Definition at line 132 of file image_params.h.

132 {
133 return samples_per_pixel == 1;
134 }

References samples_per_pixel.

Referenced by kcenon::pacs::encoding::compression::jpeg_baseline_codec::impl::encode().

Here is the caller graph for this function:

◆ is_signed()

bool kcenon::pacs::encoding::compression::image_params::is_signed ( ) const
inlinenodiscardnoexcept

Checks if pixel values are signed integers.

Returns
true if signed

Definition at line 148 of file image_params.h.

148 {
149 return pixel_representation == 1;
150 }
uint16_t pixel_representation
Pixel representation (0028,0103) 0 = unsigned, 1 = signed.

References pixel_representation.

Referenced by kcenon::pacs::encoding::compression::jpeg2000_codec::impl::encode().

Here is the caller graph for this function:

◆ valid_for_jpeg2000()

bool kcenon::pacs::encoding::compression::image_params::valid_for_jpeg2000 ( ) const
inlinenodiscardnoexcept

Validates image parameters for JPEG 2000 compression.

Returns
true if parameters are valid for JPEG 2000

JPEG 2000 requirements:

  • 1-16 bit precision (per component)
  • bits_allocated must be 8 or 16
  • 1 (grayscale) or 3 (color) samples per pixel
  • Valid dimensions (non-zero)

Definition at line 192 of file image_params.h.

192 {
193 if (bits_stored < 1 || bits_stored > 16) return false;
194 if (bits_allocated != 8 && bits_allocated != 16) return false;
195 if (samples_per_pixel != 1 && samples_per_pixel != 3) return false;
196 if (width == 0 || height == 0) return false;
197 return true;
198 }
uint16_t bits_stored
Bits stored per pixel sample (0028,0101) Must be <= bits_allocated.

References bits_allocated, bits_stored, height, samples_per_pixel, and width.

◆ valid_for_jpeg_baseline()

bool kcenon::pacs::encoding::compression::image_params::valid_for_jpeg_baseline ( ) const
inlinenodiscardnoexcept

Validates image parameters for JPEG Baseline compression.

Returns
true if parameters are valid for JPEG Baseline

JPEG Baseline requirements:

  • 8-bit samples only
  • 1 (grayscale) or 3 (color) samples per pixel

Definition at line 160 of file image_params.h.

160 {
161 if (bits_allocated != 8 || bits_stored != 8) return false;
162 if (samples_per_pixel != 1 && samples_per_pixel != 3) return false;
163 return true;
164 }

References bits_allocated, bits_stored, and samples_per_pixel.

Referenced by kcenon::pacs::encoding::compression::jpeg_baseline_codec::impl::encode().

Here is the caller graph for this function:

◆ valid_for_jpeg_lossless()

bool kcenon::pacs::encoding::compression::image_params::valid_for_jpeg_lossless ( ) const
inlinenodiscardnoexcept

Validates image parameters for JPEG Lossless compression.

Returns
true if parameters are valid for JPEG Lossless

JPEG Lossless requirements:

  • 2-16 bit precision
  • bits_allocated must be 8 or 16
  • Grayscale only (samples_per_pixel = 1)

Definition at line 175 of file image_params.h.

175 {
176 if (bits_stored < 2 || bits_stored > 16) return false;
177 if (bits_allocated != 8 && bits_allocated != 16) return false;
178 if (samples_per_pixel != 1) return false;
179 return true;
180 }

References bits_allocated, bits_stored, and samples_per_pixel.

◆ valid_for_jpeg_ls()

bool kcenon::pacs::encoding::compression::image_params::valid_for_jpeg_ls ( ) const
inlinenodiscardnoexcept

Validates image parameters for JPEG-LS compression.

Returns
true if parameters are valid for JPEG-LS

JPEG-LS requirements:

  • 2-16 bit precision (per component)
  • bits_allocated must be 8 or 16
  • 1 (grayscale) or 3 (color) samples per pixel
  • Valid dimensions (non-zero, max 65535x65535)

Definition at line 210 of file image_params.h.

210 {
211 if (bits_stored < 2 || bits_stored > 16) return false;
212 if (bits_allocated != 8 && bits_allocated != 16) return false;
213 if (samples_per_pixel != 1 && samples_per_pixel != 3) return false;
214 if (width == 0 || height == 0) return false;
215 if (width > 65535 || height > 65535) return false;
216 return true;
217 }

References bits_allocated, bits_stored, height, samples_per_pixel, and width.

◆ valid_for_rle()

bool kcenon::pacs::encoding::compression::image_params::valid_for_rle ( ) const
inlinenodiscardnoexcept

Validates image parameters for RLE Lossless compression.

Returns
true if parameters are valid for RLE

RLE Lossless requirements:

  • bits_allocated must be 8 or 16
  • 1-3 samples per pixel (grayscale or RGB)
  • Valid dimensions (non-zero, max 65535x65535)
  • Maximum 15 segments (samples_per_pixel * bytes_per_sample)

Definition at line 229 of file image_params.h.

229 {
230 if (bits_allocated != 8 && bits_allocated != 16) return false;
232 if (width == 0 || height == 0) return false;
233 if (width > 65535 || height > 65535) return false;
234 // Check segment count limit (max 15 segments)
235 int bytes_per_sample = (bits_allocated + 7) / 8;
236 int num_segments = samples_per_pixel * bytes_per_sample;
237 if (num_segments > 15) return false;
238 return true;
239 }

References bits_allocated, height, samples_per_pixel, and width.

Member Data Documentation

◆ bits_allocated

◆ bits_stored

◆ height

◆ high_bit

◆ number_of_frames

uint32_t kcenon::pacs::encoding::compression::image_params::number_of_frames {1}

Number of frames in multi-frame image (0028,0008)

Definition at line 116 of file image_params.h.

116{1};

◆ photometric

◆ pixel_representation

uint16_t kcenon::pacs::encoding::compression::image_params::pixel_representation {0}

◆ planar_configuration

◆ samples_per_pixel

◆ width


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