File size: 2,711 Bytes
5ad11ec |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
#!/bin/sh
# batch macro input_filename
# Ref: page 20: https://imagej.nih.gov/ij/docs/macro_reference_guide.pdf
## Configuration MacOS
imagej_dir="/Applications/ImageJ.app/" ## MacOS ImageJ java run folder
macro_dir="/Users/hoatran/Documents/BCCRC_projects/merfish/merFISH_report_pipeline/imagej_macro/nuclei_segmentation/"
project_dir="/Users/hoatran/Documents/BCCRC_projects/merfish/merFISH_report_pipeline/imagej_macro/nuclei_segmentation/testing_images/"
series="merfish_4T1"
task="NUC_SEG" # Nuc segmentation
## ImageJ/ Fiji can be installed to Applications, or put into any folder in your drive.
# imagej_dir="/Applications/ImageJ.app" ## MacOS ImageJ java run folder
# imagej_dir="/Applications/Fiji.app" ## MacOS Fiji java run folder
# imagej_dir="/Users/htran/Downloads/Fiji.app/" ## MacOS Fiji java run folder - from my computer
# imagej_exe_file=${imagej_dir}jars/ij-1.53q.jar ## Fiji file location, in general file name is ij.jar, sometimes include version here, ex: ij-1.53q.jar, version 1.53
imagej_exe_file=${imagej_dir}Contents/Java/ij.jar ## ImageJ exe file location, in general file name is ij.jar, sometimes include version here
macro_fn="${macro_dir}nuc_seg.txt"
log_file="${macro_dir}${series}_${task}.log"
echo $log_file
exec >> $log_file 2>&1 && tail $log_file
input_dir="${project_dir}"
echo "__________________________________\n"
echo "Input directory is: \n"
echo $input_dir
echo "Segment images \n"
## You can change memory amount, ex: 20000m to 30000m so program will run faster.
## MacOS background mode here
## If you have java environment jre installed in your computer
# java -Xmx20000m -jar ${imagej_exe_file} -ijpath $imagej_dir/ -batch $macro_fn $input_dir
## Otherwise using existing jre env from Fiji here
# /Users/htran/Downloads/Fiji.app/java/macosx/adoptopenjdk-8.jdk/jre/Contents/Home/bin/java -Xmx20000m -jar ${imagej_dir}Contents/Java/ij.jar -ijpath ${imagej_dir} -batch $macro_fn $input_dir
# ${imagej_dir}java/macosx/adoptopenjdk-8.jdk/jre/Contents/Home/bin/java -Xmx20000m -jar ${imagej_exe_file} -ijpath ${imagej_dir} -batch $macro_fn ${input_dir}
## MacOS mode
${imagej_dir}jre/bin/java -Xmx20000m -jar $imagej_exe_file -ijpath $imagej_dir -batch $macro_fn $input_dir
## Linux background mode here, using xvfb-run in case you run in server (graphical env), in local computer, java command is enough
# xvfb-run -a java -Xmx15000m -jar $imagej_dir/ij.jar -ijpath $imagej_dir/ -batch $macro_fn $input_dir
## In Linux local computer, java command is sufficient
# java -Xmx15000m -jar $imagej_dir/ij.jar -ijpath $imagej_dir/ -batch $macro_fn $input_dir
echo "Nucleus Segmentation Completed!"
echo "__________________________________\n"
|