Created
November 27, 2012 22:12
-
-
Save jrdi/4157510 to your computer and use it in GitHub Desktop.
All files in directories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.DS_Store | |
DB* | |
Config* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
database_dir = ARGV[0] | |
config_dir = ARGV[1] | |
Dir.glob("#{database_dir}/*").each do |entry| | |
if File.directory?(entry) && File.exists?(File.join(entry, 'tmp/mammo_config.xml')) | |
system("sh sed_mammo_substitution.sh #{entry} #{config_dir}") | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PATIENT_DIR=$1 #Path to the directory where you placed the 'DB' directory | |
CONFIG_DIR=$2 #Path to the directory where you placed the 'Config' directory | |
INPUT_MAMMO_CONFIG_XML_PATH=$PATIENT_DIR"/tmp/mammo_config.xml" | |
OUTPUT_MAMMO_CONFIG_XML_PATH=$PATIENT_DIR"/tmp/mammo_config_NEW.xml" | |
TMP_DIR=$PATIENT_DIR"/tmp/" | |
MAMMO_RECONSTRUCTION_DIR=$PATIENT_DIR"/media/mammo_reconstruction/" | |
REC_DIR=$PATIENT_DIR"/rec/" | |
sed -e "s;[a-zA-Z]:[A-Za-z0-9\\]*\\measures.xml;"$TMP_DIR"measures.xml; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\bodymarks.xml;"$TMP_DIR"bodymarks.xml; | |
s;[a-zA-Z]:[A-Za-z0-9\\_]*\\front.jpg;"$MAMMO_RECONSTRUCTION_DIR"front.jpg; | |
s;[a-zA-Z]:[A-Za-z0-9\\_]*\\right.jpg;"$MAMMO_RECONSTRUCTION_DIR"right.jpg; | |
s;[a-zA-Z]:[A-Za-z0-9\\_]*\\left.jpg;"$MAMMO_RECONSTRUCTION_DIR"left.jpg; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\completebody.obj;"$REC_DIR"completebody.obj; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\completebody.k3d;"$REC_DIR"completebody.k3d; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\mammo_info.xml;"$REC_DIR"mammo_info.xml; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\rec\\thorax.obj;"$REC_DIR"thorax.obj; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\thorax.k3d;"$REC_DIR"thorax.k3d; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\small.xml;"$CONFIG_DIR"small.xml; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\mask.png;"$CONFIG_DIR"mask.png; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\medium_uv.txt;"$CONFIG_DIR"medium_uv.txt; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\BreastSubdivisionTriangles.txt;"$CONFIG_DIR"BreastSubdivisionTriangles.txt; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\RGBACacheImage.mha;"$CONFIG_DIR"RGBACacheImage.mha; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\Config\\thorax.obj;"$CONFIG_DIR"thorax.obj; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\flat_lateral.xml;"$CONFIG_DIR"flat_lateral.xml; | |
s;[a-zA-Z]:[A-Za-z0-9\\]*\\TrainingFeatures;"$CONFIG_DIR"TrainingFeatures;" $INPUT_MAMMO_CONFIG_XML_PATH > $OUTPUT_MAMMO_CONFIG_XML_PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example:
ruby dir.rb /Users/jrdi/Code/directories/DB /Users/jrdi/Code/directories/Config/