PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
frame_deflate_codec.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
11#ifndef PACS_ENCODING_COMPRESSION_FRAME_DEFLATE_CODEC_HPP
12#define PACS_ENCODING_COMPRESSION_FRAME_DEFLATE_CODEC_HPP
13
15
17
54public:
56 static constexpr std::string_view kTransferSyntaxUID =
57 "1.2.840.10008.1.2.11";
58
60 static constexpr int kDefaultCompressionLevel = 6;
61
63 static constexpr int kMinCompressionLevel = 1;
64
66 static constexpr int kMaxCompressionLevel = 9;
67
74 explicit frame_deflate_codec(
76
78
79 // Non-copyable but movable
84
87
88 [[nodiscard]] std::string_view transfer_syntax_uid() const noexcept override;
89 [[nodiscard]] std::string_view name() const noexcept override;
90 [[nodiscard]] bool is_lossy() const noexcept override;
91 [[nodiscard]] bool can_encode(const image_params& params) const noexcept override;
92 [[nodiscard]] bool can_decode(const image_params& params) const noexcept override;
93
95
98
103 [[nodiscard]] int compression_level() const noexcept;
104
106
109
121 [[nodiscard]] codec_result encode(
122 std::span<const uint8_t> pixel_data,
123 const image_params& params,
124 const compression_options& options = {}) const override;
125
133 [[nodiscard]] codec_result decode(
134 std::span<const uint8_t> compressed_data,
135 const image_params& params) const override;
136
138
139private:
141};
142
143} // namespace kcenon::pacs::encoding::compression
144
145#endif // PACS_ENCODING_COMPRESSION_FRAME_DEFLATE_CODEC_HPP
Abstract base class for image compression codecs.
Frame-level Deflate codec implementation (Supplement 244).
static constexpr int kMinCompressionLevel
Minimum zlib compression level (fastest)
int compression_level() const noexcept
Gets the current zlib compression level.
static constexpr int kDefaultCompressionLevel
Default zlib compression level (6 = balanced speed/ratio)
static constexpr int kMaxCompressionLevel
Maximum zlib compression level (best compression)
std::string_view transfer_syntax_uid() const noexcept override
Returns the Transfer Syntax UID supported by this codec.
frame_deflate_codec(int compression_level=kDefaultCompressionLevel)
Constructs a Frame Deflate codec instance.
frame_deflate_codec(const frame_deflate_codec &)=delete
bool can_encode(const image_params &params) const noexcept override
Checks if this codec supports the given image parameters.
bool is_lossy() const noexcept override
Checks if this codec produces lossy compression.
std::string_view name() const noexcept override
Returns a human-readable name for the codec.
frame_deflate_codec(frame_deflate_codec &&) noexcept
static constexpr std::string_view kTransferSyntaxUID
DICOM Transfer Syntax UID for Frame Deflate.
frame_deflate_codec & operator=(const frame_deflate_codec &)=delete
codec_result encode(std::span< const uint8_t > pixel_data, const image_params &params, const compression_options &options={}) const override
Compresses pixel data using zlib deflate.
bool can_decode(const image_params &params) const noexcept override
Checks if this codec can decode data with given parameters.
codec_result decode(std::span< const uint8_t > compressed_data, const image_params &params) const override
Decompresses deflate-compressed pixel data.
Compression quality settings for lossy codecs.
Parameters describing image pixel data.