#!/bin/bash
# makeFakeCameraFiles.bash
# Convert all of the files in the SIVAL collection to
# ppm files that can be used as FakeCamera images in
# Pyro.
# Each set of ppm images appears within its own sub-directory.
# The characters before the first _ are used to define the
# sub-directory name. For example, for the CokeCan images all
# images starting with fluor1 appear in the CokeCan/fluor1/
# directory in the FakeCameras Directory.
# ===========
SIZE=256
rm -rf FakeCameras
DIRS=$(ls)
mkdir FakeCameras
for DIR in $DIRS
do
SUFFIX=$(echo $DIR | cut -f2 -d'.')
if [ $SUFFIX != "bash" ]
then
mkdir FakeCameras/$DIR
cd $DIR
FILES=$(ls)
for FILE in $FILES
do
if [ $FILE != "Thumbs.db" ]
then
PREFIX=$(echo $FILE | cut -f1 -d'_')
SUBDIR="../FakeCameras/"$DIR"/"$PREFIX
if [ ! -d $SUBDIR ]
then
mkdir $SUBDIR
fi
FILENAME=$(echo $FILE | cut -f1 -d'.')
convert -scale $SIZEx$SIZE $FILE $SUBDIR"/"$FILENAME".ppm"
fi
done
cd ..
fi
done
|