changeset 5148:2df546a76e17

If specifying 'Transcode' option to /modify or /anonymize, this value will take over the 'IngestTranscoding' global configuration
author Alain Mazy <am@osimis.io>
date Fri, 27 Jan 2023 12:56:55 +0100
parents 19ccae2e0371
children 05112ff6ba22 6ff13c95f62f
files NEWS OrthancServer/Sources/DicomInstanceToStore.h OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp
diffstat 5 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Fri Jan 27 11:49:28 2023 +0100
+++ b/NEWS	Fri Jan 27 12:56:55 2023 +0100
@@ -26,6 +26,8 @@
     tags (PatientName, PatientBirthDate, ...)
 * Automatically reconstruct the modified resources at the end of the DICOM modifications job to ensure
   improved consistency of the DICOM model.
+* If specifying 'Transcode' option to /modify or /anonymize, this value will take over the 'IngestTranscoding'
+  global configuration
 * Allow the HTTP server to return responses > 2GB (fixes asynchronous download of zip studies > 2GB)
 * /modalities/.../store now accepts "CalledAet", "Host", "Port" to override the modality configuration 
   from the configuration file for a specific operation.
--- a/OrthancServer/Sources/DicomInstanceToStore.h	Fri Jan 27 11:49:28 2023 +0100
+++ b/OrthancServer/Sources/DicomInstanceToStore.h	Fri Jan 27 12:56:55 2023 +0100
@@ -47,6 +47,11 @@
 
     MetadataMap          metadata_;
     DicomInstanceOrigin  origin_;
+    bool                 skipIngestTranscoding_;
+
+    DicomInstanceToStore()
+    : skipIngestTranscoding_(false)
+    {}
 
   public:
     virtual ~DicomInstanceToStore()
@@ -64,8 +69,16 @@
 
     static DicomInstanceToStore* CreateFromDcmDataset(DcmDataset& dataset);
 
+    void SetSkipIngestTranscoding(bool value)
+    {
+      skipIngestTranscoding_ = value;
+    }
 
- 
+    bool SkipIngestTranscoding() const
+    {
+      return skipIngestTranscoding_;
+    }
+
     void SetOrigin(const DicomInstanceOrigin& origin)
     {
       origin_ = origin;
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Fri Jan 27 11:49:28 2023 +0100
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestAnonymizeModify.cpp	Fri Jan 27 12:56:55 2023 +0100
@@ -111,6 +111,9 @@
   {
     // Check out "DicomModification::ParseAnonymizationRequest()"
     call.GetDocumentation()
+      .SetRequestField(TRANSCODE, RestApiCallDocumentation::Type_String,
+                       "Transcode the DICOM instances to the provided DICOM transfer syntax: "
+                       "https://book.orthanc-server.com/faq/transcoding.html", false)
       .SetRequestField(FORCE, RestApiCallDocumentation::Type_Boolean,
                        "Allow the modification of tags related to DICOM identifiers, at the risk of "
                        "breaking the DICOM model of the real world", false)
--- a/OrthancServer/Sources/ServerContext.cpp	Fri Jan 27 11:49:28 2023 +0100
+++ b/OrthancServer/Sources/ServerContext.cpp	Fri Jan 27 12:56:55 2023 +0100
@@ -762,7 +762,7 @@
                                                               bool isReconstruct)
   {
 
-    if (!isIngestTranscoding_)
+    if (!isIngestTranscoding_ || dicom->SkipIngestTranscoding())
     {
       // No automated transcoding. This was the only path in Orthanc <= 1.6.1.
       return StoreAfterTranscoding(resultPublicId, *dicom, mode, isReconstruct);
--- a/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Fri Jan 27 11:49:28 2023 +0100
+++ b/OrthancServer/Sources/ServerJobs/ResourceModificationJob.cpp	Fri Jan 27 12:56:55 2023 +0100
@@ -273,6 +273,7 @@
 
     std::unique_ptr<DicomInstanceToStore> toStore(DicomInstanceToStore::CreateFromParsedDicomFile(*modified));
     toStore->SetOrigin(origin_);
+    toStore->SetSkipIngestTranscoding(transcode_); // do not apply IngestTranscoding if you have forced the transfer syntax during the modification/anonymization
 
 
     /**