1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #! /bin/bash
- # convert images
- mkdir -p ./output/precomputed/
- for f in $(find ./neuroglancer-scripts-input/images -iname "*.nii.gz" -o -iname "*.nii")
- do
- filename=${f#./neuroglancer-scripts-input/images/}
- filename_no_ext=${filename%.gz}
- filename_no_ext=${filename_no_ext%.nii}
- outputdir=./output/precomputed/images/$filename_no_ext
- mkdir -p $outputdir
-
- volume-to-precomputed \
- --generate-info \
- $f \
- $outputdir/
-
- generate-scales-info \
- $outputdir/info_fullres.json \
- $outputdir/
- volume-to-precomputed $f $outputdir/
- compute-scales $outputdir/
- done
- # throw if datatype is not int
- for f in $(find ./neuroglancer-scripts-input/segmentations -iname "*.nii.gz" -o -iname "*.nii")
- do
- filename=${f#./neuroglancer-scripts-input/segmentations/}
- filename_no_ext=${filename%.gz}
- filename_no_ext=${filename_no_ext%.nii}
- outputdir=./output/precomputed/segmentations/$filename_no_ext
- mkdir -p $outputdir
-
- volume-to-precomputed \
- --generate-info \
- $f \
- $outputdir/
-
- tmp=$(jq -c '. + {"data_type": "uint32"}' $outputdir/info_fullres.json)
- echo $tmp > $outputdir/info_fullres.json
- generate-scales-info \
- --type=segmentation \
- --encoding=compressed_segmentation \
- $outputdir/info_fullres.json \
- $outputdir/
- volume-to-precomputed $f $outputdir/
- compute-scales \
- --downscaling-method=majority \
- $outputdir/
- done
|