Skip to content

Commit

Permalink
ENH: Add HTJP2K support for jph files
Browse files Browse the repository at this point in the history
  • Loading branch information
blowekamp committed Dec 4, 2024
1 parent f3da5f6 commit b52c2a6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ JPEG2000ImageIO::JPEG2000ImageIO()
this->AddSupportedWriteExtension(ext);
this->AddSupportedReadExtension(ext);
}

#if OPJ_VERSION_MAJOR >= 2 && OPJ_VERSION_MINOR >= 5
// HTJ2K with JP2 boxes OpenJPEG only support decoding as of 2.5.0
this->AddSupportedReadExtension(".jph");
#endif
}

JPEG2000ImageIO::~JPEG2000ImageIO() = default;
Expand All @@ -112,7 +117,7 @@ JPEG2000ImageIO::CanReadFile(const char * filename)
itkDebugMacro("JPEG2000ImageIO::CanReadFile()");

//
// If the file exists, and have extension .j2k or jp2 or jpt, then we are good
// If the file exists, and have extension j2k or jp2 or jpt or jph, then we are good
// to read it.
//
if (!itksys::SystemTools::FileExists(filename))
Expand Down Expand Up @@ -168,6 +173,11 @@ JPEG2000ImageIO::ReadImageInformation()
this->m_Internal->m_DecompressionParameters.decod_format =
static_cast<int>(JPEG2000ImageIOInternal::DecodingFormatEnum::JPT_CFMT);
}
else if (extension == ".jph")
{
this->m_Internal->m_DecompressionParameters.decod_format =
static_cast<int>(JPEG2000ImageIOInternal::DecodingFormatEnum::JP2_CFMT);
}

switch (this->m_Internal->m_DecompressionParameters.decod_format)
{
Expand Down

0 comments on commit b52c2a6

Please sign in to comment.