diff --git a/spim_registration/tools/compress/create-compress-jobs.sh b/spim_registration/tools/compress/create-compress-jobs.sh deleted file mode 100755 index e4e869b39b0546f9c128d3791f33c10bd7137c09..0000000000000000000000000000000000000000 --- a/spim_registration/tools/compress/create-compress-jobs.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# path of master file -source ../master_preprocessing.sh - -# creates directory for job files if not present -mkdir -p $jobs_compress - -echo $jobs_compress -echo $czi_compress - -# splits up resaving into 1 job per .czi file and writes the given parameters -# into the job file -for i in $timepoints - -do - for a in $angle_prep - do - job="$jobs_compress/compress-$i-$a.job" - echo $job - echo "$XVFB_RUN $sysconfcpus $Fiji_resave \ - -Ddir=$image_file_directory \ - -Dtimepoint=$i \ - -Dangle=$a \ - -Dpad=$pad \ - -- --no-splash $czi_compress" >> "$job" - chmod a+x "$job" - done -done - diff --git a/spim_registration/tools/compress/for_czi.bsh b/spim_registration/tools/compress/for_czi.bsh deleted file mode 100755 index e860cf53e8038a8a241c844fb8935b6a4a219162..0000000000000000000000000000000000000000 --- a/spim_registration/tools/compress/for_czi.bsh +++ /dev/null @@ -1,46 +0,0 @@ -// Loads Fiji dependencies -import ij.IJ; -import ij.ImagePlus; -import java.lang.Runtime; -import java.io.File; -import java.io.FilenameFilter; - -runtime = Runtime.getRuntime(); - -// Loads parameters form job file -System.out.println( "=======================================================" ); -System.out.println( "Load Parameters" ) ; - -dir = System.getProperty( "dir" ); -int timepoint = Integer.parseInt( System.getProperty( "timepoint" ) ); -angle = System.getProperty( "angle" ); -int pad = Integer.parseInt( System.getProperty( "pad" ) ); - -// Prints Parameters into output file -System.out.println( "directory = " + dir ); -System.out.println( "timepoint = " + timepoint ); -System.out.println( "angle = " + angle ); -System.out.println( "pad = " + pad ); - - -// Executes Fiji Plugin "Bioformats Importer" to open .czi file -System.out.println( "=======================================================" ); -System.out.println( "Opening Image" ) ; -IJ.run("Bio-Formats Importer", - "open=" + dir + "spim_TL" + IJ.pad( timepoint, pad ) + "_Angle" + angle + ".czi" + " " + - "autoscale " + - "color_mode=Default " + - "specify_range " + - "view=[Standard ImageJ] " + - "stack_order=Default " + - "t_begin=1000 " + - "t_end=1000 " + - "t_step=1"); - -// Resaves .czi files as .zip file -System.out.println( "Save as compressed image" ) ; -IJ.saveAs("ZIP ", dir + "spim_TL" + IJ.pad( timepoint, pad ) + "_Angle" + angle + ".zip"); - -/* shutdown */ -runtime.exit(0); - diff --git a/spim_registration/tools/compress/resubmit-failed-jobs.sh b/spim_registration/tools/compress/resubmit-failed-jobs.sh deleted file mode 100755 index 7f2b0eff00cefb3c37d98211532199914fb10b01..0000000000000000000000000000000000000000 --- a/spim_registration/tools/compress/resubmit-failed-jobs.sh +++ /dev/null @@ -1,6 +0,0 @@ -names=`grep "exit code 1" out.* -l` -for name in $names; do - job=`sed -n '4,4p' $name | sed -n "s/Job <\([^>]*\)>.*/\1/p"` - echo bsub -q short -n 12 -R rusage[mem=110000] -R span[hosts=1] -o "out.%J" -e "err.%J" ${job} - bsub -q short -n 12 -R rusage[mem=110000] -R span[hosts=1] -o "out.%J" -e "err.%J" ${job} -done diff --git a/spim_registration/tools/compress/submit-jobs b/spim_registration/tools/compress/submit-jobs deleted file mode 100755 index 626449c2bfc64732d0467b6f20cff8cb6060d2a7..0000000000000000000000000000000000000000 --- a/spim_registration/tools/compress/submit-jobs +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -for file in `ls ${1} | grep ".job$"` -do - bsub -q short -n 2 -R span[hosts=1] -o "out.%J" -e "err.%J" ${1}/$file -done diff --git a/spim_registration/tools/czi_resave/create-resaving-jobs.sh b/spim_registration/tools/czi_resave/create-resaving-jobs.sh index 200bc1a50935f74af511382c9c7aba46d9f1fa20..2874a6089ae69b0ceb91cd77fae6aece30e23b4a 100755 --- a/spim_registration/tools/czi_resave/create-resaving-jobs.sh +++ b/spim_registration/tools/czi_resave/create-resaving-jobs.sh @@ -8,19 +8,26 @@ mkdir -p $jobs_resaving # splits up resaving into 1 job per .czi file and writes the given parameters # into the job file -for i in $timepoints +tif_timepoint=${first_timepoint} + +for timepoint in ${timepoints} do - for a in $angle_prep + for angle in ${angles} do - job="$jobs_resaving/resave-$i-$a.job" + job="$jobs_resaving/resave-${timepoint}-${angle}.job" echo $job - echo "$XVFB_RUN $sysconfcpus $Fiji_resave \ - -Ddir=$image_file_directory \ - -Dtimepoint=$i \ - -Dangle=$a \ - -Dpad=$pad \ - -- --no-splash $resaving" >> "$job" - chmod a+x "$job" + echo "${XVFB_RUN} ${sysconfcpus} ${Fiji} \ + -Ddir=${image_file_directory} \ + -Dfirst_czi_name=${first_czi_name} \ + -Dtimepoint=${timepoint} \ + -Dangle=${angle} \ + -Dstack_size=${stack_size} \ + -Dpad=${pad} \ + -Dtif_timepoint=${tif_timepoint} \ + -- --no-splash ${resaving}" >> "${job}" + chmod a+x "${job}" done +tif_timepoint=$((${tif_timepoint} + 1)) + done diff --git a/spim_registration/tools/czi_resave/resaving.bsh b/spim_registration/tools/czi_resave/resaving.bsh index eb3c14e4ee60fd67c2b22c77ee3e62a259e4220a..00bd0d7b7983e69782deac28abb97e00f9f8694c 100755 --- a/spim_registration/tools/czi_resave/resaving.bsh +++ b/spim_registration/tools/czi_resave/resaving.bsh @@ -1,44 +1,60 @@ // Loads Fiji dependencies import ij.IJ; +import ij.Prefs; // calls imagej settings import ij.ImagePlus; import java.lang.Runtime; import java.io.File; import java.io.FilenameFilter; runtime = Runtime.getRuntime(); +System.out.println(runtime.availableProcessors() + " cores available for multi-threading"); + +Prefs.setThreads(2); // defines the number of threads allowed +print("Threads: "+ Prefs.getThreads()); // prints thread setting in output // Loads parameters form job file System.out.println( "=======================================================" ); System.out.println( "Load Parameters" ) ; dir = System.getProperty( "dir" ); +first_czi_name = System.getProperty( "first_czi_name" ); + int timepoint = Integer.parseInt( System.getProperty( "timepoint" ) ); angle = System.getProperty( "angle" ); +stack_size = System.getProperty( "stack_size" ); int pad = Integer.parseInt( System.getProperty( "pad" ) ); +int tif_timepoint = Integer.parseInt( System.getProperty( "tif_timepoint" ) ); // Prints Parameters into output file System.out.println( "directory = " + dir ); +System.out.println( "first_czi_name = " + first_czi_name ); System.out.println( "timepoint = " + timepoint ); System.out.println( "angle = " + angle ); +System.out.println( "stack_size = " + stack_size ); System.out.println( "pad = " + pad ); +System.out.println( "timepoint = " + tif_timepoint ); // Executes Fiji Plugin "Bioformats Importer" to open .czi file System.out.println( "=======================================================" ); System.out.println( "Opening Image" ) ; IJ.run("Bio-Formats Importer", - "open=" + dir + "spim_TL" + IJ.pad( timepoint, pad ) + "_Angle" + angle + ".czi" + " " + + "open=" + dir + first_czi_name + " " + "autoscale " + "color_mode=Default " + "specify_range " + "view=[Standard ImageJ] " + - "stack_order=Default " + - "t_begin=1000 " + - "t_end=1000 " + - "t_step=1"); + "stack_order=XYCZT " + + "series_" + angle + " " + + "z_begin_" + angle + "=1 " + + "z_end_" + angle + "=" + stack_size + " " + + "z_step_" + angle + "=1 " + + "t_begin_" + angle + "=" + timepoint + " " + + "t_end_" + angle + "=" + timepoint + " " + + "t_step_" + angle + "=1"); // Resaves .czi files as .tif file System.out.println( "Save as .tif" ) ; -IJ.saveAs("Tiff ", dir + "spim_TL" + IJ.pad( timepoint, pad ) + "_Angle" + angle + ".tif"); +IJ.saveAs("Tiff ", dir + "img_TL" + IJ.pad( tif_timepoint, pad ) + "_Angle" + angle + ".tif"); /* shutdown */ runtime.exit(0); diff --git a/spim_registration/tools/czi_resave/submit-jobs b/spim_registration/tools/czi_resave/submit-jobs index 626449c2bfc64732d0467b6f20cff8cb6060d2a7..00fbd7fbd40dbde0f81d508bb2448fa754414f52 100755 --- a/spim_registration/tools/czi_resave/submit-jobs +++ b/spim_registration/tools/czi_resave/submit-jobs @@ -2,5 +2,5 @@ for file in `ls ${1} | grep ".job$"` do - bsub -q short -n 2 -R span[hosts=1] -o "out.%J" -e "err.%J" ${1}/$file + bsub -q short -n 2 -R span[hosts=1] -R rusage[mem=10000] -o "out.%J" -e "err.%J" ${1}/$file done diff --git a/spim_registration/tools/master_preprocessing.sh b/spim_registration/tools/master_preprocessing.sh index 74a9ba09898ba51ed24de4a04f5aafba420629d9..2bc2ed48ea71441f95abae0ccdeddac3a58f6f54 100755 --- a/spim_registration/tools/master_preprocessing.sh +++ b/spim_registration/tools/master_preprocessing.sh @@ -21,7 +21,7 @@ # c=0,1 etc # spim_TL{tt}_Angle{a}_Channel{c}.tif #=============================================================================== -image_file_directory="/projects/pilot_spim/Christopher/test_pipeline/single_channel/resave_test/" +image_file_directory="/projects/pilot_spim/Christopher/cluster_test_HisYFP/2013-11-14_His-YFP_2/" # --- jobs directory ----------------------------------------------------------- job_directory="/projects/pilot_spim/Christopher/snakemake-workflows/spim_registration/tools/" @@ -31,27 +31,18 @@ job_directory="/projects/pilot_spim/Christopher/snakemake-workflows/spim_registr # Important: For renaming and resaving .czi files the first .czi file has to # carry the index (0) #------------------------------------------------------------------------------- -timepoints="`seq 0 1`" # number of time points format: "`seq 0 1`" -angle_prep="1 2 3 4 5" # angles format: "1 2 3" +first_czi_name="2013-11-14_His-YFP_2.czi" +timepoints="`seq 1 2`" # number of time points format: "`seq 0 1`" +angles="1 2 3 4 5" # angles format: "1 2 3" +stack_size="142" pad="2" # for padded zeros -num_angles="5" -#--- Renaming ------------------------------------------------------------------ - -first_index="0" # First index of czi files -last_index="9" # Last index of czi files first_timepoint="0" # Starts with 0 -angles_renaming=(1 2 3 4 5) # Angles format: (1 2 3) - -source_pattern=2015-02-21_LZ1_Stock68_3\(\{index\}\).czi # Name of .czi files -target_pattern=spim_TL\{timepoint\}_Angle\{angle\}.czi # The output pattern of renaming - #------------------------------------------------------------------------------- # Fiji settings #------------------------------------------------------------------------------- XVFB_RUN="/sw/bin/xvfb-run -a" # virtual frame buffer sysconfcpus="sysconfcpus -n 2" -Fiji: "/sw/users/schmied/packages/2015-06-30_Fiji.app.cuda/ImageJ-linux64" -Fiji_resave="/sw/users/schmied/packages/2014-06-02_Fiji.app_lifeline/ImageJ-linux64" # Fiji that works for resaving +Fiji="/sw/users/schmied/packages/2015-06-30_Fiji.app.cuda/ImageJ-linux64" #------------------------------------------------------------------------------- # Pre-processing #-------------------------------------------------------------------------------