generate-mesh-manifest.sh 629 B

1234567891011121314151617
  1. #! /bin/bash
  2. for dir in $(find ./neuroglancer-scripts-input/meshes/ -mindepth 1 -maxdepth 1 -type d)
  3. do
  4. output_json={}
  5. # exclude files that start with `.` e.g. .gitkeep etc
  6. for f in $(find $dir/meshes/ -type l -o -type f ! -name \\.* )
  7. do
  8. pathedname=${f#$dir/meshes/}
  9. bname=$(basename $f)
  10. seg_id=$(echo $bname | sed -E -e 's/WHS_SD_rat_atlas_v4_0+//g' -e 's/\.[a-zA-Z]+$//g')
  11. # echo ${f#$dir/meshes/}
  12. final=$(echo $output_json | jq -c ". + {\"$pathedname\": { \"format\": \"STL_ASCII\", \"labelIndex\": $seg_id }}")
  13. output_json=$final
  14. done
  15. echo $output_json | jq '.' > $dir/manifest.json
  16. done