changeset 48:f879d716a25c

Prevent changing SOP class UID from "MR Image Storage" to "Enhanced MR Image Storage" during the transcoding
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 14 Jun 2021 16:03:06 +0200 (2021-06-14)
parents be67c5efae62
children 294473d51c84 35cc6de67002
files NEWS Plugin/Plugin.cpp
diffstat 2 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Sat Jun 12 09:32:02 2021 +0200
+++ b/NEWS	Mon Jun 14 16:03:06 2021 +0200
@@ -1,6 +1,9 @@
 Pending changes in the mainline
 ===============================
 
+* Prevent changing SOP class UID from "MR Image Storage" to "Enhanced
+  MR Image Storage" during the transcoding
+
 
 Version 1.2 (2020-12-17)
 ========================
--- a/Plugin/Plugin.cpp	Sat Jun 12 09:32:02 2021 +0200
+++ b/Plugin/Plugin.cpp	Mon Jun 14 16:03:06 2021 +0200
@@ -35,6 +35,7 @@
 #include <gdcmTagKeywords.h>
 #include <gdcmUIDGenerator.h>
 #include <gdcmVersion.h>
+#include <gdcmImageHelper.h>
 
 
 static OrthancPlugins::GdcmDecoderCache  cache_;
@@ -192,6 +193,23 @@
                              const gdcm::Image&         image,
                              const gdcm::ImageReader&   reader)
 {
+  /**
+   * In GDCM, if "ForceRescaleInterceptSlope" is "false" (the default
+   * value), the SOP Class UID (0008,0016) might be changed from
+   * 1.2.840.10008.5.1.4.1.1.4 (MR Image Storage) to
+   * 1.2.840.10008.5.1.4.1.1.4.1 (Enhanced MR Image Storage), because
+   * of function "ImageHelper::ComputeMediaStorageFromModality()" that
+   * is called by "ImageWriter::ComputeTargetMediaStorage()". But,
+   * changing the SOP Class UID is unexpected if doing transcoding.
+   *
+   * As another side-effect, the DICOM tags "ImagePositionPatient"
+   * (0020,0032) and "ImageOrientationPatient" (0020,0037) are removed
+   * from the root of the dataset, and moved into subsequence "Shared
+   * Functional Groups Sequence" (5200,9229). This leads to issue
+   * LSD-598.
+   **/
+  gdcm::ImageHelper::SetForceRescaleInterceptSlope(true);
+
   gdcm::ImageWriter writer;
   writer.SetImage(image);
   writer.SetFile(reader.GetFile());