# HG changeset patch # User Sebastien Jodogne # Date 1762352480 -3600 # Node ID f1b10507b0d70150bdaef5be34da5f5ddc15ae5e # Parent 330cd7f020e26d209bd7eff8e12bbc68f6c92d28 fix compatibility with dcmtk < 3.6.4 diff -r 330cd7f020e2 -r f1b10507b0d7 Applications/Dicomizer.cpp --- a/Applications/Dicomizer.cpp Wed Nov 05 12:02:12 2025 +0100 +++ b/Applications/Dicomizer.cpp Wed Nov 05 15:21:20 2025 +0100 @@ -526,17 +526,28 @@ std::unique_ptr item2(new DcmItem); OrthancWSI::DicomToolbox::SetStringTag(*item2, DCM_OpticalPathIdentifier, opticalPathId); - std::unique_ptr item3(new DcmItem); - OrthancWSI::DicomToolbox::SetStringTag(*item3, DCM_FrameType, "DERIVED\\PRIMARY\\VOLUME\\NONE"); - std::unique_ptr sequence(new DcmSequenceOfItems(DCM_SharedFunctionalGroupsSequence)); std::unique_ptr sequence2(new DcmSequenceOfItems(DCM_OpticalPathIdentificationSequence)); - std::unique_ptr sequence3(new DcmSequenceOfItems(DCM_WholeSlideMicroscopyImageFrameTypeSequence)); + +#if DCMTK_VERSION_NUMBER >= 364 + { + std::unique_ptr item3(new DcmItem); + OrthancWSI::DicomToolbox::SetStringTag(*item3, DCM_FrameType, "DERIVED\\PRIMARY\\VOLUME\\NONE"); + + std::unique_ptr sequence3(new DcmSequenceOfItems(DCM_WholeSlideMicroscopyImageFrameTypeSequence)); + if (!sequence3->insert(item3.release(), false, false).good() || + !item->insert(sequence3.release(), false, false).good()) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError); + } + } +#else + LOG(WARNING) << "Your version of DCMTK is too old to support the \"" + << OrthancWSI::DicomToolbox::GetTagName(DCM_WholeSlideMicroscopyImageFrameTypeSequence) << "\" DICOM tag"; +#endif if (!sequence2->insert(item2.release(), false, false).good() || - !sequence3->insert(item3.release(), false, false).good() || !item->insert(sequence2.release(), false, false).good() || - !item->insert(sequence3.release(), false, false).good() || !sequence->insert(item.release(), false, false).good() || !dataset.insert(sequence.release(), true /* replace */, false).good()) {