Mercurial > hg > orthanc-wsi
changeset 176:c38811bf2992
Fix issue #163 (Failure to recognize MIRAX / 3DHISTECH images)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Feb 2020 14:10:19 +0100 |
parents | e3cbf890b588 |
children | ea62c89b264b |
files | Framework/Enumerations.cpp NEWS Resources/CMake/OpenJpegConfiguration.cmake |
diffstat | 3 files changed, 22 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Enumerations.cpp Fri Jan 31 17:44:03 2020 +0100 +++ b/Framework/Enumerations.cpp Tue Feb 04 14:10:19 2020 +0100 @@ -83,21 +83,37 @@ ImageCompression DetectFormatFromFile(const std::string& path) { + std::string lower; + Orthanc::Toolbox::ToLowerCase(lower, path); + std::string header; Orthanc::SystemToolbox::ReadHeader(header, path, 256); ImageCompression tmp = DetectFormatFromMemory(header.c_str(), header.size()); if (tmp != ImageCompression_Unknown) { - return tmp; + if (tmp == ImageCompression_Jpeg && + boost::algorithm::ends_with(lower, ".mrxs")) + { + /** + * Special case of MIRAX / 3DHISTECH images, that contain a JPEG + * thumbnail, and that are thus confused with JPEG. + * https://bitbucket.org/sjodogne/orthanc/issues/163/ + **/ + + LOG(WARNING) << "The file extension \".mrxs\" indicates a MIRAX / 3DHISTECH image, " + << "skipping auto-detection of the file format"; + return ImageCompression_Unknown; + } + else + { + return tmp; + } } // Cannot detect the format using the header, fallback to the use // of the filename extension - std::string lower; - Orthanc::Toolbox::ToLowerCase(lower, path); - if (boost::algorithm::ends_with(lower, ".jpeg") || boost::algorithm::ends_with(lower, ".jpg")) {
--- a/NEWS Fri Jan 31 17:44:03 2020 +0100 +++ b/NEWS Tue Feb 04 14:10:19 2020 +0100 @@ -5,6 +5,7 @@ * Support of grayscale images * Fix issue #139 (OrthancWSIDicomizer PixelSpacing) * Fix issue #144 (OrthancWSIDicomizer PhotometricInterpretation) +* Fix issue #163 (Failure to recognize MIRAX / 3DHISTECH images) Version 0.6 (2019-01-26)
--- a/Resources/CMake/OpenJpegConfiguration.cmake Fri Jan 31 17:44:03 2020 +0100 +++ b/Resources/CMake/OpenJpegConfiguration.cmake Tue Feb 04 14:10:19 2020 +0100 @@ -121,7 +121,7 @@ CHECK_INCLUDE_FILE_CXX(${OPENJPEG_INCLUDE_DIR}/openjpeg.h HAVE_OPENJPEG_H) if (NOT HAVE_OPENJPEG_H) - message(FATAL_ERROR "Please install the OpenJPEG development package") + message(FATAL_ERROR "Please install the OpenJPEG development package (libopenjp2-*dev on Ubuntu)") endif() CHECK_LIBRARY_EXISTS(openjpeg opj_image_create "" HAVE_OPENJPEG_LIB)