run-neuroglancer-script.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #! /bin/bash
  2. # convert images
  3. mkdir -p ./output/precomputed/
  4. for f in $(find ./neuroglancer-scripts-input/images -iname "*.nii.gz" -o -iname "*.nii")
  5. do
  6. filename=${f#./neuroglancer-scripts-input/images/}
  7. filename_no_ext=${filename%.gz}
  8. filename_no_ext=${filename_no_ext%.nii}
  9. outputdir=./output/precomputed/images/$filename_no_ext
  10. mkdir -p $outputdir
  11. volume-to-precomputed \
  12. --generate-info \
  13. $f \
  14. $outputdir/
  15. generate-scales-info \
  16. $outputdir/info_fullres.json \
  17. $outputdir/
  18. volume-to-precomputed $f $outputdir/
  19. compute-scales $outputdir/
  20. done
  21. # throw if datatype is not int
  22. for f in $(find ./neuroglancer-scripts-input/segmentations -iname "*.nii.gz" -o -iname "*.nii")
  23. do
  24. filename=${f#./neuroglancer-scripts-input/segmentations/}
  25. filename_no_ext=${filename%.gz}
  26. filename_no_ext=${filename_no_ext%.nii}
  27. outputdir=./output/precomputed/segmentations/$filename_no_ext
  28. mkdir -p $outputdir
  29. volume-to-precomputed \
  30. --generate-info \
  31. $f \
  32. $outputdir/
  33. tmp=$(jq -c '. + {"data_type": "uint32"}' $outputdir/info_fullres.json)
  34. echo $tmp > $outputdir/info_fullres.json
  35. generate-scales-info \
  36. --type=segmentation \
  37. --encoding=compressed_segmentation \
  38. $outputdir/info_fullres.json \
  39. $outputdir/
  40. volume-to-precomputed $f $outputdir/
  41. compute-scales \
  42. --downscaling-method=majority \
  43. $outputdir/
  44. done