diff OrthancServer/ParsedDicomFile.cpp @ 1090:e494ceb8d763

support more encodings
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 05 Aug 2014 12:04:23 +0200
parents 564e39d6df13
children a66224eec125
line wrap: on
line diff
--- a/OrthancServer/ParsedDicomFile.cpp	Tue Aug 05 08:49:25 2014 +0200
+++ b/OrthancServer/ParsedDicomFile.cpp	Tue Aug 05 12:04:23 2014 +0200
@@ -1215,4 +1215,71 @@
   {
     return pimpl_->encoding_;
   }
+
+
+  void ParsedDicomFile::SetEncoding(Encoding encoding)
+  {
+    std::string s;
+
+    // http://www.dabsoft.ch/dicom/3/C.12.1.1.2/
+    switch (encoding)
+    {
+      case Encoding_Utf8:
+      case Encoding_Ascii:
+        s = "ISO_IR 192";
+        break;
+
+      case Encoding_Latin1:
+        s = "ISO_IR 100";
+        break;
+
+      case Encoding_Latin2:
+        s = "ISO_IR 101";
+        break;
+
+      case Encoding_Latin3:
+        s = "ISO_IR 109";
+        break;
+
+      case Encoding_Latin4:
+        s = "ISO_IR 110";
+        break;
+
+      case Encoding_Latin5:
+        s = "ISO_IR 148";
+        break;
+
+      case Encoding_Cyrillic:
+        s = "ISO_IR 144";
+        break;
+
+      case Encoding_Arabic:
+        s = "ISO_IR 127";
+        break;
+
+      case Encoding_Greek:
+        s = "ISO_IR 126";
+        break;
+
+      case Encoding_Hebrew:
+        s = "ISO_IR 138";
+        break;
+
+        /*
+          case Encoding_Japanese:
+          s = "ISO_IR 13";
+          break;
+        */
+
+      case Encoding_Thai:
+        s = "ISO_IR 166";
+        break;
+
+      default:
+        throw OrthancException(ErrorCode_ParameterOutOfRange);
+    }
+
+    Replace(DICOM_TAG_SPECIFIC_CHARACTER_SET, "", DicomReplaceMode_InsertIfAbsent);
+  }
+
 }