moveDicom.sh 801 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. #copy study from one orthanc instance to another
  3. #works for orthanc 1.12.0, not for 1.6.1
  4. #reuqires source network json plus target network json
  5. function parse_cfg () {
  6. USER=$(jq -r ".orthanc.user" $1);
  7. PASSWORD=$(jq -r ".orthanc.password" $1);
  8. SERVER=$(jq -r ".orthanc.server" $1);
  9. }
  10. if [ $# -lt 1 ] ; then
  11. echo $#;
  12. echo Usage $0 sourceNetworkConfig targetNetworkConfig studyId
  13. exit 0;
  14. fi;
  15. FILE=$HOME/temp/Study.zip
  16. if [ -f $FILE ] ; then
  17. rm $FILE;
  18. fi;
  19. #parse source config
  20. parse_cfg $1;
  21. CURL="curl -u $USER:$PASSWORD"
  22. $CURL $SERVER/studies/$3/archive > $FILE;
  23. echo Downloaded study $3 to $FILE;
  24. #target config
  25. parse_cfg $2;
  26. CURL="curl -u $USER:$PASSWORD"
  27. R=$($CURL -X POST $SERVER/instances --data-binary "@$FILE" | jq -r ".[] | .Status");
  28. echo $R;
  29. rm $FILE;