瀏覽代碼

Adding moveDicom script

Andrej 1 年之前
父節點
當前提交
3fa20e4e44
共有 2 個文件被更改,包括 43 次插入1 次删除
  1. 40 0
      scripts/moveDicom.sh
  2. 3 1
      scripts/uploadFiles.sh

+ 40 - 0
scripts/moveDicom.sh

@@ -0,0 +1,40 @@
+#copy study from one orthanc instance to another
+#works for orthanc 1.12.0, not for 1.6.1
+#reuqires source network json plus target network json
+
+function parse_cfg () {
+   USER=$(jq -r ".orthanc.user" $1);
+   PASSWORD=$(jq -r ".orthanc.password" $1);
+   SERVER=$(jq -r ".orthanc.server" $1);
+}
+
+
+if [ $# -lt 1 ] ; then
+	echo $#;
+	echo Usage $0 sourceNetworkConfig targetNetworkConfig studyId
+	exit 0;
+fi;
+
+FILE=$HOME/temp/Study.zip
+
+if [ -f $FILE ] ; then
+   rm $FILE;
+fi;
+
+#parse source config
+parse_cfg $1;
+
+CURL="curl -u $USER:$PASSWORD"
+
+$CURL $SERVER/studies/$3/archive > $FILE;
+echo Downloaded study $3 to $FILE;
+
+#target config
+parse_cfg $2;
+
+CURL="curl -u $USER:$PASSWORD"
+
+R=$($CURL -X POST $SERVER/instances --data-binary "@$FILE" | jq -r ".[] | .Status");
+echo $R;
+rm $FILE;
+

+ 3 - 1
scripts/uploadFiles.sh

@@ -1,8 +1,10 @@
 #copy content of directory to orthanc
 #copy content of directory to orthanc
+#works for orthanc 1.12.0, not for 1.6.1
+
 
 
 if [ $# -lt 1 ] ; then
 if [ $# -lt 1 ] ; then
 	echo $#;
 	echo $#;
-	echo Usage $0 DIR;
+	echo Usage $0 DIR networkConfig;
 	exit 0;
 	exit 0;
 fi;
 fi;