Mercurial > hg > orthanc
changeset 6959:004b351797fe
Zip from /archive: added SeriesNumber and use ' - ' as a separator instead of ' '
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Mon, 22 Jun 2026 10:30:56 +0200 |
| parents | cd1a8195a03c |
| children | ba68acff977a |
| files | NEWS OrthancServer/Sources/ServerJobs/ArchiveJob.cpp |
| diffstat | 2 files changed, 45 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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 ----------
--- 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<std::string> 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<size_t>(boost::count(path, '^')) == path.size())) // this happens with non ASCII patient names: only the '^' remains and this is not a valid zip folder name
