Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: add prototype decoding of HTJ2K #187

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions Source/DataStructureAndEncodingDefinition/gdcmTransferSyntax.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,15 @@ static const char *TSStrings[] = {
"1.2.840.10008.1.2.4.102",
// MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1
"1.2.840.10008.1.2.4.103",
// High-Throughput JPEG 2000 Image Compression (Lossless Only)
"1.2.840.10008.1.2.4.201",
// High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only)
"1.2.840.10008.1.2.4.202",
// High-Throughput JPEG 2000 Image Compression
"1.2.840.10008.1.2.4.203",
// Unknown
"Unknown Transfer Syntax", // Pretty sure we never use this case...
nullptr // Compilers have no obligation to finish by NULL, do it ourself
"Unknown Transfer Syntax", // Pretty sure we never use this case... until a new transfer syntax is added
nullptr // Compilers have no obligation to finish by NULL, do it ourselves
};

TransferSyntax::TSType TransferSyntax::GetTSType(const char *cstr)
Expand Down Expand Up @@ -162,7 +168,8 @@ bool TransferSyntax::IsLossy() const
TSField == MPEG2MainProfile ||
TSField == MPEG2MainProfileHighLevel ||
TSField == MPEG4AVCH264HighProfileLevel4_1 ||
TSField == MPEG4AVCH264BDcompatibleHighProfileLevel4_1
TSField == MPEG4AVCH264BDcompatibleHighProfileLevel4_1 ||
TSField == HTJ2K
)
{
return true;
Expand Down Expand Up @@ -211,7 +218,8 @@ bool TransferSyntax::IsLossless() const
TSField == MPEG2MainProfile ||
TSField == MPEG2MainProfileHighLevel ||
TSField == MPEG4AVCH264HighProfileLevel4_1 ||
TSField == MPEG4AVCH264BDcompatibleHighProfileLevel4_1
TSField == MPEG4AVCH264BDcompatibleHighProfileLevel4_1 ||
TSField == HTJ2K
)
{
return false;
Expand Down Expand Up @@ -300,6 +308,10 @@ bool TransferSyntax::IsEncapsulated() const
case MPEG4AVCH264BDcompatibleHighProfileLevel4_1:
//case ImplicitVRBigEndianACRNEMA:
//case WeirdPapryus:
case HTJ2KLossless:
case HTJ2KRPCLLossless:
case HTJ2K:

ret = true;
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ class GDCM_EXPORT TransferSyntax
MPEG2MainProfileHighLevel,
MPEG4AVCH264HighProfileLevel4_1,
MPEG4AVCH264BDcompatibleHighProfileLevel4_1,
HTJ2KLossless,
HTJ2KRPCLLossless,
HTJ2K,
TS_END
} TSType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ bool FileChangeTransferSyntax::InitializeCopy()
ISO_14495_1 = JPEG-LS Near-lossless Compression
ISO_15444_1 = JPEG 2000 Irreversible Compression
ISO_13818_2 = MPEG2 Compression
ISO_15444_15 = High-Throughput JPEG 2000 Irreversible Compression
*/
Attribute<0x0028,0x2114> at3;
const TransferSyntax ts_orig = Internals->TS;
Expand All @@ -467,6 +468,14 @@ bool FileChangeTransferSyntax::InitializeCopy()
static const CSComp newvalues2[] = {"ISO_14495_1"};
at3.SetValues( newvalues2, 1 );
}
else if (
ts_orig == TransferSyntax::HTJ2KLossless ||
ts_orig == TransferSyntax::HTJ2KRPCLLossless ||
ts_orig == TransferSyntax::HTJ2K )
{
static const CSComp newvalues2[] = {"ISO_15444_15"};
at3.SetValues( newvalues2, 1 );
}
else if (
ts_orig == TransferSyntax::JPEGBaselineProcess1 ||
ts_orig == TransferSyntax::JPEGExtendedProcess2_4 ||
Expand Down
5 changes: 4 additions & 1 deletion Source/MediaStorageAndFileFormat/gdcmJPEG2000Codec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,10 @@ bool JPEG2000Codec::CanDecode(TransferSyntax const &ts) const
return ts == TransferSyntax::JPEG2000Lossless
|| ts == TransferSyntax::JPEG2000
|| ts == TransferSyntax::JPEG2000Part2Lossless
|| ts == TransferSyntax::JPEG2000Part2;
|| ts == TransferSyntax::JPEG2000Part2
|| ts == TransferSyntax::HTJ2KLossless
|| ts == TransferSyntax::HTJ2KRPCLLossless
|| ts == TransferSyntax::HTJ2K;
}

bool JPEG2000Codec::CanCode(TransferSyntax const &ts) const
Expand Down
Loading