diff --git a/spim_registration/timelapse/Snakefile b/spim_registration/timelapse/Snakefile index 5faec2cf7f7fc810f44db01f2adbf48b5281ed2d..ef53b60fc310e4748117d190d3d82c980189a55c 100755 --- a/spim_registration/timelapse/Snakefile +++ b/spim_registration/timelapse/Snakefile @@ -205,7 +205,7 @@ rule xml_merge: rule timelapse: input: rules.xml_merge.output output: rules.xml_merge.output[0] + "_timelapse" - log: "timelapse.log" + log: "{xml_base}_timelapse.log" run: cmd_string = produce_string( """{fiji-prefix} {fiji-app} \ @@ -218,7 +218,7 @@ rule timelapse: -Dreference_timepoint={reference_timepoint} \ -Dchannel_1={proc-ch} \ -Dtype_of_registration_timelapse={type_of_registration_timelapse} \ - -Dregistration_algorithm={registration_algorithm} \ + -Dregistration_algorithm={algorithm} \ -Dreg_1_interest_points_channel={interest_points_channel_0} \ -Dreg_2_interest_points_channel={interest_points_channel_1} \ -Dtransformation_model={transformation_model} \ @@ -233,66 +233,69 @@ rule timelapse: input="{input}", path_bsh=config["common"]["bsh_directory"] + config["timelapse"]["bsh_file"], jdir=JOBDIR) + cmd_string += "> {log} 2>&1 && touch {output}" shell(cmd_string) -rule external_trafo: - input: rules.timelapse.output +rule external_transform: + input: rules.timelapse.output, merged_xml="{xml_base}_merge.xml" output: rules.timelapse.output[0] + "_external_trafo" - log: "external_trafo.log" + log: "external_transform.log" run: - cmd_string = produce_string("""{fiji-prefix} {fiji-app} \ --Dimage_file_directory={jdir} \ - -Dmerged_xml={input} \ --Dtransform_angle={angle} \ --Dtransform_channel={channel} \ --Dtransform_illumination={illumination} \ --Dtransform_timepoint={timepoint} \ --Dtransformation={transformation} \ --Dapply_transformation={apply_transformation} \ --Ddefine_mode_transform={define_mode_transform} \ --Dmatrix_transform={matrix_transform} \ --- --no-splash {path_bsh}""", + cmd_string = produce_string( + """{fiji-prefix} {fiji-app} \ + -Dimage_file_directory={jdir} \ + -Dmerged_xml={merged_xml_file} \ + -Dtransform_angle={angle} \ + -Dtransform_channel={channel} \ + -Dtransform_illumination={illumination} \ + -Dtransform_timepoint={timepoint} \ + -Dtransformation={transformation} \ + -Dapply_transformation={apply_transformation} \ + -Ddefine_mode_transform={define_mode_transform} \ + -Dmatrix_transform={matrix_transform} \ + -- --no-splash {path_bsh}""", config["common"], config["external_transform"], - path_bsh=config["common"]["bsh_directory"] + config["external_trafo"]["bsh_file"], + path_bsh=config["common"]["bsh_directory"] + config["external_transform"]["bsh_file"], jdir=JOBDIR, - input="{input}") + merged_xml_file="{input.merged_xml}") cmd_string += "> {log} 2>&1 && touch {output}" shell(cmd_string) rule deconvolution: - input: rules.external_trafo.output, "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml" + input: rules.external_transform.output, "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml" output: "{xml_base}-{file_id,\d+}-00.h5_deconvolved" log: "{xml_base}-{file_id,\d+}-00-deconvolution.log" run: - cmd_string = produce_string("""{fiji-prefix} {fiji-app} \ --Dimage_file_directory={jdir} \ --Ddeco_output_file_directory={jdir} \ + cmd_string = produce_string( + """{fiji-prefix} {fiji-app} \ + -Dimage_file_directory={jdir} \ + -Ddeco_output_file_directory={jdir} \ -Dmerged_xml={merged_xml_file} \ --Dparallel_timepoints={file_id_w} \ --Dprocess_timepoint={process_timepoint} \ --Dprocess_channel={process_channel} \ --Dprocess_illumination={process_illumination} \ --Dprocess_angle={process_angle} \ --Dminimal_x_deco={minimal_x} \ --Dminimal_y_deco={minimal_y} \ --Dminimal_z_deco={minimal_z} \ --Dmaximal_x_deco={maximal_x} \ --Dmaximal_y_deco={maximal_y} \ --Dmaximal_z_deco={maximal_z} \ --Dimglib2_container_deco={imglib2_container} \ --Dtype_of_iteration={type_of_iteration} \ --Dosem_acceleration={osem_acceleration} \ --DTikhonov_parameter={Tikhonov_parameter} \ --Dcompute={compute} \ --Dpsf_estimation={psf_estimation} \ --Ddirectory_cuda={directory_cuda} \ --Ddetections_to_extract_psf_for_channel_0={detections_to_extract_psf_for_channel_0} \ --Ddetections_to_extract_psf_for_channel_1={detections_to_extract_psf_for_channel_1} \ --Dpsf_size_x={psf_size_x} \ --Dpsf_size_y={psf_size_y} \ --Dpsf_size_z={psf_size_z} \ --Diterations={iterations} \ + -Dparallel_timepoints={file_id_w} \ + -Dprocess_timepoint={process_timepoint} \ + -Dprocess_channel={process_channel} \ + -Dprocess_illumination={process_illumination} \ + -Dprocess_angle={process_angle} \ + -Dminimal_x_deco={minimal_x} \ + -Dminimal_y_deco={minimal_y} \ + -Dminimal_z_deco={minimal_z} \ + -Dmaximal_x_deco={maximal_x} \ + -Dmaximal_y_deco={maximal_y} \ + -Dmaximal_z_deco={maximal_z} \ + -Dimglib2_container_deco={imglib2_container} \ + -Dtype_of_iteration={type_of_iteration} \ + -Dosem_acceleration={osem_acceleration} \ + -DTikhonov_parameter={Tikhonov_parameter} \ + -Dcompute={compute} \ + -Dpsf_estimation={psf_estimation} \ + -Ddirectory_cuda={directory_cuda} \ + -Ddetections_to_extract_psf_for_channel_0={detections_to_extract_psf_for_channel_0} \ + -Ddetections_to_extract_psf_for_channel_1={detections_to_extract_psf_for_channel_1} \ + -Dpsf_size_x={psf_size_x} \ + -Dpsf_size_y={psf_size_y} \ + -Dpsf_size_z={psf_size_z} \ + -Diterations={iterations} \ -- --no-splash {path_bsh}""", config["common"], config["deconvolution"], diff --git a/spim_registration/timelapse/cluster.json b/spim_registration/timelapse/cluster.json old mode 100644 new mode 100755 index 2807e94c521056fda295d81be4b2ee3a6954d42f..cb47db9c31910bf7f679d661b0a6a00fa177949e --- a/spim_registration/timelapse/cluster.json +++ b/spim_registration/timelapse/cluster.json @@ -9,6 +9,11 @@ { "lsf_extra" : "-R \"span[hosts=1] rusage[mem=100000]\"" }, + + "timelapse" : + { + "lsf_extra" : "-n 6 -R \"span[hosts=1] rusage[mem=100000]\"" + }, "external_trafo" : { diff --git a/spim_registration/timelapse/timelapse_registration.bsh b/spim_registration/timelapse/timelapse_registration.bsh index e27c1fbb018bc512c33d13eff552cdaf15a8cb68..76290e3288480b86bdb3f95aa30304c4b14f4ef3 100755 --- a/spim_registration/timelapse/timelapse_registration.bsh +++ b/spim_registration/timelapse/timelapse_registration.bsh @@ -18,6 +18,8 @@ System.out.println("Xml file:"); xml_path = System.getProperty( "image_file_directory" ); merged_xml = System.getProperty( "merged_xml" ); +if ( ! merged_xml.endsWith(".xml") ) + merged_xml = merged.xml + ".xml"; System.out.println( "selected_xml = " + xml_path + merged_xml + ".xml"); @@ -69,8 +71,10 @@ System.out.println( "significance = " + significance ); System.out.println( "=======================================================" ); System.out.println( "Starting Timelapse Registration" ); + +try { IJ.run("Register Dataset based on Interest Points", - "select_xml=" + xml_path + merged_xml + ".xml " + + "select_xml=" + xml_path + merged_xml + " " + "process_angle=[" + process_angle + "] " + "process_channel=[" + process_channel_timelapse + "] " + "process_illumination=[" + process_illumination + "] " + @@ -87,6 +91,14 @@ IJ.run("Register Dataset based on Interest Points", "lamba=" + lambda + " " + "allowed_error_for_ransac=" + allowed_error_for_ransac + " " + "significance=" + significance + ""); +} +catch ( e ) { + + print( "[deconvolution-GPU] caught exception: "+e ); + //important to fail the process if exception occurs + runtime.exit(1); + +} /* shutdown */ runtime.exit(0); diff --git a/spim_registration/timelapse/tomancak_czi.json b/spim_registration/timelapse/tomancak_czi.json index 7a5d46f710ed22805805c561d4bc47df4754a50d..06d98a778a1b5caf76fa605d08e5bfa3e8fa7909 100755 --- a/spim_registration/timelapse/tomancak_czi.json +++ b/spim_registration/timelapse/tomancak_czi.json @@ -6,8 +6,8 @@ "directory_cuda" : "/lustre/projects/hpcsupport/steinbac/unicore/christopher/unicore_jobs/Fiji.app.cuda_new/lib/", "merged_xml" : "hdf5_test_unicore_merge", "bsh_directory" : "/projects/pilot_spim/Christopher/snakemake-workflows/spim_registration/timelapse/", - "first_xml_filename" : "Stock68", - "hdf5_xml_filename" : "\"hdf5_Stock68\"" + "first_xml_filename" : "test_unicore", + "hdf5_xml_filename" : "\"hdf5_test_unicore\"" }, "define_xml_czi" : @@ -79,13 +79,14 @@ "radius_2" : "3", "threshold" : "0.005", "interest_points_channel_0" : "\"beads\"", - "interest_points_channel_1" : "\"[DO NOT register this channel]\"", + "interest_points_channel_1" : "\"beads\"", "fix_tiles" : "\"Fix first tile\"", "map_back_tiles" : "\"Map back to first tile using rigid model\"", "transformation_model" : "Affine", "model_to_regularize_with" : "Rigid", "lambda" : "0.10" , "allowed_error_for_ransac" : "5", + "significance" : "10", "detection_min_max" : "find_maxima", "initial_sigma" : "1.8", "threshold_gaussian" : "0.0080",