diff --git a/spim_registration/timelapse/Snakefile b/spim_registration/timelapse/Snakefile
index a3ab631e600e6b918a0d437daaf41c8ed0b7a0b4..5596d0baf68395c791206d4974a1e2b9f37761a0 100755
--- a/spim_registration/timelapse/Snakefile
+++ b/spim_registration/timelapse/Snakefile
@@ -32,13 +32,13 @@ def produce_string(_fstring, *args, **kwargs):
 rule done:
     input: [ ds+"_deconvolved" for ds in datasets ]
 
-# add part for defining xml file on czi dataset
+# defining xml for czi dataset
 rule define_xml_czi:
     input: glob.glob('*.czi')
     output: config["define_xml_czi"]["first_xml_filename"] + ".xml"
     threads: 1
     message: "Execute define xml with {threads} threads on the following files {input}"
-    log: "define_xml.log"
+    log: "define_xml_czi.log"
     run: 
         cmd_string = produce_string("""{fiji-prefix} {fiji-app} \
         -Dimage_file_directory={jdir} \
@@ -57,13 +57,18 @@ rule define_xml_czi:
 	-Dpixel_distance_z={pixel_distance_z} \
 	-Dpixel_unit={pixel_unit} \
 	-Dfirst_xml_filename={first_xml_filename} \
-	-- --no-splash {bsh_file}""",
+	-- --no-splash {path_bsh}""",
 	config["common"],
 	config["define_xml_czi"],
-	jdir=JOBDIR)
+	jdir=JOBDIR,
+	path_bsh=config["common"]["bsh_directory"] + config["define_xml_czi"]["bsh_file"])
 	
+	cmd_string += "> {log} 2>&1"
         shell(cmd_string)
-	
+
+# resave .czi dataset as hdf5	
+rule resave_hdf5: 
+
 rule registration:
     input: "{xml_base}-{file_id}-00.h5"
     output: "{xml_base}-{file_id,\d+}-00.h5_registered", #"{xml_base}.job_{file_id,\d+}.xml"
diff --git a/spim_registration/timelapse/define_czi.bsh b/spim_registration/timelapse/define_czi.bsh
new file mode 100755
index 0000000000000000000000000000000000000000..74afeb13157ffa770376eed588bc2f6681682238
--- /dev/null
+++ b/spim_registration/timelapse/define_czi.bsh
@@ -0,0 +1,88 @@
+// Load Fiji dependencies
+import ij.IJ; 		// calls imagej
+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
+
+System.out.println("Start loading parameters");
+
+// Directory, and first .czi
+System.out.println("---------------------------------------------------------");
+System.out.println("Directory:");
+image_file_directory = System.getProperty( "image_file_directory" );
+first_xml_filename = System.getProperty( "first_xml_filename" );
+first_czi = System.getProperty( "first_czi" );
+
+System.out.println( "xml_file_path = " + image_file_directory + first_xml_filename + ".xml" );
+System.out.println( "first_czi_path = " + image_file_directory + first_czi );
+
+// Dataset settings
+System.out.println("---------------------------------------------------------");
+System.out.println("Dataset:");
+angle_1 = System.getProperty( "angle_1" );
+angle_2 = System.getProperty( "angle_2" );
+angle_3 = System.getProperty( "angle_3" );
+angle_4 = System.getProperty( "angle_4" );
+angle_5 = System.getProperty( "angle_5" );
+channel_1 = System.getProperty( "channel_1" );
+channel_2 = System.getProperty( "channel_2" );
+illumination_1 = System.getProperty( "illumination_1" );
+rotation_around = System.getProperty( "rotation_around" );
+
+System.out.println( "angle_1 = " + angle_1 );
+System.out.println( "angle_2 = " + angle_2 );
+System.out.println( "angle_3 = " + angle_3 );
+System.out.println( "angle_4 = " + angle_4 );
+System.out.println( "angle_5 = " + angle_5 );
+System.out.println( "channel_1 = " + channel_1 );
+System.out.println( "channel_2 = " + channel_2 );
+System.out.println( "illumination_1 = " + illumination_1 );
+System.out.println( "rotation_around = " + rotation_around );
+
+// Calibaration
+System.out.println("=========================================================");
+System.out.println("Calibration:");
+float pixel_distance_x = Float.parseFloat( System.getProperty( "pixel_distance_x" ) );
+float pixel_distance_y = Float.parseFloat( System.getProperty( "pixel_distance_y" ) );
+float pixel_distance_z = Float.parseFloat( System.getProperty( "pixel_distance_z" ) );
+pixel_unit = System.getProperty( "pixel_unit" );
+
+System.out.println( "pixel_distance_x = " + pixel_distance_x );
+System.out.println( "pixel_distance_y = " + pixel_distance_y );
+System.out.println( "pixel_distance_z = " + pixel_distance_z );
+System.out.println( "pixel_unit = " + pixel_unit );
+
+// Executes Fiji plugin
+System.out.println("=========================================================");
+System.out.println("Start plugin:");
+IJ.run("Define Multi-View Dataset", 
+	"type_of_dataset=[Zeiss Lightsheet Z.1 Dataset (LOCI Bioformats)] " +
+	"xml_filename=" + first_xml_filename + ".xml " +
+	"browse=" + image_file_directory + first_czi + " " + 
+	"first_czi=" + image_file_directory + first_czi + " " + 
+	"angle_1=" + angle_1 + " " +
+	"angle_2=" + angle_2 + " " + 
+	"angle_3=" + angle_3 + " " +
+	"angle_4=" + angle_4 + " " + 
+	"angle_5=" + angle_5 + " " +
+	"channel_1=" + channel_1 + " " +
+//	"channel_2=" + channel_2 + " " + // for dual channel comment out if single channel
+ 	"_______illumination_1=" + illumination_1 + " " +
+	"modify_calibration " + 
+	"modify_rotation_axis " +
+	"pixel_distance_x=" + pixel_distance_x + " " + 
+	"pixel_distance_y=" + pixel_distance_y + " " + 
+	"pixel_distance_z=" + pixel_distance_z + " " +
+	"pixel_unit=" + pixel_unit + " " +
+	"rotation_around=" + rotation_around + "");
+	
+/* shutdown */
+runtime.exit(0);
diff --git a/spim_registration/timelapse/export.bsh b/spim_registration/timelapse/export.bsh
new file mode 100755
index 0000000000000000000000000000000000000000..a3f77f1700b0a4c7d7dfeb50708a7ebbfdbad2ce
--- /dev/null
+++ b/spim_registration/timelapse/export.bsh
@@ -0,0 +1,82 @@
+// Load Fiji dependencies
+import ij.IJ; 		// calls imagej
+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(1); 	// defines the number of threads allowed 
+print("Threads: "+Prefs.getThreads()); // prints thread setting in output
+
+System.out.println("Start loading parameters");
+
+// Directory, and first .czi
+System.out.println("=========================================================");
+System.out.println("Directory:");
+image_file_directory = System.getProperty( "image_file_directory" );
+first_xml_filename = System.getProperty( "first_xml_filename" );
+hdf5_xml_filename = System.getProperty( "hdf5_xml_filename" );
+
+System.out.println( "dir=" + image_file_directory );
+System.out.println( "xml_filename=" + first_xml_filename );
+System.out.println( "hdf5_xml_filename=" + hdf5_xml_filename );
+
+// Dataset settings
+System.out.println("=========================================================");
+System.out.println("Dataset:");
+resave_angle = System.getProperty( "resave_angle" );
+resave_channel = System.getProperty( "resave_channel" );
+resave_illumination = System.getProperty( "resave_illumination" );
+resave_timepoint = System.getProperty( "resave_timepoint" );
+
+System.out.println( "resave_angle=" + resave_angle );
+System.out.println( "resave_channel=" + resave_channel );
+System.out.println( "resave_illumination=" + resave_illumination );
+System.out.println( "resave_timepoint=" + resave_timepoint);
+
+// Hdf5 settings
+System.out.println("=========================================================");
+System.out.println("Hdf5 settings:");
+subsampling_factors = System.getProperty( "subsampling_factors" );
+hdf5_chunk_sizes = System.getProperty( "hdf5_chunk_sizes" );
+timepoints_per_partition = System.getProperty( "timepoints_per_partition" );
+setups_per_partition = System.getProperty( "setups_per_partition" );
+run_only_job_number = System.getProperty( "run_only_job_number" );
+
+System.out.println( "subsampling_factors=" + subsampling_factors);
+System.out.println( "hdf5_chunk_sizes=" + hdf5_chunk_sizes );
+System.out.println( "timepoints_per_partition=" + timepoints_per_partition );
+System.out.println( "setups_per_partition=" + setups_per_partition );
+System.out.println( "run_only_job_number=" + run_only_job_number );
+
+// Activate cluster processing
+System.out.println("=========================================================");
+System.out.println("Cluster setting:");
+IJ.run("Toggle Cluster Processing", "display_cluster");
+
+// Executes Fiji plugin
+System.out.println("=========================================================");
+System.out.println("Start plugin:");
+IJ.run("As HDF5",
+	"select_xml=" + image_file_directory + first_xml_filename + ".xml " +
+	"resave_angle=[" + resave_angle + "] " +
+	"resave_channel=[" + resave_channel + "] " +
+	"resave_illumination=[" + resave_illumination + "] " +
+	"resave_timepoint=[" + resave_timepoint + "] " +
+	"manual_mipmap_setup " +
+	"subsampling_factors=[" + subsampling_factors + "] " +
+	"hdf5_chunk_sizes=[" + hdf5_chunk_sizes + "] " +
+	"split_hdf5 " +
+	"timepoints_per_partition=" + timepoints_per_partition + " " +
+	"setups_per_partition=" + setups_per_partition + " " +
+	"run_only_job_number=" + run_only_job_number + " " +
+	"use_deflate_compression " +
+	"export_path=" + image_file_directory + hdf5_xml_filename );
+
+/* shutdown */
+System.exit(0);
+
diff --git a/spim_registration/timelapse/tomancak_czi.json b/spim_registration/timelapse/tomancak_czi.json
index a328e67afaa0e327fe92b751d586b9b9a0b0497f..5114fec89a9b74f8c8f1b5ef10c847e10d0b66c9 100755
--- a/spim_registration/timelapse/tomancak_czi.json
+++ b/spim_registration/timelapse/tomancak_czi.json
@@ -4,26 +4,38 @@
 	"fiji-app" : "/projects/hpcsupport/steinbac/unicore/christopher-sandbox/unicore_jobs/Fiji.app.cuda_new/ImageJ-linux64",
 	"fiji-prefix" : "/sw/bin/xvfb-run -a",
 	"directory_cuda" : "/lustre/projects/hpcsupport/steinbac/unicore/christopher/unicore_jobs/Fiji.app.cuda_new/lib/",
-	"merged_xml" : "hdf5_test_unicore_merge"
+	"merged_xml" : "hdf5_test_unicore_merge",
+	"bsh_directory" : "/projects/pilot_spim/Christopher/snakemake-workflows/spim_registration/timelapse/"
     },
     
     "define_xml_czi" :
     {
-    	    "first_xml_filename" : "\"Stock68\"",
+    	    "first_xml_filename" : "Stock68",
     	    "pixel_distance_x" : "0.2875535786151886",
     	    "pixel_distance_y" : "0.2875535786151886",
     	    "pixel_distance_z" : "1.50000", 
     	    "pixel_unit" : "um",				    
     	    "first_czi" : "2015-02-21_LZ1_Stock68_3.czi",
+    	    "channel_1" : "green",		
+    	    "channel_2" : "red",
     	    "angle_1" : "0",
     	    "angle_2" : "72",
     	    "angle_3" :"144",
     	    "angle_4" :"216",
     	    "angle_5" : "288",
     	    "illumination_1" : "0",
+    	    "rotation_around" : "X-Axis",
     	    "bsh_file" : "define_czi.bsh" 
     },
     
+    "resave_hdf5" :
+    {
+    	    "resave_angle" : "\"All angles\"",
+    	    "resave_channel" : "\"All channels\"",
+    	    "resave_illumination" : "\"All illuminations\"",
+    	    "resave_timepoint" : "\"All Timepoints\""
+    },
+    
     "registration" :
     {
 	"timepoint" : "\"Single Timepoint (Select from List)\"",