dicom conversion script

This commit is contained in:
Dmytro S Lituiev
2019-07-16 16:49:12 -07:00
parent 4cf884034a
commit 47b555a92f
2 changed files with 25 additions and 0 deletions
+5
View File
@@ -16,6 +16,11 @@
## Image pipeline
### Preprocessing
originally DICOMs were converted to 299x299 PNGs using `convert_dicom_list_to_png.sh` script
### Weight files are available [here](https://datashare.ucsf.edu/stash/dataset/doi:10.7272/Q6XK8CQ9)
### General image model
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
filelist=$1
OUT_DIRECTORY="/data/UCSF_MAMMO/2017-07-png-16bit"
TMPFILE="tmp.dcm"
nn=0
for file in $filelist; do
nn=$((nn+1))
dirn_=$(dirname $file)
id=`echo $file | awk -v FS="/" '{for (nn=NF-3;nn<NF;nn++){ printf $nn "_" }; print $NF }'`
id=${id%.dcm}
#echo $id;
# gdcmconv --raw "$file" $TMPFILE
# convert $TMPFILE -resize 299x299! $OUT_DIRECTORY/$id.png
gdcmconv --raw "$file" /dev/stdout | convert /dev/stdin -depth 16 -resize 299x299! $OUT_DIRECTORY/$id.png
#-depth
if [ $((nn % 40)) -eq 0 ]; then
echo "$nn"
fi
done