Skip to content

Instantly share code, notes, and snippets.

@icaoberg
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icaoberg/2e0023ef76322049749f to your computer and use it in GitHub Desktop.
Save icaoberg/2e0023ef76322049749f to your computer and use it in GitHub Desktop.
cellorganizer-demo3D12 public CI script #ubuntu #macosx #matlab #cellorganizer
###########################################
# REMEMBER TO SET UP THE VARIABLE $OPTION #
###########################################
find . -name "*lock*" -exec rm -f {} \;
OPTION=$1
echo "help demo3D12;
TRAIN = true;
SYNTHESIS = true;
POSTPROCESSING = true;
option = $OPTION;
patterns = {'LAM','Mit','Nuc','TfR'};
model_filenames = {'./lam.mat', './mit.mat', './nuc.mat', './tfr.mat'};
downsampling_scale = 5;
pattern = patterns{option};
model_filename = model_filenames{option};
cd( './demos/3D/demo3D12' );
if TRAIN
%run demo and make profile
profile on
param.model.downsampling = [ downsampling_scale, downsampling_scale, 1];
param.proteinUpsampleZ = 5;
param.train.flag = 'all';
demo3D12( option, false, param );
profile off
movefile( model_filename, './model.mat' );
profsave( profile('info'), 'profile' );
zip( 'profile.zip', 'profile' )
rmdir( 'profile', 's' );
end
if SYNTHESIS
%try to synthesize images from model
try
state = rng(3);
catch
state = RandStream.create('mt19937ar','seed', 11);
RandStream.setDefaultStream(state);
end
outputDirectory = pwd;
param = [];
param.targetDirectory = [ outputDirectory ];
param.prefix = 'synthesizedImages';
param.numberOfSynthesizedImages = 5;
param.compression = 'lzw';
param.microscope = 'none';
param.synthesis = 'all';
param.verbose = true;
param.debug = true;
slml2img( {'./model.mat'}, param );
end
if POSTPROCESSING
input_images_directory = [ pwd filesep pattern ];
output_images_directory = [ pwd filesep 'temp' filesep 'raw' ];
answer = ...
raw_images_gallery_wrapper( ...
input_images_directory, output_images_directory );
input_images_directory = [ pwd filesep 'intermediate_results' ];
output_images_directory = [ pwd filesep 'temp' filesep 'intermediate' ];
answer = ...
intermediate_results_image_gallery_wrapper( ...
input_images_directory, output_images_directory );
input_images_directory = [ pwd filesep 'temp' filesep 'preprocessing' ];
output_images_directory = [ pwd filesep 'temp' filesep 'preprocessing' ];
answer = ...
preprocessed_images_gallery_wrapper( ...
input_images_directory, output_images_directory );
input_images_directory = [ pwd filesep 'synthesizedImages' ];
output_images_directory = [ pwd filesep 'temp' filesep 'synthetic' ];
synthesized_images_gallery_wrapper( ...
input_images_directory, output_images_directory );
input_images_directory = [ pwd filesep 'temp' filesep 'cell_shape_eigen' ]
output_images_directory = [ pwd filesep 'temp' filesep 'cellcodes' ];
cellcodes_images_gallery_wrapper( ...
input_images_directory, output_images_directory );
end
exit;" > script.m
if [ -n $OPTION ]; then
$MATLAB $MATLAB_OPTS -r "script;"
else
echo "Variable OPTION not set. Not running demo."
fi
DEMO='demo3D12'
DIRECTORY='demos/3D/demo3D12'
for FILE in $DIRECTORY/*.tgz
do
rm -fv '$FILE'
end
if
PATTERNS=( 'LAM' 'TfR' 'Nuc' 'Mit' )
for PATTERN in "${PATTERNS[@]}"
do
if [ -d $DIRECTORY/$PATTERN ]; then
rm -fvr $DIRECTORY/$PATTERN
fi
done
echo ""
if [ -n "$SAVED_RESULTS" ]; then
DATE=`date +%F-%H%M%S`
if [ ! -d "$SAVED_RESULTS"/"$DEMO" ]; then
mkdir -v "$SAVED_RESULTS"/"$DEMO"
fi
cp -r "$DIRECTORY" "$SAVED_RESULTS"/"$DEMO"/"$DATE"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment