| 1 |
#!/bin/csh |
| 2 |
# |
| 3 |
# This script is used to populate several databases with information that |
| 4 |
# will be used to access icons for print management. |
| 5 |
# Arguments to the script are: |
| 6 |
# Source root directory |
| 7 |
# Target root directory |
| 8 |
# study directory (ct1 mr1...etc, a directory piece) |
| 9 |
# print database |
| 10 |
# icon index |
| 11 |
# icon file |
| 12 |
# file name(s) |
| 13 |
# $Revision: 1.6 $ |
| 14 |
|
| 15 |
|
| 16 |
if ($7 == "") then |
| 17 |
echo You do not have enough arguments. Since this script is usually run by |
| 18 |
echo create_icons, you should check how you are using this script. |
| 19 |
echo Arguments: src dst study print_database icon_index icon_file file_names |
| 20 |
exit 1 |
| 21 |
endif |
| 22 |
|
| 23 |
set src = $1 |
| 24 |
shift |
| 25 |
set dst = $1 |
| 26 |
shift |
| 27 |
set study = $1 |
| 28 |
shift |
| 29 |
set db = $1 |
| 30 |
shift |
| 31 |
set icIndex = $1 |
| 32 |
shift |
| 33 |
set icFile = $1 |
| 34 |
shift |
| 35 |
|
| 36 |
if (! (-e $src/$study)) then |
| 37 |
echo Missing $src/$study |
| 38 |
exit 1 |
| 39 |
endif |
| 40 |
|
| 41 |
if (! (-e $dst/$study)) then |
| 42 |
echo Missing $dst/$study. Will try to create $dst/$study. |
| 43 |
mkdir $dst/$study |
| 44 |
if ($status != 0) then |
| 45 |
echo Could not create $dst/$study. Exiting. |
| 46 |
exit 1 |
| 47 |
endif |
| 48 |
endif |
| 49 |
|
| 50 |
# This program reads a file and extracts the study ID. That study ID |
| 51 |
# and length of the current icon file are written to the icon index. |
| 52 |
|
| 53 |
icon_append_index $icIndex $icFile $src/$study/$1 |
| 54 |
|
| 55 |
while ($1 != "") |
| 56 |
echo $src/$study/$1 |
| 57 |
|
| 58 |
dcm_map_to_8 $src/$study/$1 $dst/$study/$1.8bit |
| 59 |
if ($status == 2) goto skip |
| 60 |
|
| 61 |
create_greyscale_module $dst/$study/$1.8bit $dst/$study/$1.print |
| 62 |
|
| 63 |
create_print_entry $db $src/$study/$1 $dst/$study/$1.print |
| 64 |
|
| 65 |
#/usr/bin/rm -f $dst/$study/$1.8bit |
| 66 |
|
| 67 |
dcm_resize -c 64 -r 64 $dst/$study/$1.8bit $dst/$study/$1.64x64 |
| 68 |
|
| 69 |
dcm_map_to_8 $dst/$study/$1.64x64 $dst/$study/$1.icon |
| 70 |
|
| 71 |
icon_append_file $icFile $dst/$study/$1.icon |
| 72 |
|
| 73 |
/usr/bin/rm -f $dst/$study/$1.8bit |
| 74 |
/usr/bin/rm -f $dst/$study/$1.64x64 $dst/$study/$1.icon |
| 75 |
|
| 76 |
skip: |
| 77 |
shift |
| 78 |
end |
| 79 |
exit 0 |