Mercurial > hg > orthanc
changeset 6348:20c1a564e44d
worklist api: force + modality + startdate
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Thu, 23 Oct 2025 10:23:40 +0200 |
| parents | 9c1f13e9b344 |
| children | 4364c26b0339 |
| files | OrthancFramework/Sources/DicomFormat/DicomTag.h OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp |
| diffstat | 2 files changed, 21 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomFormat/DicomTag.h Wed Oct 22 13:30:48 2025 +0200 +++ b/OrthancFramework/Sources/DicomFormat/DicomTag.h Thu Oct 23 10:23:40 2025 +0200 @@ -238,9 +238,10 @@ static const DicomTag DICOM_TAG_REFERENCED_FILE_ID(0x0004, 0x1500); // Tags for DicomWeb - static const Orthanc::DicomTag DICOM_TAG_RETRIEVE_URL(0x0008, 0x1190); + static const DicomTag DICOM_TAG_RETRIEVE_URL(0x0008, 0x1190); // Tags for Worklists - static const Orthanc::DicomTag DICOM_TAG_SCHEDULED_PROCEDURE_STEP_SEQUENCE(0x0040, 0x0100); - static const Orthanc::DicomTag DICOM_TAG_SCHEDULED_STATION_AETITLE(0x0040, 0x0001); + static const DicomTag DICOM_TAG_SCHEDULED_PROCEDURE_STEP_SEQUENCE(0x0040, 0x0100); + static const DicomTag DICOM_TAG_SCHEDULED_STATION_AETITLE(0x0040, 0x0001); + static const DicomTag DICOM_TAG_SCHEDULED_PROCEDURE_STEP_START_DATE(0x0040, 0x0002); }
--- a/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Wed Oct 22 13:30:48 2025 +0200 +++ b/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Thu Oct 23 10:23:40 2025 +0200 @@ -29,6 +29,7 @@ #include "../../../../OrthancFramework/Sources/Toolbox.h" #include "../../../../OrthancFramework/Sources/SystemToolbox.h" #include "../../../../OrthancFramework/Sources/DicomParsing/ParsedDicomFile.h" +#include "../../../../OrthancFramework/Sources/DicomFormat/DicomPath.h" #include "../../../../OrthancFramework/Sources/DicomParsing/FromDcmtkBridge.h" #include "../../../../OrthancFramework/Sources/DicomFormat/DicomInstanceHasher.h" #include "../Common/OrthancPluginCppWrapper.h" @@ -578,13 +579,27 @@ throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "'Tags' field is missing or not a JSON object"); } + bool force = body.isMember("Force") && body["Force"].asBool(); + Json::Value& jsonWorklist = body["Tags"]; std::unique_ptr<Orthanc::ParsedDicomFile> dicom(Orthanc::ParsedDicomFile::CreateFromJson(jsonWorklist, Orthanc::DicomFromJsonFlags_None, "")); - if (!dicom->HasTag(Orthanc::DICOM_TAG_SCHEDULED_PROCEDURE_STEP_SEQUENCE)) + if (!force) { - throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "'Tags' is missing a ScheduledProcedureStepSequence"); + if (!dicom->HasTag(Orthanc::DICOM_TAG_SCHEDULED_PROCEDURE_STEP_SEQUENCE)) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "'Tags' is missing a 'ScheduledProcedureStepSequence'. Use 'Force': true to bypass this check."); + } + Orthanc::DicomMap step; + if (!dicom->LookupSequenceItem(step, Orthanc::DicomPath::Parse("ScheduledProcedureStepSequence"), 0) || !step.HasTag(Orthanc::DICOM_TAG_MODALITY)) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "'ScheduledProcedureStepSequence' is missing a 'Modality' Use 'Force': true to bypass this check."); + } + if (!dicom->LookupSequenceItem(step, Orthanc::DicomPath::Parse("ScheduledProcedureStepSequence"), 0) || !step.HasTag(Orthanc::DICOM_TAG_SCHEDULED_PROCEDURE_STEP_START_DATE)) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_BadFileFormat, "'ScheduledProcedureStepSequence' is missing a 'ScheduledProcedureStepStartDate' Use 'Force': true to bypass this check."); + } } dicom->SetIfAbsent(Orthanc::DICOM_TAG_MEDIA_STORAGE_SOP_CLASS_UID, "1.2.276.0.7230010.3.1.0.1");
