diff --git a/spim_registration/timelapse/Snakefile b/spim_registration/timelapse/Snakefile index dbd0c60d588db6f404359b6f6a140d3ec8ee7700..c28fecd299bfe2bdbc9983a9af2881936373fbbd 100755 --- a/spim_registration/timelapse/Snakefile +++ b/spim_registration/timelapse/Snakefile @@ -65,7 +65,7 @@ rule define_xml_czi: # defining xml for tif dataset rule define_xml_tif: - input: glob.glob(re.sub("{{.}}","*",config["common"]['image_file_pattern'])) #replaces all occurrences of {{a}} (a can be any character) by * to use the string for globbing + input: glob.glob(re.sub("{{.}}","*", config["common"]['image_file_pattern'])) #replaces all occurrences of {{a}} (a can be any character) by * to use the string for globbing output: temp(config["common"]["first_xml_filename"] + ".xml") log: "logs/a2_define_xml_tif.log" run: @@ -164,7 +164,7 @@ rule resave_hdf5: shell(part_string) rule registration: - input: "{xml_base}-{file_id}-00.h5", expand("{dataset}.{suffix}",dataset=[ config["common"]["hdf5_xml_filename"].strip('\"')], suffix=["xml","h5"]) + input: rules.resave_hdf5.output, expand("{dataset}.{suffix}",dataset=[ config["common"]["hdf5_xml_filename"].strip('\"')], suffix=["xml","h5"]) # "{xml_base}-{file_id}-00.h5" output: temp("{xml_base}.job_{file_id,\d+}.xml") #, "{xml_base}-{file_id,\d+}-00.h5_registered", log: "logs/c_{xml_base}-{file_id}-registration.log" run: @@ -414,7 +414,7 @@ rule deconvolution: shell(cmd_string) rule define_output: - input: [ item + "_" + config["common"]["fusion_switch"] for item in datasets ], glob.glob('TP*') + input: glob.glob('TP*'), [ item + "_" + config["common"]["fusion_switch"] for item in datasets ] output: temp(config["common"]["output_xml"].strip('\"') + ".xml") log: "logs/f1_define_output.log" run: @@ -424,6 +424,7 @@ rule define_output: -Dtimepoints={output_timepoints} \ -Dchannels={output_channels} \ -Dimage_file_pattern={output_image_file_pattern} \ + -Dmanual_calibration_output={manual_calibration_output} \ -Dpixel_distance_x={output_pixel_distance_x} \ -Dpixel_distance_y={output_pixel_distance_y} \ -Dpixel_distance_z={output_pixel_distance_z} \ @@ -465,7 +466,7 @@ rule hdf5_xml_output: -Dtimepoints_per_partition={timepoints_per_partition} \ -Dsetups_per_partition={setups_per_partition} \ -Drun_only_job_number=0 \ - -Doutput_data_type={output_data_type} \ + -Dfusion_switch={fusion_switch} \ -Dconvert_32bit={convert_32bit}\ -- --no-splash {path_bsh}""", config["common"], @@ -496,7 +497,7 @@ rule resave_hdf5_output: -Dtimepoints_per_partition={timepoints_per_partition} \ -Dsetups_per_partition={setups_per_partition} \ -Drun_only_job_number={job_number} \ - -Doutput_data_type={output_data_type} \ + -Dfusion_switch={fusion_switch} \ -Dconvert_32bit={convert_32bit}\ -- --no-splash {path_bsh}""", config["common"], diff --git a/spim_registration/timelapse/config.yaml b/spim_registration/timelapse/config.yaml index 245010a27e7cb6b6db237d4ec7eca159f646fec1..09dce3b6ed644cbd13e4f95b18fb49e06d5d38e4 100755 --- a/spim_registration/timelapse/config.yaml +++ b/spim_registration/timelapse/config.yaml @@ -40,8 +40,15 @@ common: { # xml file names without .xml suffix # ============================================================================ first_xml_filename: 'Dpse_Dip3_VK33', # Name of the xml file for the .czi or .tif files + # + ########### simplyfy! ######################################################## hdf5_xml_filename: '"hdf5_Dpse_Dip3_VK33"', # Name of .xml file for the hdf5 data after resave_hdf5 merged_xml: 'hdf5_Dpse_Dip3_VK33_merge', # Name of .xml file after merge + # + # .xml file names + output_xml: '"fused_Dpse_Dip3_VK33"', + output_hdf5_xml: '"hdf5_fused_Dpse_Dip3_VK33"', + # # ============================================================================ # Describe the dataset # @@ -153,31 +160,25 @@ common: { # Image type (16Bit from content-based fusion, 32Bit from deconvolution) # ============================================================================ # Number of timepoints - output_timepoints: '0-71', # Timepoints format: '1-2' + output_timepoints: '0-1', # Timepoints format: '1-2' # # Naming pattern: # Single Channel: TP{{t}}_Chgreen_Ill0_Ang0,72,144,216,288.tif > Ch{name} is added here # Dual Channel: TP{{t}}_Ch{{0}}_Ill0_Ang0,72,144,216,288.tif > Ch{name} is added here - output_image_file_pattern: '"TP{{t}}_Chgreen_Ill0_Ang0,72,144,216,288.tif"', + output_image_file_pattern: '"TP{{t}}_Ch0_Ill0_Ang1,2,3,4,5.tif"', # # channel setting: # Single channel: '"NO (one channel)"' # Dual channel: '"YES (one file per channel)"' output_multiple_channels: '"NO (one channel)"', output_channels: "green", - # - # .xml file names - output_xml: '"fused_Dpse_Dip3_VK33"', - output_hdf5_xml: '"hdf5_fused_Dpse_Dip3_VK33"', - # + # Calibration + manual_calibration_output: "Yes", # calibration override: No or Yes # pixel size of output: take downsampling into account! output_pixel_distance_x: 0.285901069641113, output_pixel_distance_y: 0.285901069641113, output_pixel_distance_z: 0.285901069641113, - output_pixel_unit: 'um', - # - # File type - output_data_type: "16Bit" # "32Bit" or "16Bit" + output_pixel_unit: 'um' } # ============================================================================ # Advanced settings @@ -341,12 +342,13 @@ hdf5_output: { # subsampling_output: '"{{ {{1,1,1}}, {{2,2,2}} }}"', # chunk_sizes_output: '"{{ {{16,16,16}}, {{16,16,16}} }}"', # Standard settings for hdf5_output - output_type_of_dataset: '"Image Stacks (ImageJ Opener)"', + output_type_of_dataset: '"Image Stacks (LOCI Bioformats)"', # '"Image Stacks (ImageJ Opener)"' or '"Image Stacks (LOCI Bioformats)"' output_multiple_timepoints: '"YES (one file per time-point)"', output_multiple_angles: '"NO (one angle)"', output_illumination_directions: '"NO (one illumination direction)"', output_imglib_container: '"ArrayImg (faster)"', num_cores_hdf5_xml_output: 2, + num_cores_resave_hdf5_output: 2, bsh_file_define: "define_output.bsh", # .bsh script for defining the dataset bsh_file_hdf5: "export_output.bsh" # .bsh script for resaving into hdf5 } diff --git a/spim_registration/timelapse/define_output.bsh b/spim_registration/timelapse/define_output.bsh old mode 100644 new mode 100755 index e2469feb053fc3a11f2b2bf0169f2dbf699ffa15..54866ae5ec6e24a704d39ae28ab71d0aa8959250 --- a/spim_registration/timelapse/define_output.bsh +++ b/spim_registration/timelapse/define_output.bsh @@ -83,6 +83,42 @@ else { } +// Calibaration +System.out.println("========================================================="); +System.out.println("Calibration:"); +manual_calibration_output = System.getProperty( "manual_calibration_output" ); +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" ); + +// builds string for calibration override +if (manual_calibration_output.equalsIgnoreCase( "No" ) ) +{ + modify_calibration = "calibration_definition=[Load voxel-size(s) from file(s)] "; + manual_calibration_string = ""; + System.out.println( modify_calibration ); +} + +else if (manual_calibration_output.equalsIgnoreCase( "Yes" ) ) +{ + + modify_calibration = "calibration_definition=[User define voxel-size(s)] "; + manual_calibration_string = " pixel_distance_x=" + pixel_distance_x + " " + + "pixel_distance_y=" + pixel_distance_y + " " + + "pixel_distance_z=" + pixel_distance_z + " " + + "pixel_unit=" + pixel_unit + " "; + System.out.println( "Calibration set to manual" ); + System.out.println( modify_calibration ); + System.out.println( "manual_calibration_string:" + manual_calibration_string ); +} + +else +{ + System.out.println( "Manual calibration setting bad" ); +} + + System.out.println( "channels = " + channels ); System.out.println("Define Multi-View Dataset , type_of_dataset=[" + type_of_dataset + "] " + @@ -95,12 +131,11 @@ System.out.println("Define Multi-View Dataset , type_of_dataset=[" + type_of_dat "image_file_pattern=" + image_file_pattern + " " + "timepoints_=" + timepoints + " " + channels + - "calibration_type=[Same voxel-size for all views] calibration_definition=[User define voxel-size(s)]" + " " + + "calibration_type=[Same voxel-size for all views] " + + modify_calibration + "imglib2_data_container=[" + imglib_container + "] " + - "pixel_distance_x=" + pixel_distance_x + " " + - "pixel_distance_y=" + pixel_distance_y + " " + - "pixel_distance_z=" + pixel_distance_z + " " + - "pixel_unit=" + pixel_unit + ""); + manual_calibration_string + + ""); // Executes Fiji plugin System.out.println("========================================================="); @@ -117,12 +152,11 @@ IJ.run("Define Multi-View Dataset", "image_file_pattern=" + image_file_pattern + " " + "timepoints_=" + timepoints + " " + channels + - "calibration_type=[Same voxel-size for all views] calibration_definition=[User define voxel-size(s)]" + " " + + "calibration_type=[Same voxel-size for all views] " + + modify_calibration + "imglib2_data_container=[" + imglib_container + "] " + - "pixel_distance_x=" + pixel_distance_x + " " + - "pixel_distance_y=" + pixel_distance_y + " " + - "pixel_distance_z=" + pixel_distance_z + " " + - "pixel_unit=" + pixel_unit + ""); + manual_calibration_string + + ""); } catch ( e ) { diff --git a/spim_registration/timelapse/define_tif_zip.bsh b/spim_registration/timelapse/define_tif_zip.bsh index 8108d62f94769399b629539fa68745bd6892d2c8..b00f970d97a7769792307a0f53221e7b28c97256 100755 --- a/spim_registration/timelapse/define_tif_zip.bsh +++ b/spim_registration/timelapse/define_tif_zip.bsh @@ -109,7 +109,6 @@ if (illumination.equalsIgnoreCase("")) System.out.println( "Illuminations = " + illum_string ); -// Calibaration // Calibaration System.out.println("========================================================="); System.out.println("Calibration:"); diff --git a/spim_registration/timelapse/export_output.bsh b/spim_registration/timelapse/export_output.bsh index 065b998ae669a0e6e01b43cb9245146686ae9605..d61da871ba47da3f62690d49f1be2549884f67cc 100755 --- a/spim_registration/timelapse/export_output.bsh +++ b/spim_registration/timelapse/export_output.bsh @@ -54,22 +54,21 @@ System.out.println( "setups_per_partition=" + setups_per_partition ); System.out.println( "run_only_job_number=" + run_only_job_number ); // Add a switch for choosing between 16 or 32 bit -output_data_type = System.getProperty( "output_data_type" ); -System.out.println( "Output Datatype = " + output_data_type ); +fusion_switch = System.getProperty( "fusion_switch" ); +System.out.println( "Output Datatype = " + fusion_switch ); convert_32bit = System.getProperty( "convert_32bit" ); -if ( output_data_type.equalsIgnoreCase( "32Bit" ) ) +if ( fusion_switch.equalsIgnoreCase( "deconvolution" ) ) { data_string = "convert_32bit=" + convert_32bit; + System.out.println( "Data string = " + data_string ); } -else if ( output_data_type.equalsIgnoreCase( "16Bit" ) ) +else if ( fusion_switch.equalsIgnoreCase( "fusion" ) ) { data_string = ""; } -System.out.println( "Data string = " + data_string ); - // Activate cluster processing System.out.println("========================================================="); System.out.println("Cluster setting:");