00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef DCMJPLS_DJCODEC_H
00030 #define DCMJPLS_DJCODEC_H
00031
00032 #include "dcmtk/config/osconfig.h"
00033 #include "dcmtk/dcmdata/dccodec.h"
00034 #include "dcmtk/dcmdata/dcofsetl.h"
00035 #include "dcmtk/ofstd/ofstring.h"
00036
00037 class DJLSRepresentationParameter;
00038 class DJLSCodecParameter;
00039 class DicomImage;
00040
00047 class DJLSEncoderBase : public DcmCodec
00048 {
00049 public:
00050
00052 DJLSEncoderBase();
00053
00055 virtual ~DJLSEncoderBase();
00056
00067 virtual OFCondition decode(
00068 const DcmRepresentationParameter * fromRepParam,
00069 DcmPixelSequence * pixSeq,
00070 DcmPolymorphOBOW& uncompressedPixelData,
00071 const DcmCodecParameter * cp,
00072 const DcmStack& objStack) const;
00073
00099 virtual OFCondition decodeFrame(
00100 const DcmRepresentationParameter * fromParam,
00101 DcmPixelSequence * fromPixSeq,
00102 const DcmCodecParameter * cp,
00103 DcmItem *dataset,
00104 Uint32 frameNo,
00105 Uint32& startFragment,
00106 void *buffer,
00107 Uint32 bufSize,
00108 OFString& decompressedColorModel) const;
00109
00124 virtual OFCondition encode(
00125 const Uint16 * pixelData,
00126 const Uint32 length,
00127 const DcmRepresentationParameter * toRepParam,
00128 DcmPixelSequence * & pixSeq,
00129 const DcmCodecParameter *cp,
00130 DcmStack & objStack) const;
00131
00146 virtual OFCondition encode(
00147 const E_TransferSyntax fromRepType,
00148 const DcmRepresentationParameter * fromRepParam,
00149 DcmPixelSequence * fromPixSeq,
00150 const DcmRepresentationParameter * toRepParam,
00151 DcmPixelSequence * & toPixSeq,
00152 const DcmCodecParameter * cp,
00153 DcmStack & objStack) const;
00154
00162 virtual OFBool canChangeCoding(
00163 const E_TransferSyntax oldRepType,
00164 const E_TransferSyntax newRepType) const;
00165
00179 virtual OFCondition determineDecompressedColorModel(
00180 const DcmRepresentationParameter *fromParam,
00181 DcmPixelSequence *fromPixSeq,
00182 const DcmCodecParameter *cp,
00183 DcmItem *dataset,
00184 OFString &decompressedColorModel) const;
00185
00186 private:
00187
00192 virtual E_TransferSyntax supportedTransferSyntax() const = 0;
00193
00206 OFCondition losslessRawEncode(
00207 const Uint16 *pixelData,
00208 const Uint32 length,
00209 DcmItem *dataset,
00210 const DJLSRepresentationParameter *djrp,
00211 DcmPixelSequence * & pixSeq,
00212 const DJLSCodecParameter *djcp,
00213 double& compressionRatio) const;
00214
00228 OFCondition losslessCookedEncode(
00229 const Uint16 * pixelData,
00230 const Uint32 length,
00231 DcmItem *dataset,
00232 const DJLSRepresentationParameter *djrp,
00233 DcmPixelSequence * & pixSeq,
00234 const DJLSCodecParameter *djcp,
00235 double& compressionRatio,
00236 Uint16 nearLosslessDeviation) const;
00237
00243 OFCondition adjustOverlays(
00244 DcmItem *dataset,
00245 DicomImage& image) const;
00246
00254 OFCondition updateLossyCompressionRatio(
00255 DcmItem *dataset,
00256 double ratio) const;
00257
00266 OFCondition updateDerivationDescription(
00267 DcmItem *dataset,
00268 const DJLSRepresentationParameter *djrp,
00269 double ratio) const;
00270
00285 OFCondition compressRawFrame(
00286 const Uint8 *framePointer,
00287 Uint16 bitsAllocated,
00288 Uint16 columns,
00289 Uint16 rows,
00290 Uint16 samplesPerPixel,
00291 Uint16 planarConfiguration,
00292 const OFString& photometricInterpretation,
00293 DcmPixelSequence *pixelSequence,
00294 DcmOffsetList &offsetList,
00295 unsigned long &compressedSize,
00296 const DJLSCodecParameter *djcp) const;
00297
00309 OFCondition compressCookedFrame(
00310 DcmPixelSequence *pixelSequence,
00311 DicomImage *dimage,
00312 const OFString& photometricInterpretation,
00313 DcmOffsetList &offsetList,
00314 unsigned long &compressedSize,
00315 const DJLSCodecParameter *djcp,
00316 Uint32 frame,
00317 Uint16 nearLosslessDeviation) const;
00318
00328 OFCondition convertToUninterleaved(
00329 Uint8 *target,
00330 const Uint8 *source,
00331 Uint16 components,
00332 Uint32 width,
00333 Uint32 height,
00334 Uint16 bitsAllocated) const;
00335
00345 OFCondition convertToSampleInterleaved(
00346 Uint8 *target,
00347 const Uint8 *source,
00348 Uint16 components,
00349 Uint32 width,
00350 Uint32 height,
00351 Uint16 bitsAllocated) const;
00352 };
00353
00354
00357 class DJLSLosslessEncoder : public DJLSEncoderBase
00358 {
00363 virtual E_TransferSyntax supportedTransferSyntax() const;
00364 };
00365
00368 class DJLSNearLosslessEncoder : public DJLSEncoderBase
00369 {
00374 virtual E_TransferSyntax supportedTransferSyntax() const;
00375 };
00376
00377 #endif
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435