moveDicom.sh 788 B

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