Skip to content

Commit 2b47823

Browse files
Refactored variables to avoid naming conflicts
1 parent f32f2e3 commit 2b47823

11 files changed

Lines changed: 117 additions & 110 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ project(
88

99
set(DCMTKHTJ2K_VERSION_MAJOR 1)
1010
set(DCMTKHTJ2K_VERSION_MINOR 0)
11-
set(DCMTKHTJ2K_VERSION_BUILD 1)
11+
set(DCMTKHTJ2K_VERSION_BUILD 2)
1212
set(DCMTKHTJ2K_VERSION
1313
"${DCMTKHTJ2K_VERSION_MAJOR}.${DCMTKHTJ2K_VERSION_MINOR}.${DCMTKHTJ2K_VERSION_BUILD}"
1414
)

include/dcmtkhtj2k/djcparam.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ class DCMTKHTJ2K_EXPORT HtJ2kCodecParameter : public DcmCodecParameter {
3434
HtJ2kCodecParameter(
3535
OFBool jp2k_optionsEnabled, Uint16 jp2k_decompositions = 5,
3636
Uint16 jp2k_cblkwidth = 64, Uint16 jp2k_cblkheight = 64,
37-
J2K_ProgressionOrder jp2k_progressionOrder = EJ2KPO_default,
37+
HTJ2K_ProgressionOrder jp2k_progressionOrder = EHTJ2KPO_default,
3838
OFBool preferCookedEncoding = OFTrue, Uint32 fragmentSize = 0,
3939
OFBool createOffsetTable = OFTrue,
40-
J2K_UIDCreation uidCreation = EJ2KUC_default,
40+
HTJ2K_UIDCreation uidCreation = EHTJ2KUC_default,
4141
OFBool convertToSC = OFFalse,
42-
J2K_PlanarConfiguration planarConfiguration = EJ2KPC_restore,
42+
HTJ2K_PlanarConfiguration planarConfiguration = EHTJ2KPC_restore,
4343
OFBool ignoreOffsetTable = OFFalse);
4444

4545
/** constructor, for use with decoders. Initializes all encoder options to
@@ -52,8 +52,8 @@ class DCMTKHTJ2K_EXPORT HtJ2kCodecParameter : public DcmCodecParameter {
5252
* offset table when decompressing multiframe images
5353
*/
5454
HtJ2kCodecParameter(
55-
J2K_UIDCreation uidCreation = EJ2KUC_default,
56-
J2K_PlanarConfiguration planarConfiguration = EJ2KPC_restore,
55+
HTJ2K_UIDCreation uidCreation = EHTJ2KUC_default,
56+
HTJ2K_PlanarConfiguration planarConfiguration = EHTJ2KPC_restore,
5757
OFBool ignoreOffsetTable = OFFalse);
5858

5959
/// copy constructor
@@ -86,12 +86,12 @@ class DCMTKHTJ2K_EXPORT HtJ2kCodecParameter : public DcmCodecParameter {
8686
/** returns mode for SOP Instance UID creation
8787
* @return mode for SOP Instance UID creation
8888
*/
89-
J2K_UIDCreation getUIDCreation() const { return uidCreation_; }
89+
HTJ2K_UIDCreation getUIDCreation() const { return uidCreation_; }
9090

9191
/** returns mode for handling planar configuration
9292
* @return mode for handling planar configuration
9393
*/
94-
J2K_PlanarConfiguration getPlanarConfiguration() const {
94+
HTJ2K_PlanarConfiguration getPlanarConfiguration() const {
9595
return planarConfiguration_;
9696
}
9797

@@ -125,7 +125,7 @@ class DCMTKHTJ2K_EXPORT HtJ2kCodecParameter : public DcmCodecParameter {
125125
/** returns HT-J2K parameter progression order
126126
* @return HT-J2K parameter progression order
127127
*/
128-
J2K_ProgressionOrder get_progressionOrder() const {
128+
HTJ2K_ProgressionOrder get_progressionOrder() const {
129129
return jp2k_progressionOrder_;
130130
}
131131

@@ -161,7 +161,7 @@ class DCMTKHTJ2K_EXPORT HtJ2kCodecParameter : public DcmCodecParameter {
161161
Uint16 jp2k_cblkheight_;
162162

163163
/// HT-J2K progression order parameter
164-
J2K_ProgressionOrder jp2k_progressionOrder_;
164+
HTJ2K_ProgressionOrder jp2k_progressionOrder_;
165165

166166
/// maximum fragment size (in kbytes) for compression, 0 for unlimited.
167167
Uint32 fragmentSize_;
@@ -174,7 +174,7 @@ class DCMTKHTJ2K_EXPORT HtJ2kCodecParameter : public DcmCodecParameter {
174174
OFBool preferCookedEncoding_;
175175

176176
/// mode for SOP Instance UID creation (used both for encoding and decoding)
177-
J2K_UIDCreation uidCreation_;
177+
HTJ2K_UIDCreation uidCreation_;
178178

179179
/// flag indicating whether image should be converted to Secondary Capture
180180
/// upon compression
@@ -185,7 +185,7 @@ class DCMTKHTJ2K_EXPORT HtJ2kCodecParameter : public DcmCodecParameter {
185185

186186
/// flag describing how planar configuration of decompressed color images
187187
/// should be handled
188-
J2K_PlanarConfiguration planarConfiguration_;
188+
HTJ2K_PlanarConfiguration planarConfiguration_;
189189

190190
/// flag indicating if temporary files should be kept, false if they should be
191191
/// deleted after use

include/dcmtkhtj2k/djdecode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ class DCMTKHTJ2K_EXPORT HtJ2kDecoderRegistration {
2424
* table when decompressing multiframe images
2525
*/
2626
static void registerCodecs(
27-
J2K_UIDCreation uidcreation = EJ2KUC_default,
28-
J2K_PlanarConfiguration planarconfig = EJ2KPC_restore,
27+
HTJ2K_UIDCreation uidcreation = EHTJ2KUC_default,
28+
HTJ2K_PlanarConfiguration planarconfig = EHTJ2KPC_restore,
2929
OFBool ignoreOffsetTable = OFFalse);
3030

3131
/** deregisters decoders.

include/dcmtkhtj2k/djencode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ class DCMTKHTJ2K_EXPORT HtJ2kEncoderRegistration {
4343
static void registerCodecs(
4444
OFBool jp2k_optionsEnabled = OFFalse, Uint16 jp2k_decompositions = 5,
4545
Uint16 jp2k_cblkwidth = 64, Uint16 jp2k_cblkheight = 64,
46-
J2K_ProgressionOrder jp2k_progressionOrder = EJ2KPO_default,
46+
HTJ2K_ProgressionOrder jp2k_progressionOrder = EHTJ2KPO_default,
4747
OFBool preferCookedEncoding = OFTrue, Uint32 fragmentSize = 0,
4848
OFBool createOffsetTable = OFTrue,
49-
J2K_UIDCreation uidCreation = EJ2KUC_default,
49+
HTJ2K_UIDCreation uidCreation = EHTJ2KUC_default,
5050
OFBool convertToSC = OFFalse);
5151

5252
/** deregisters encoders.

include/dcmtkhtj2k/djutils.h

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "dcmtk/ofstd/ofcond.h" /* for class OFCondition */
77
#include "dldefine.h"
88

9-
#define DCMTKHTJ2K_VERSION_STRING "DCMTK HTJ2K"
9+
#define DCMTKHTJ2K_VERSION_STRING "DCMTK-HTJ2K 1.0.2"
1010

1111
// global definitions for logging mechanism provided by the oflog module
1212

@@ -21,147 +21,150 @@ extern DCMTKHTJ2K_EXPORT OFLogger DCM_ht2kLogger;
2121

2222
// include this file in doxygen documentation
2323

24-
/** @file djlsutil.h
24+
/** @file djutils.h
2525
* @brief enumerations, error constants and helper functions for the dcmhtj2k
2626
* module
2727
*/
2828

2929
/** describes the condition under which a compressed or decompressed image
3030
* receives a new SOP instance UID.
3131
*/
32-
enum J2K_UIDCreation {
32+
enum HTJ2K_UIDCreation {
3333
/** Upon compression, assign new SOP instance UID if compression is lossy.
3434
* Upon decompression never assign new SOP instance UID.
3535
*/
36-
EJ2KUC_default,
36+
EHTJ2KUC_default,
3737

3838
/// always assign new SOP instance UID on compression and decompression
39-
EJ2KUC_always,
39+
EHTJ2KUC_always,
4040

4141
/// never assign new SOP instance UID
42-
EJ2KUC_never
42+
EHTJ2KUC_never
4343
};
4444

4545
/** describes how the decoder should handle planar configuration of
4646
* decompressed color images.
4747
*/
48-
enum J2K_PlanarConfiguration {
48+
enum HTJ2K_PlanarConfiguration {
4949
/// restore planar configuration as indicated in data set
50-
EJ2KPC_restore,
50+
EHTJ2KPC_restore,
5151

5252
/** automatically determine whether color-by-plane is required from
5353
* the SOP Class UID and decompressed photometric interpretation
5454
*/
55-
EJ2KPC_auto,
55+
EHTJ2KPC_auto,
5656

5757
/// always create color-by-pixel planar configuration
58-
EJ2KPC_colorByPixel,
58+
EHTJ2KPC_colorByPixel,
5959

6060
/// always create color-by-plane planar configuration
61-
EJ2KPC_colorByPlane
61+
EHTJ2KPC_colorByPlane
6262
};
6363

6464
/** describes how the encoder handles the image bit depth
6565
* upon lossy compression.
6666
*/
67-
enum J2K_CompressionBitDepth {
67+
enum HTJ2K_CompressionBitDepth {
6868
/// keep original bit depth
69-
EJ2KBD_original,
69+
EHTJ2KBD_original,
7070

7171
/** limit bit depth to a certain value, i.e. scale down
7272
* if the original image bit depth is larger
7373
*/
74-
EJ2KBD_limit,
74+
EHTJ2KBD_limit,
7575

7676
/** force bit depth to a certain value, i.e. scale up
7777
* or scale down the original image to match the given
7878
* bit depth.
7979
*/
80-
EJ2KBD_force
80+
EHTJ2KBD_force
8181
};
8282

8383
/** describes the progression order used in the codestream
8484
*/
85-
enum J2K_ProgressionOrder {
85+
enum HTJ2K_ProgressionOrder {
8686
/// use default progression order as defined in HT-J2K standard
87-
EJ2KPO_default,
87+
EHTJ2KPO_default,
8888

8989
/// layer-resolution-component-position progression order
90-
EJ2KPO_LRCP,
90+
EHTJ2KPO_LRCP,
9191

9292
/// resolution-layer-component-position progression order
93-
EJ2KPO_RLCP,
93+
EHTJ2KPO_RLCP,
9494

9595
/// resolution-position-component-layer progression order
96-
EJ2KPO_RPCL,
96+
EHTJ2KPO_RPCL,
9797

9898
/// position-component-resolution-layer progression order
99-
EJ2KPO_PCRL,
99+
EHTJ2KPO_PCRL,
100100

101101
/// component-position-resolution-layer progression order
102-
EJ2KPO_CPRL
102+
EHTJ2KPO_CPRL
103103
};
104104

105105
// CONDITION CONSTANTS
106106

107107
/// error condition constant: Too small buffer used for image data (internal
108108
/// error)
109109
extern DCMTKHTJ2K_EXPORT const OFConditionConst
110-
EC_J2KUncompressedBufferTooSmall;
110+
EC_HTJ2KUncompressedBufferTooSmall;
111111

112112
/// error condition constant: Too small buffer used for compressed image data
113113
/// (internal error)
114-
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_J2KCompressedBufferTooSmall;
114+
extern DCMTKHTJ2K_EXPORT const OFConditionConst
115+
EC_HTJ2KCompressedBufferTooSmall;
115116

116117
/// error condition constant: The image uses some features which the codec does
117118
/// not support
118-
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_J2KCodecUnsupportedImageType;
119+
extern DCMTKHTJ2K_EXPORT const OFConditionConst
120+
EC_HTJ2KCodecUnsupportedImageType;
119121

120122
/// error condition constant: The codec was fed with invalid parameters (e.g.
121123
/// height = -1)
122-
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_J2KCodecInvalidParameters;
124+
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_HTJ2KCodecInvalidParameters;
123125

124126
/// error condition constant: The codec was fed with unsupported parameters
125127
/// (e.g. 32 bit per sample)
126-
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_J2KCodecUnsupportedValue;
128+
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_HTJ2KCodecUnsupportedValue;
127129

128130
/// error condition constant: The compressed image is invalid
129-
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_J2KInvalidCompressedData;
131+
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_HTJ2KInvalidCompressedData;
130132

131133
/// error condition constant: The images' color transformation is not supported
132134
/// in this bit depth
133135
extern DCMTKHTJ2K_EXPORT const OFConditionConst
134-
EC_J2KUnsupportedBitDepthForTransform;
136+
EC_HTJ2KUnsupportedBitDepthForTransform;
135137

136138
/// error condition constant: The images' color transformation is not supported
137-
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_J2KUnsupportedColorTransform;
139+
extern DCMTKHTJ2K_EXPORT const OFConditionConst
140+
EC_HTJ2KUnsupportedColorTransform;
138141

139142
/// error condition constant: Unsupported bit depth in HT-J2K transfer syntax
140-
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_J2KUnsupportedBitDepth;
143+
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_HTJ2KUnsupportedBitDepth;
141144

142145
/// error condition constant: Cannot compute number of fragments for HT-J2K
143146
/// frame
144147
extern DCMTKHTJ2K_EXPORT const OFConditionConst
145-
EC_J2KCannotComputeNumberOfFragments;
148+
EC_HTJ2KCannotComputeNumberOfFragments;
146149

147150
/// error condition constant: Image data mismatch between DICOM header and
148151
/// HT-J2K bitstream
149-
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_J2KImageDataMismatch;
152+
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_HTJ2KImageDataMismatch;
150153

151154
/// error condition constant: Unsupported photometric interpretation for
152155
/// near-lossless HT-J2K compression
153156
extern DCMTKHTJ2K_EXPORT const OFConditionConst
154-
EC_J2KUnsupportedPhotometricInterpretation;
157+
EC_HTJ2KUnsupportedPhotometricInterpretation;
155158

156159
/// error condition constant: Unsupported pixel representation for near-lossless
157160
/// HT-J2K compression
158161
extern DCMTKHTJ2K_EXPORT const OFConditionConst
159-
EC_J2KUnsupportedPixelRepresentation;
162+
EC_HTJ2KUnsupportedPixelRepresentation;
160163

161164
/// error condition constant: Unsupported type of image for HT-J2K compression
162-
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_J2KUnsupportedImageType;
165+
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_HTJ2KUnsupportedImageType;
163166

164167
/// error condition constant: Trailing data after image
165-
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_J2KTooMuchCompressedData;
168+
extern DCMTKHTJ2K_EXPORT const OFConditionConst EC_HTJ2KTooMuchCompressedData;
166169

167170
#endif

libsrc/djcodecd.cc

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ OFCondition HtJ2kDecoderBase::decode(
101101

102102
// we only support up to 16 bits per sample
103103
if ((imageBitsStored < 1) || (imageBitsStored > 16))
104-
return EC_J2KUnsupportedBitDepth;
104+
return EC_HTJ2KUnsupportedBitDepth;
105105

106106
// determine the number of bytes per sample (bits allocated) for the
107107
// de-compressed object.
@@ -169,7 +169,7 @@ OFCondition HtJ2kDecoderBase::decode(
169169
// changes if we're on the main level of the dataset,
170170
// which should always identify itself as dataset, not as item.
171171
if ((dataset->ident() == EVR_dataset) &&
172-
(djcp->getUIDCreation() == EJ2KUC_always)) {
172+
(djcp->getUIDCreation() == EHTJ2KUC_always)) {
173173
// create new SOP instance UID
174174
result = DcmCodec::newInstance((DcmItem *)dataset, NULL, NULL, NULL);
175175
}
@@ -227,7 +227,7 @@ OFCondition HtJ2kDecoderBase::decodeFrame(
227227

228228
// we only support up to 16 bits per sample
229229
if ((imageBitsStored < 1) || (imageBitsStored > 16))
230-
return EC_J2KUnsupportedBitDepth;
230+
return EC_HTJ2KUnsupportedBitDepth;
231231

232232
// determine the number of bytes per sample (bits allocated) for the
233233
// de-compressed object.
@@ -305,7 +305,8 @@ OFCondition HtJ2kDecoderBase::decodeFrame(
305305
// frame
306306
fragmentsForThisFrame = computeNumberOfFragments(
307307
imageFrames, frameNo, currentItem, ignoreOffsetTable, fromPixSeq);
308-
if (fragmentsForThisFrame == 0) result = EC_J2KCannotComputeNumberOfFragments;
308+
if (fragmentsForThisFrame == 0)
309+
result = EC_HTJ2KCannotComputeNumberOfFragments;
309310

310311
// determine planar configuration for uncompressed data
311312
OFString imageSopClass;
@@ -318,7 +319,7 @@ OFCondition HtJ2kDecoderBase::decodeFrame(
318319

319320
if (imageSamplesPerPixel > 1) {
320321
switch (cp->getPlanarConfiguration()) {
321-
case EJ2KPC_restore:
322+
case EHTJ2KPC_restore:
322323
// get planar configuration from dataset
323324
imagePlanarConfiguration = 2; // invalid value
324325
dataset->findAndGetUint16(DCM_PlanarConfiguration,
@@ -328,14 +329,14 @@ OFCondition HtJ2kDecoderBase::decodeFrame(
328329
imagePlanarConfiguration = determinePlanarConfiguration(
329330
imageSopClass, imagePhotometricInterpretation);
330331
break;
331-
case EJ2KPC_auto:
332+
case EHTJ2KPC_auto:
332333
imagePlanarConfiguration = determinePlanarConfiguration(
333334
imageSopClass, imagePhotometricInterpretation);
334335
break;
335-
case EJ2KPC_colorByPixel:
336+
case EHTJ2KPC_colorByPixel:
336337
imagePlanarConfiguration = 0;
337338
break;
338-
case EJ2KPC_colorByPlane:
339+
case EHTJ2KPC_colorByPlane:
339340
imagePlanarConfiguration = 1;
340341
break;
341342
}
@@ -393,11 +394,11 @@ OFCondition HtJ2kDecoderBase::decodeFrame(
393394
int height = siz.get_recon_height(0);
394395

395396
if (width != imageColumns)
396-
result = EC_J2KImageDataMismatch;
397+
result = EC_HTJ2KImageDataMismatch;
397398
else if (height != imageRows)
398-
result = EC_J2KImageDataMismatch;
399+
result = EC_HTJ2KImageDataMismatch;
399400
else if (num_comps != imageSamplesPerPixel)
400-
result = EC_J2KImageDataMismatch;
401+
result = EC_HTJ2KImageDataMismatch;
401402

402403
if (result.good()) {
403404
codestream.create();

0 commit comments

Comments
 (0)