changeset 3218:9a83d94b2a1e

kanji encoding
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 14 Feb 2019 11:32:14 +0100
parents cf8cbeb35f33
children 4351f52f15d5
files Core/Enumerations.cpp Core/Enumerations.h Core/Toolbox.cpp NEWS Resources/Configuration.json TODO UnitTestsSources/UnitTestsMain.cpp
diffstat 7 files changed, 44 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Enumerations.cpp	Wed Feb 13 17:46:12 2019 +0100
+++ b/Core/Enumerations.cpp	Thu Feb 14 11:32:14 2019 +0100
@@ -650,6 +650,9 @@
       case Encoding_Korean:
         return "Korean";
 
+      case Encoding_JapaneseKanji:
+        return "JapaneseKanji";
+
       default:
         throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
@@ -1210,6 +1213,11 @@
       return Encoding_Korean;
     }
 
+    if (s == "JAPANESE_KANJI")
+    {
+      return Encoding_JapaneseKanji;
+    }
+
     throw OrthancException(ErrorCode_ParameterOutOfRange);
   }
 
@@ -1869,14 +1877,18 @@
     {
       encoding = Encoding_Korean;
     }
+    else if (s == "ISO 2022 IR 87")
+    {
+      encoding = Encoding_JapaneseKanji;
+    }
     /*
       else if (s == "ISO 2022 IR 159")
       {
-      TODO
+      TODO - Supplementary Kanji set
       }
-      else if (s == "ISO 2022 IR 87")
+      else if (s == "ISO 2022 IR 58")
       {
-      TODO
+      TODO - Simplified Chinese
       }
     */
     else
@@ -2026,6 +2038,9 @@
       case Encoding_Korean:
         return "ISO 2022 IR 149";
 
+      case Encoding_JapaneseKanji:
+        return "ISO 2022 IR 87";
+
       default:
         throw OrthancException(ErrorCode_ParameterOutOfRange);
     }
--- a/Core/Enumerations.h	Wed Feb 13 17:46:12 2019 +0100
+++ b/Core/Enumerations.h	Thu Feb 14 11:32:14 2019 +0100
@@ -443,7 +443,7 @@
     Encoding_Thai,                          // TIS 620-2533
     Encoding_Japanese,                      // JIS X 0201 (Shift JIS): Katakana
     Encoding_Chinese,                       // GB18030 - Chinese simplified
-    //Encoding_JapaneseKanji,               // Multibyte - JIS X 0208: Kanji
+    Encoding_JapaneseKanji,                 // Multibyte - JIS X 0208: Kanji
     //Encoding_JapaneseSupplementaryKanji,  // Multibyte - JIS X 0212: Supplementary Kanji set
     Encoding_Korean                         // Multibyte - KS X 1001: Hangul and Hanja
   };
--- a/Core/Toolbox.cpp	Wed Feb 13 17:46:12 2019 +0100
+++ b/Core/Toolbox.cpp	Thu Feb 14 11:32:14 2019 +0100
@@ -518,6 +518,10 @@
         return "ISO-IR-149";
         break;
 
+      case Encoding_JapaneseKanji:
+        return "JIS";
+        break;
+
       default:
         throw OrthancException(ErrorCode_NotImplemented);
     }
@@ -568,9 +572,10 @@
         }        
       }
     }
-    catch (std::runtime_error&)
+    catch (std::runtime_error& e)
     {
       // Bad input string or bad encoding
+      LOG(INFO) << e.what();
       return ConvertToAscii(source);
     }
   }
--- a/NEWS	Wed Feb 13 17:46:12 2019 +0100
+++ b/NEWS	Thu Feb 14 11:32:14 2019 +0100
@@ -1,7 +1,8 @@
 Pending changes in the mainline
 ===============================
 
-* Basic support for character sets with code extensions
+* Support of Japanese Kanji (ISO 2022 IR 87) and Korean (ISO 2022 IR 149) encodings
+* Basic support for character sets with code extensions (ISO 2022 escape sequences)
 
 
 Version 1.5.4 (2019-02-08)
--- a/Resources/Configuration.json	Wed Feb 13 17:46:12 2019 +0100
+++ b/Resources/Configuration.json	Thu Feb 14 11:32:14 2019 +0100
@@ -111,7 +111,7 @@
   // C-Find requests (including worklists). The allowed values are
   // "Ascii", "Utf8", "Latin1", "Latin2", "Latin3", "Latin4",
   // "Latin5", "Cyrillic", "Windows1251", "Arabic", "Greek", "Hebrew",
-  // "Thai", "Japanese", and "Chinese".
+  // "Thai", "Japanese", "Chinese", "JapaneseKanji" and "Korean".
   "DefaultEncoding" : "Latin1",
 
   // The transfer syntaxes that are accepted by Orthanc C-Store SCP
--- a/TODO	Wed Feb 13 17:46:12 2019 +0100
+++ b/TODO	Thu Feb 14 11:32:14 2019 +0100
@@ -82,6 +82,21 @@
 * Support extended association:
   https://groups.google.com/d/msg/orthanc-users/xD4d3mpc6ms/srF7E2goAAAJ
 
+---------
+Encodings
+---------
+
+* Support multiple specific character sets (cf. "SCSH32" in orthanc-tests)
+  http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.12.html#sect_C.12.1.1.2
+* Support Simplified Chinese (ISO 2022 IR 58)
+* Support Supplementary Kanji set (ISO 2022 IR 159)
+* Implement the following unit tests:
+  - Japanese: http://dicom.nema.org/MEDICAL/dicom/2017c/output/chtml/part05/chapter_H.html
+  - Korean: http://dicom.nema.org/MEDICAL/dicom/2017c/output/chtml/part05/chapter_I.html
+  - Chinese:
+    http://dicom.nema.org/MEDICAL/dicom/2017c/output/chtml/part05/chapter_J.html
+    http://dicom.nema.org/MEDICAL/dicom/2017c/output/chtml/part05/chapter_K.html
+
 
 =======
 Plugins
--- a/UnitTestsSources/UnitTestsMain.cpp	Wed Feb 13 17:46:12 2019 +0100
+++ b/UnitTestsSources/UnitTestsMain.cpp	Thu Feb 14 11:32:14 2019 +0100
@@ -691,6 +691,7 @@
   ASSERT_EQ(Encoding_Chinese, StringToEncoding(EnumerationToString(Encoding_Chinese)));
   ASSERT_EQ(Encoding_Thai, StringToEncoding(EnumerationToString(Encoding_Thai)));
   ASSERT_EQ(Encoding_Korean, StringToEncoding(EnumerationToString(Encoding_Korean)));
+  ASSERT_EQ(Encoding_JapaneseKanji, StringToEncoding(EnumerationToString(Encoding_JapaneseKanji)));
 
   ASSERT_EQ(ResourceType_Patient, StringToResourceType(EnumerationToString(ResourceType_Patient)));
   ASSERT_EQ(ResourceType_Study, StringToResourceType(EnumerationToString(ResourceType_Study)));