mirror of
https://github.com/wassname/mammoviews.git
synced 2026-06-27 16:10:25 +08:00
dicom conversion script
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user