SlideIO 2.0.0
Open-source library for reading of medical images
Loading...
Searching...
No Matches
encodeparameters.hpp
1// This file is part of slideio project.
2// It is subject to the license terms in the LICENSE file found in the top-level directory
3// of this distribution and at http://slideio.com/license.html.
4#pragma once
5
6namespace slideio {
7 class EncodeParameters {
8 slideio::Compression getCompression() const {
9 return m_compression;
10 }
11 protected:
12 Compression m_compression;
13 };
14 class JpegEncodeParameters : public EncodeParameters {
15 public:
16 JpegEncodeParameters(int quality = 95) {
17 m_compression = Compression::Jpeg;
18 m_quality = quality;
19 }
20 int getQuality() const {
21 return m_quality;
22 }
23 void setQuality(int quality) {
24 m_quality = quality;
25 }
26 private:
27 int m_quality;
28 };
29 class JP2KEncodeParameters : public EncodeParameters {
30 public:
31 enum Codec {
32 J2KStream,
33 J2KFile
34 };
35 JP2KEncodeParameters(float rate = 4.5, Codec codec = Codec::J2KStream) {
36 m_compression = Compression::Jpeg2000;
37 m_subSamplingDX = 1;
38 m_subSamplingDY = 1;
39 m_codecFormat = codec;
40 m_compressionRate = rate;
41 }
42 int getSubSamplingDx() const {
43 return m_subSamplingDX;
44 }
45 void setSubSamplingDx(int subSamplingDx) {
46 m_subSamplingDX = subSamplingDx;
47 }
48 int getSubSamplingDy() const {
49 return m_subSamplingDY;
50 }
51 void setSubSamplingDy(int subSamplingDy) {
52 m_subSamplingDY = subSamplingDy;
53 }
54 Codec getCodecFormat() const {
55 return m_codecFormat;
56 }
57 void setCodecFormat(Codec codecFormat) {
58 m_codecFormat = codecFormat;
59 }
60 float getCompressionRate() const {
61 return m_compressionRate;
62 }
63 void setCompressionRate(float compressionRate) {
64 m_compressionRate = compressionRate;
65 }
66 private:
67 int m_subSamplingDX;
68 int m_subSamplingDY;
69 Codec m_codecFormat;
70 float m_compressionRate;
71 };
72}
Definition: exceptions.hpp:12
Compression
raster data compression enum
Definition: slideio_enums.hpp:12
@ Jpeg
JPEG compression.
@ Jpeg2000
JPEG 2000 compression.