Mercurial > hg > orthanc
comparison OrthancServer/ParsedDicomFile.cpp @ 1558:124de28b32ed
fix encodings of newly created dicom files
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 Aug 2015 17:40:07 +0200 |
parents | b8dc2f855a83 |
children | 2084b7c20478 |
comparison
equal
deleted
inserted
replaced
1557:ad1e127b4ed5 | 1558:124de28b32ed |
---|---|
1333 } | 1333 } |
1334 | 1334 |
1335 | 1335 |
1336 void ParsedDicomFile::SetEncoding(Encoding encoding) | 1336 void ParsedDicomFile::SetEncoding(Encoding encoding) |
1337 { | 1337 { |
1338 std::string s; | 1338 if (encoding == Encoding_Windows1251) |
1339 | 1339 { |
1340 // http://www.dabsoft.ch/dicom/3/C.12.1.1.2/ | 1340 // This Cyrillic codepage is not officially supported by the |
1341 switch (encoding) | 1341 // DICOM standard. Do not set the SpecificCharacterSet tag. |
1342 { | 1342 return; |
1343 case Encoding_Utf8: | 1343 } |
1344 case Encoding_Ascii: | 1344 |
1345 s = "ISO_IR 192"; | 1345 std::string s = Toolbox::GetDicomSpecificCharacterSet(encoding); |
1346 break; | |
1347 | |
1348 case Encoding_Windows1251: | |
1349 // This Cyrillic codepage is not officially supported by the | |
1350 // DICOM standard. Do not set the SpecificCharacterSet tag. | |
1351 return; | |
1352 | |
1353 case Encoding_Latin1: | |
1354 s = "ISO_IR 100"; | |
1355 break; | |
1356 | |
1357 case Encoding_Latin2: | |
1358 s = "ISO_IR 101"; | |
1359 break; | |
1360 | |
1361 case Encoding_Latin3: | |
1362 s = "ISO_IR 109"; | |
1363 break; | |
1364 | |
1365 case Encoding_Latin4: | |
1366 s = "ISO_IR 110"; | |
1367 break; | |
1368 | |
1369 case Encoding_Latin5: | |
1370 s = "ISO_IR 148"; | |
1371 break; | |
1372 | |
1373 case Encoding_Cyrillic: | |
1374 s = "ISO_IR 144"; | |
1375 break; | |
1376 | |
1377 case Encoding_Arabic: | |
1378 s = "ISO_IR 127"; | |
1379 break; | |
1380 | |
1381 case Encoding_Greek: | |
1382 s = "ISO_IR 126"; | |
1383 break; | |
1384 | |
1385 case Encoding_Hebrew: | |
1386 s = "ISO_IR 138"; | |
1387 break; | |
1388 | |
1389 case Encoding_Japanese: | |
1390 s = "ISO_IR 13"; | |
1391 break; | |
1392 | |
1393 case Encoding_Chinese: | |
1394 s = "GB18030"; | |
1395 break; | |
1396 | |
1397 case Encoding_Thai: | |
1398 s = "ISO_IR 166"; | |
1399 break; | |
1400 | |
1401 default: | |
1402 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
1403 } | |
1404 | |
1405 Replace(DICOM_TAG_SPECIFIC_CHARACTER_SET, s, DicomReplaceMode_InsertIfAbsent); | 1346 Replace(DICOM_TAG_SPECIFIC_CHARACTER_SET, s, DicomReplaceMode_InsertIfAbsent); |
1406 } | 1347 } |
1407 | 1348 |
1408 void ParsedDicomFile::ToJson(Json::Value& target, bool simplify) | 1349 void ParsedDicomFile::ToJson(Json::Value& target, bool simplify) |
1409 { | 1350 { |