-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path03_query.sh
More file actions
executable file
·88 lines (77 loc) · 4.87 KB
/
03_query.sh
File metadata and controls
executable file
·88 lines (77 loc) · 4.87 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
# 03_query.sh — findscu / getscu showcase
#
# Shows command-line patterns for C-FIND and C-GET against a Query/Retrieve SCP.
#
# If you have Orthanc or another PACS running locally, adjust HOST/PORT below.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$SCRIPT_DIR/../.."
FINDSCU="$ROOT/target/debug/findscu"
GETSCU="$ROOT/target/debug/getscu"
if [[ ! -x "$FINDSCU" ]]; then
echo "Binary not found — run: cargo build --bins"
exit 1
fi
if [[ ! -x "$GETSCU" ]]; then
echo "Binary not found — run: cargo build --bins"
exit 1
fi
# ─────────────────────────────────────────────
echo "════════════════════════════════════════════════════════════"
echo " findscu / getscu — Query/Retrieve examples"
echo "════════════════════════════════════════════════════════════"
echo ""
echo " The following commands show common C-FIND patterns."
echo " Set PACS_HOST / PACS_PORT to a running Query/Retrieve SCP."
echo ""
PACS_HOST="${PACS_HOST:-localhost}"
PACS_PORT="${PACS_PORT:-4242}"
echo "────────────────────────────────────────────────────────────"
echo " Example 1: Find all studies (wildcard)"
echo "────────────────────────────────────────────────────────────"
echo "Command:"
echo " findscu -L STUDY -k '0008,0052=STUDY' -k '0010,0010=' \\"
echo " $PACS_HOST $PACS_PORT"
echo ""
echo "────────────────────────────────────────────────────────────"
echo " Example 2: Find by patient name (wildcard prefix)"
echo "────────────────────────────────────────────────────────────"
echo "Command:"
echo " findscu -L STUDY -k '0010,0010=AVE*' $PACS_HOST $PACS_PORT"
echo ""
echo "────────────────────────────────────────────────────────────"
echo " Example 3: Find at SERIES level for a specific StudyUID"
echo "────────────────────────────────────────────────────────────"
echo "Command:"
echo " findscu -L SERIES -k '0020,000D=<StudyInstanceUID>' $PACS_HOST $PACS_PORT"
echo ""
echo "────────────────────────────────────────────────────────────"
echo " Example 4: Find CT images in a date range"
echo "────────────────────────────────────────────────────────────"
echo "Command:"
echo " findscu -L STUDY -k '0008,0060=CT' -k '0008,0020=19960101-19971231' \\"
echo " $PACS_HOST $PACS_PORT"
echo ""
echo "────────────────────────────────────────────────────────────"
echo " Example 5: Retrieve a study with C-GET"
echo "────────────────────────────────────────────────────────────"
echo "Command:"
echo " getscu -d retrieved -L STUDY -k '0020,000D=<StudyInstanceUID>' \\"
echo " $PACS_HOST $PACS_PORT"
echo ""
# If PACS is reachable (skip by default so this script always exits 0)
if [[ "${RUN_LIVE:-0}" == "1" ]]; then
echo "════════════════════════════════════════════════════════════"
echo " LIVE query against $PACS_HOST:$PACS_PORT"
echo "════════════════════════════════════════════════════════════"
"$FINDSCU" -v \
-a FINDSCU -c ANY-SCP \
-L STUDY \
-k "0010,0010=" \
"$PACS_HOST" "$PACS_PORT"
echo ""
echo "(getscu is not executed automatically; use the Example 5 command above to retrieve files.)"
else
echo "(Set RUN_LIVE=1 to execute queries against $PACS_HOST:$PACS_PORT)"
fi