-
Notifications
You must be signed in to change notification settings - Fork 0
/
sortbystudy_1.sh
67 lines (44 loc) · 2.06 KB
/
sortbystudy_1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#dcmdump -ml +P StudyDate +P PatientName +P PatientID +P InstitutionName +P StudyInstanceUID +P SeriesInstanceUID -q $1 > /data/dataReceived/dump.txt
#dcmdump -ml -q $1 > /data/dataReceived/dump.txt
#cat /data/dataReceived/dump.txt | while read line; do
dcmdump -ml +P StudyDate +P PatientName +P PatientID +P InstitutionName +P StudyInstanceUID +P SeriesInstanceUID -q $1 > /data/dataReceived/dump_sort_by_study.txt
#dcmdump -ml -q $1 > /data/dataReceived/dump.txt
#cat /data/dataReceived/dump.txt | while read line; do
var=$(awk -F ' ' '{print $3}' /data/dataReceived/dump_sort_by_study.txt)
#done
var_1=($var);
#echo ${var_1[5]};
StudyDate=${var_1[0]};
Server_file_id=${var_1[1]};
InstitutionName=${var_1[3]};
StudyInstanceUID=${var_1[4]};
SeriesInstanceUID=${var_1[5]};
#echo ${#StudyDate};${a:12:}
StudyDate=${StudyDate:1:(${#StudyDate}-2)};
Server_file_id=${Server_file_id:1:(${#Server_file_id}-2)};
InstitutionName=${InstitutionName:1:(${#InstitutionName}-2)};
StudyInstanceUID=${StudyInstanceUID:1:(${#StudyInstanceUID}-2)};
SeriesInstanceUID=${SeriesInstanceUID:1:(${#SeriesInstanceUID}-2)};
# echo $Server_file_id;
clear;
cd /data
if [ ! -d dataTemp ]; then
mkdir dataTemp;
echo "Creating Temporary Data Pool";
fi
cd dataTemp
if [ ! -d $StudyInstanceUID ]; then
mkdir $StudyInstanceUID;
echo "New Study...Creating dedicated study directory..";
fi
cp -v $1 /data/dataTemp/$StudyInstanceUID
echo "Moving the data file to Corresponding study category";
cd /data/dataLogged
if [ ! -d $StudyInstanceUID ]; then
mkdir $StudyInstanceUID;
echo "New Study...Creating dedicated study directory for data logging..";
fi
cp -v $1 /data/dataLogged/$StudyInstanceUID
echo "Moving the data file to Corresponding study category for data logging";
cd /data
# php update_transfer_log_tables.php $Server_file_id $StudyDate $InstitutionName $StudyInstanceUID $SeriesInstanceUID