Set up working set.sh
Jump to navigation
Jump to search
#!/bin/sh set -v set -x CLASSES_DIR=/home/colettace/data/monkeys/classes cd $CLASSES_DIR pwd TARGET_DIR=/home/colettace/data/monkeys/master_working_set mkdir $TARGET_DIR/originals mkdir $TARGET_DIR/hematoxylin mkdir $TARGET_DIR/eosin for i in * do SLIDE_LABEL=`echo $i | sed -r "s/slide//"` # echo $SLIDE_LABEL cd $i experiment -slide $SLIDE_LABEL -n 90 > ${i}_working_filelist mkdir $TARGET_DIR/originals/$i mkdir $TARGET_DIR/hematoxylin/$i mkdir $TARGET_DIR/eosin/$i cat ${i}_working_filelist | xargs -i cp -v {} $TARGET_DIR/originals/$i/ cat ${i}_working_filelist | xargs -i cp -v {} $TARGET_DIR/hematoxylin/$i/ cat ${i}_working_filelist | xargs -i cp -v {} $TARGET_DIR/eosin/$i/ # Now selectively delete the files that shouldn't be in the respective directories # The -exec operation below only works on all files matching the three conditions # only if they are wrapped in parentheses! find $TARGET_DIR/originals/$i/ \( -regex ".*O_.*" -or -regex ".*H_.*" -or -regex ".*E_.*" \) -exec rm -v {} \; find $TARGET_DIR/hematoxylin/$i/ \( ! -regex ".*H_.*" \) -exec rm -v {} \; find $TARGET_DIR/eosin/$i/ \( ! -regex ".*E_.*" \) -exec rm -v {} \; cd .. done