# HG changeset patch # User Alain Mazy # Date 1782117056 -7200 # Node ID 004b351797fec8ac2c380e1f700fd77eff5fe293 # Parent cd1a8195a03c7c449e4db06f37c83001eebb907f Zip from /archive: added SeriesNumber and use ' - ' as a separator instead of ' ' diff -r cd1a8195a03c -r 004b351797fe NEWS --- a/NEWS Wed Jun 17 18:06:41 2026 +0200 +++ b/NEWS Mon Jun 22 10:30:56 2026 +0200 @@ -33,6 +33,9 @@ "/modalities/../get", "queries/../answers/../retrieve" now always overwrites the "DicomAet" and the "DicomModalities.LocalAet" configurations. * Optimized the "/patients|studies|series|instances/../statistics" routes. +* Updated the naming structure of the zip downloaded from "/../../archive" routes. Notably added + SeriesNumber at the series level and now using " - " instead of " " to separate DICOM tags used + in folder names. Plugin SDK ---------- diff -r cd1a8195a03c -r 004b351797fe OrthancServer/Sources/ServerJobs/ArchiveJob.cpp --- a/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp Wed Jun 17 18:06:41 2026 +0200 +++ b/OrthancServer/Sources/ServerJobs/ArchiveJob.cpp Mon Jun 22 10:30:56 2026 +0200 @@ -705,6 +705,7 @@ const std::string& publicId) ORTHANC_OVERRIDE { std::string path; + std::vector pathParts; DicomMap tags; ResourceType resourceIdLevel = GetResourceIdType(level); @@ -716,18 +717,48 @@ { case ArchiveResourceType_Patient: case ArchiveResourceType_PatientInfoFromStudy: - path = GetTag(tags, DICOM_TAG_PATIENT_ID) + " " + GetTag(tags, DICOM_TAG_PATIENT_NAME); - break; - + { + pathParts.push_back(GetTag(tags, DICOM_TAG_PATIENT_ID)); + std::string patientName = GetTag(tags, DICOM_TAG_PATIENT_NAME); + if (!patientName.empty()) + { + pathParts.push_back(patientName); + } + }; break; case ArchiveResourceType_Study: - path = GetTag(tags, DICOM_TAG_ACCESSION_NUMBER) + " " + GetTag(tags, DICOM_TAG_STUDY_DESCRIPTION); - break; - + { + std::string accessionNumber = GetTag(tags, DICOM_TAG_ACCESSION_NUMBER); + std::string studyDescription = GetTag(tags, DICOM_TAG_STUDY_DESCRIPTION); + if (!accessionNumber.empty()) + { + pathParts.push_back(accessionNumber); + } + if (!studyDescription.empty()) + { + pathParts.push_back(studyDescription); + } + }; break; case ArchiveResourceType_Series: { + std::string seriesNumber = GetTag(tags, DICOM_TAG_SERIES_NUMBER); std::string modality = GetTag(tags, DICOM_TAG_MODALITY); - path = modality + " " + GetTag(tags, DICOM_TAG_SERIES_DESCRIPTION); - + std::string seriesDescription = GetTag(tags, DICOM_TAG_SERIES_DESCRIPTION); + + if (!seriesNumber.empty()) + { + pathParts.push_back(seriesNumber); + } + + if (!modality.empty()) + { + pathParts.push_back(modality); + } + + if (!seriesDescription.empty()) + { + pathParts.push_back(seriesDescription); + } + if (modality.size() == 0) { snprintf(instanceFormat_, sizeof(instanceFormat_) - 1, "%%08d.dcm"); @@ -744,16 +775,14 @@ } counter_ = 0; - - break; - } - + }; break; default: THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError); } } - path = Toolbox::StripSpaces(path); + Toolbox::JoinStrings(path, pathParts, " - "); + path = Toolbox::StripSpaces(path); if (path.empty() || (static_cast(boost::count(path, '^')) == path.size())) // this happens with non ASCII patient names: only the '^' remains and this is not a valid zip folder name