# HG changeset patch # User Sebastien Jodogne # Date 1623679386 -7200 # Node ID f879d716a25c173bfc80b4fa962f46f030f50379 # Parent be67c5efae626040c20c3ef1dd00fddf5eb44aba Prevent changing SOP class UID from "MR Image Storage" to "Enhanced MR Image Storage" during the transcoding diff -r be67c5efae62 -r f879d716a25c NEWS --- 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) ======================== diff -r be67c5efae62 -r f879d716a25c Plugin/Plugin.cpp --- 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 #include #include +#include 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());