|
1 | | -# dcmtk-htj2kojph |
| 1 | +# DCMTK-HTJ2K |
| 2 | + |
| 3 | +A DCMTK codec library for encoding and decoding DICOM images using the High-Throughput JPEG 2000 (HTJ2K) compression and decompression technique. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +DCMTK-HTJ2K provides HTJ2K codec support for [DCMTK](https://github.com/DCMTK/dcmtk), enabling seamless compression and decompression of DICOM images using the HTJ2K standard. The library integrates [OpenJPH](https://github.com/aous72/openjph) for HTJ2K operations with DCMTK's DICOM handling capabilities. |
| 8 | + |
| 9 | +### Supported Transfer Syntaxes |
| 10 | + |
| 11 | +- High Throughput JPEG 2000 Image Compression - Lossless Only (1.2.840.10008.1.2.4.201) |
| 12 | +- High Throughput JPEG 2000 with RPCL Options Image Compression - Lossless Only (1.2.840.10008.1.2.4.202) |
| 13 | +- High Throughput JPEG 2000 Image Compression (1.2.840.10008.1.2.4.203) |
| 14 | + |
| 15 | +## Features |
| 16 | + |
| 17 | +- **HTJ2K Encoding**: Compress DICOM images using HTJ2K lossless and lossy compression. |
| 18 | +- **HTJ2K Decoding**: Decompress HTJ2K-encoded DICOM images. |
| 19 | +- **DCMTK Integration**: Seamless integration with DCMTK codec framework. |
| 20 | +- **Configurable Parameters**: Support for codeblock dimensions, fragment sizes, and encoding options. |
| 21 | + |
| 22 | +## Dependencies |
| 23 | + |
| 24 | +- **DCMTK** (3.6.9 or higher) |
| 25 | +- **OpenJPH** (0.26.0 or higher) |
| 26 | +- **CMake** (3.12.0 or higher) |
| 27 | + |
| 28 | +## Building |
| 29 | + |
| 30 | +### Quick Build |
| 31 | + |
| 32 | +```bash |
| 33 | +./build.sh [Release|Debug] |
| 34 | +``` |
| 35 | + |
| 36 | +The build script accepts an optional build configuration parameter (`Release` or `Debug`). If not specified, it defaults to `Release`. |
| 37 | + |
| 38 | +The provided build script automatically downloads, builds, and installs dependencies. It also builds and installs DCMTK-HTJ2K: |
| 39 | +- Library files to `build/ReleaseOrDebug/lib/`. |
| 40 | +- Header files to `build/ReleaseOrDebug/include/DCMTKHTJ2K/`. |
| 41 | +- CMake configuration files to `build/ReleaseOrDebug/lib/cmake/DCMTKHTJ2K/`. |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +### Registering Encoder |
| 46 | + |
| 47 | +```cpp |
| 48 | +#include "dcmtkhtj2k/djencode.h" |
| 49 | + |
| 50 | +// Register HTJ2K encoder with default parameters |
| 51 | +HtJ2kEncoderRegistration::registerCodecs(); |
| 52 | + |
| 53 | +// Or with custom parameters |
| 54 | +HtJ2kEncoderRegistration::registerCodecs( |
| 55 | + OFTrue, // jp2k_optionsEnabled |
| 56 | + 5, // jp2k_decompositions (decompositions) |
| 57 | + 64, // jp2k_cblkwidth (codeblock width) |
| 58 | + 64, // jp2k_cblkheight (codeblock height) |
| 59 | + EJ2KPO_default, // jp2k_progressionOrder (progression order) |
| 60 | + OFTrue, // preferCookedEncoding |
| 61 | + 0, // fragmentSize (0 = unlimited) |
| 62 | + OFTrue, // createOffsetTable |
| 63 | + EJ2KUC_default, // uidCreation |
| 64 | + OFFalse // convertToSC |
| 65 | +); |
| 66 | +``` |
| 67 | + |
| 68 | +### Registering Decoder |
| 69 | + |
| 70 | +```cpp |
| 71 | +#include "dcmtkhtj2k/djdecode.h" |
| 72 | + |
| 73 | +// Register HTJ2K decoder with default parameters |
| 74 | +HtJ2kDecoderRegistration::registerCodecs(); |
| 75 | + |
| 76 | +// Or with custom parameters |
| 77 | +HtJ2kDecoderRegistration::registerCodecs( |
| 78 | + EJ2KUC_default, // uidCreation |
| 79 | + EJ2KPC_restore, // planarConfig |
| 80 | + OFFalse // ignoreOffsetTable |
| 81 | +); |
| 82 | +``` |
| 83 | + |
| 84 | +### Cleanup |
| 85 | + |
| 86 | +```cpp |
| 87 | +// Cleanup encoder |
| 88 | +HtJ2kEncoderRegistration::cleanup(); |
| 89 | + |
| 90 | +// Cleanup decoder |
| 91 | +HtJ2kDecoderRegistration::cleanup(); |
| 92 | +``` |
| 93 | + |
| 94 | +## Using in Your Project |
| 95 | + |
| 96 | +CMake Integration |
| 97 | +```bash |
| 98 | +find_package(DCMTKHTJ2K REQUIRED) |
| 99 | +target_link_libraries(your_target DCMTKHTJ2K) |
| 100 | +``` |
| 101 | + |
| 102 | +## API Documentation |
| 103 | + |
| 104 | +The library provides the following main classes: |
| 105 | + |
| 106 | +- **`HtJ2kEncoderRegistration`**: Singleton for registering HTJ2K encoder. |
| 107 | +- **`HtJ2kDecoderRegistration`**: Singleton for registering HTJ2K decoder. |
| 108 | +- **`HtJ2kCodecParameter`**: Codec configuration parameters. |
| 109 | +- **`HtJ2kEncoder`**: HTJ2K encoding implementation. |
| 110 | +- **`HtJ2kDecoder`**: HTJ2K decoding implementation. |
| 111 | + |
| 112 | +## License |
| 113 | +DCMTK-HTJ2K is released under the MIT License. |
0 commit comments