From 3f3996b9efe223248ecf3447b5ca48ad86fcd48c Mon Sep 17 00:00:00 2001
From: Christopher Schmied <schmied@mpi-cbg.de>
Date: Wed, 8 Jul 2015 13:15:03 +0200
Subject: [PATCH] Tested and debugged rename-zeiss-files

---
 spim_registration/tools/master_preprocessing.sh | 12 ++++++------
 spim_registration/tools/rename-zeiss-files.sh   | 11 +++++------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/spim_registration/tools/master_preprocessing.sh b/spim_registration/tools/master_preprocessing.sh
index be31db3..b0a2ca6 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_3.0/czi/"
+image_file_directory="/projects/pilot_spim/Christopher/test_pipeline/single_channel/resave_test/"
 
 # --- jobs directory -----------------------------------------------------------
 job_directory="/projects/pilot_spim/Christopher/snakemake-workflows/spim_registration/tools/"
@@ -32,17 +32,17 @@ job_directory="/projects/pilot_spim/Christopher/snakemake-workflows/spim_registr
 # carry the index (0)
 #-------------------------------------------------------------------------------
 
-pad="3"		# for padded zeros
-angle_prep="1" # angles format: "1 2 3"
+pad="2"		# for padded zeros
+angle_prep="1 2 3 4 5" # angles format: "1 2 3"
 
 #--- Renaming ------------------------------------------------------------------
 
 first_index="0"		# First index of czi files
-last_index="391"		# Last 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=2014-10-23_H2A_gsb_G3\(\{index\}\).czi # Name of .czi files
+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
 
 #-------------------------------------------------------------------------------
@@ -50,7 +50,7 @@ target_pattern=spim_TL\{timepoint\}_Angle\{angle\}.czi	# The output pattern of r
 #-------------------------------------------------------------------------------
 XVFB_RUN="/sw/bin/xvfb-run" # virtual frame buffer
 
-Fiji_resave="/sw/users/schmied/lifeline/Fiji.app.lifeline2/ImageJ-linux64" # Fiji that works for resaving
+Fiji_resave="/sw/users/schmied/packages/2014-06-02_Fiji.app_lifeline/ImageJ-linux64" # Fiji that works for resaving
 #-------------------------------------------------------------------------------
 # Pre-processing
 #-------------------------------------------------------------------------------
diff --git a/spim_registration/tools/rename-zeiss-files.sh b/spim_registration/tools/rename-zeiss-files.sh
index fff0979..b41a96f 100755
--- a/spim_registration/tools/rename-zeiss-files.sh
+++ b/spim_registration/tools/rename-zeiss-files.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 # path of master file
-source ../master_preprocessing.sh
+source master_preprocessing.sh
 
 # path of source and target files
 source_pattern=${image_file_directory}${source_pattern}
@@ -15,19 +15,18 @@ t=`printf "%0${pad}d" "${t}"`
 while [ $i -le $last_index ]; do
 
         for a in "${angles_renaming[@]}"; do
-
+        	
         	source=${source_pattern/\{index\}/${i}}
                 tmp=${target_pattern/\{timepoint\}/${t}}
-                target=${tmp/\{angle\}/${a}
+                target=${tmp/\{angle\}/${a}}
 
                 echo ${source} ${target} # displays source file and target file with path
 
-                mv ${source} ${target} # renames source file into target pattern
-                #cp ${source} ${target} # alternatively copy source file and resave into target pattern
+                #mv ${source} ${target} # renames source file into target pattern
+                cp ${source} ${target} # alternatively copy source file and resave into target pattern
                 let i=i+1
 
         done
-	t=$(( 10#${t} ))
         let t=t+1
         t=`printf "%0${pad}d" "${t}"`
 
-- 
GitLab