92
|
1 #!/bin/bash
|
|
2
|
|
3 # Inspired from Levin Alexander on 2016-11-03
|
|
4 # https://groups.google.com/d/msg/orthanc-users/kYURTgtgPmI/KeOL8lGFAwAJ
|
|
5
|
|
6 set -e
|
|
7
|
|
8 convert -quality 90 -resize 128x128 ../Lena.png /tmp/Lena.jpg
|
|
9
|
|
10 function Encode {
|
|
11 echo $1
|
|
12 SOURCE="Test-éüäöòДΘĝדصķћ๛ネİ"
|
|
13 CONVERTED=$(echo "$SOURCE" | iconv -c -t $1)
|
|
14
|
|
15 img2dcm /tmp/Lena.jpg Lena-$1.dcm \
|
|
16 -k "(0010,0010)=${CONVERTED}" \
|
|
17 -k "(0010,0020)=${1}" \
|
|
18 -k "(0008,0005)=${2}"
|
|
19
|
|
20 echo -n "${CONVERTED}" | md5sum
|
|
21 }
|
|
22
|
|
23
|
|
24 # http://dicom.nema.org/medical/dicom/current/output/html/part03.html#sect_C.12.1.1.2
|
|
25 Encode 'arabic' 'ISO_IR 127'
|
|
26 Encode 'ascii' 'ISO_IR 6' # More accurately, ISO 646
|
|
27 Encode 'cyrillic' 'ISO_IR 144'
|
|
28 Encode 'greek' 'ISO_IR 126'
|
|
29 Encode 'hebrew' 'ISO_IR 138'
|
|
30 Encode 'latin1' 'ISO_IR 100'
|
|
31 Encode 'latin2' 'ISO_IR 101'
|
|
32 Encode 'latin3' 'ISO_IR 109'
|
|
33 Encode 'latin4' 'ISO_IR 110'
|
|
34 Encode 'latin5' 'ISO_IR 148'
|
|
35 Encode 'shift-jis' 'ISO_IR 13' # Japanese
|
|
36 Encode 'tis-620' 'ISO_IR 166' # Thai
|
|
37 Encode 'utf8' 'ISO_IR 192'
|