Skip to content
Snippets Groups Projects
Commit 27743163 authored by Peter Steinbach's avatar Peter Steinbach
Browse files

Merge pull request #1 from schmiedc/NewBshScripts

New bsh scripts .. Thanks!
parents eb42acf0 866cf27a
No related branches found
No related tags found
No related merge requests found
Showing
with 2410 additions and 369 deletions
import os, glob, sys, re
from timelaps_utils import produce_xml_merge_job_files, produce_string, padding_of_file_id
#where are we (can be configured through -d/--directory flag)
JOBDIR=os.path.abspath(os.path.curdir)
if JOBDIR[-1] != "/":
if JOBDIR[-1] != "/": # this checks if jobdir ends with slash if not it adds a slash
JOBDIR+="/"
#data specific config file, expected to be inside JOBDIR
configfile: "tomancak.json"
datasets = glob.glob('*00.h5')
#TODO: this should go into a python module in this path
fre = re.compile(r'(?P<xml_base>\w+)-(?P<file_id>\d+)-00.h5')
xml_merge_in = []
for ds in datasets:
bn = os.path.basename(ds)
bn_res = fre.search(bn)
xml_base,file_id = bn_res.group('xml_base'),bn_res.group('file_id')
xml_merge_in.append("{xbase}.job_{fid}.xml".format(xbase=xml_base, fid=int(file_id)))
#TODO: this should go into a python module in this path
def produce_string(_fstring, *args, **kwargs):
contents = dict()
for item in args:
if type(item) == type(kwargs):
contents.update(item)
contents.update(kwargs)
return _fstring.format(**contents)
# configfile: "tomancak_test_cluster.json"
configfile: "tomancak_test_cluster.yaml"
padding_format = "{0:0"+str(padding_of_file_id(int(config["common"]["ntimepoints"])))+"d}"
ds_format = "-"+padding_format+"-00.h5"
# problematic needs padding of file_id
datasets = [ str(config["common"]["hdf5_xml_filename"].strip('\"')+(ds_format.format(item))) for item in range(int(config["common"]["ntimepoints"])) ]
xml_merge_in = produce_xml_merge_job_files(datasets)
rule done:
input: [ ds+"_deconvolved" for ds in datasets ]
input: [ ds + "_output_hdf5" for ds in datasets ]
#input: [ ds + "_fusion" for ds in datasets ]
rule resave_prepared:
input: expand("{dataset}.{suffix}",dataset=[ config["common"]["hdf5_xml_filename"] ], suffix=["xml","h5"])
# defining xml for czi dataset
rule define_xml_czi:
input:glob.glob('*.czi'), config["define_xml_czi"]["first_czi"]
output: config["common"]["first_xml_filename"] + ".xml"
log: "define_xml_czi.log"
run:
cmd_string = produce_string("""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dfirst_czi={first_czi} \
-Dangles={angles} \
-Dchannels={channels} \
-Dillumination={illumination} \
-Dpixel_distance_x={pixel_distance_x} \
-Dpixel_distance_y={pixel_distance_y} \
-Dpixel_distance_z={pixel_distance_z} \
-Dpixel_unit={pixel_unit} \
-Dfirst_xml_filename={first_xml_filename} \
-Drotation_around={rotation_around} \
-- --no-splash {path_bsh}""",
config["common"],
config["define_xml_czi"],
jdir=JOBDIR,
path_bsh=config["common"]["bsh_directory"] + config["define_xml_czi"]["bsh_file"])
cmd_string += " > {log} 2>&1"
shell(cmd_string)
# defining xml for tif dataset
rule define_xml_tif:
input: glob.glob(re.sub("{{.}}","*",config["define_xml_tif"]['image_file_pattern'])) #replaces all occurrences of {{a}} (a can be any character) by * to use the string for globbing
output: config["common"]["first_xml_filename"] + ".xml"
log: "define_xml_tif.log"
run:
cmd_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dtimepoints={timepoints} \
-Dangles={angles} \
-Dchannels={channels} \
-Dillumination={illumination} \
-Dimage_file_pattern={image_file_pattern} \
-Dpixel_distance_x={pixel_distance_x} \
-Dpixel_distance_y={pixel_distance_y} \
-Dpixel_distance_z={pixel_distance_z} \
-Dpixel_unit={pixel_unit} \
-Dxml_filename={first_xml_filename} \
-Dtype_of_dataset={type_of_dataset} \
-Dmultiple_timepoints={multiple_timepoints} \
-Dmultiple_channels={multiple_channels} \
-Dmultiple_illumination_directions={multiple_illumination_directions} \
-Dmultiple_angles={multiple_angles} \
-Dimglib_container={imglib_container} \
-- --no-splash {path_bsh}""",
config["common"],
config["define_xml_tif"],
jdir=JOBDIR,
path_bsh=config["common"]["bsh_directory"] + config["define_xml_tif"]["bsh_file"],
timepoints="0-"+str(int(config["common"]["ntimepoints"])-1)
)
cmd_string +=" > {log} 2>&1"
shell(cmd_string)
ruleorder: define_xml_czi > define_xml_tif
# create mother .xml/.h5
rule hdf5_xml:
input: config["common"]["first_xml_filename"] + ".xml"
output: expand("{dataset}.{suffix}",dataset=[ config["common"]["hdf5_xml_filename"].strip('\"')], suffix=["xml","h5"]),
[ item+"_xml" for item in datasets ]
log: "hdf5_xml.log"
run:
part_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dfirst_xml_filename={first_xml_filename} \
-Dhdf5_xml_filename={hdf5_xml_filename} \
-Dresave_angle={resave_angle} \
-Dresave_channel={resave_channel} \
-Dresave_illumination={resave_illumination} \
-Dresave_timepoint={resave_timepoint} \
-Dsubsampling_factors={subsampling_factors} \
-Dhdf5_chunk_sizes={hdf5_chunk_sizes} \
-Dtimepoints_per_partition={timepoints_per_partition} \
-Dsetups_per_partition={setups_per_partition} \
-Drun_only_job_number=0 \
-- --no-splash {path_bsh}""",
config["common"],
config["define_xml_czi"],
config["resave_hdf5"],
jdir=JOBDIR,
path_bsh=config["common"]["bsh_directory"] + config["resave_hdf5"]["bsh_file"])
part_string += " > {log} 2>&1 && touch {output}"
shell(part_string)
# resave .czi/.tif dataset as hdf5
rule resave_hdf5:
input: rules.hdf5_xml.output # "{xml_base}-{file_id,\d+}-00.h5_xml"
output: "{xml_base}-{file_id,\d+}-00.h5", "{xml_base}-{file_id,\d+}-00.h5_hdf5"
log: "resave_hdf5-{file_id}.log"
run:
part_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dfirst_xml_filename={first_xml_filename} \
-Dhdf5_xml_filename={input_xml_base} \
-Dresave_angle={resave_angle} \
-Dresave_channel={resave_channel} \
-Dresave_illumination={resave_illumination} \
-Dresave_timepoint={resave_timepoint} \
-Dsubsampling_factors={subsampling_factors} \
-Dhdf5_chunk_sizes={hdf5_chunk_sizes} \
-Dtimepoints_per_partition={timepoints_per_partition} \
-Dsetups_per_partition={setups_per_partition} \
-Drun_only_job_number={job_number} \
-- --no-splash {path_bsh}""", # the & submits everyting at once
config["common"],
config["define_xml_czi"],
config["resave_hdf5"],
jdir=JOBDIR,
path_bsh=config["common"]["bsh_directory"] + config["resave_hdf5"]["bsh_file"],
input_xml_base="{wildcards.xml_base}",
job_number=int(wildcards.file_id)+1)
part_string += " > {log} 2>&1 && touch {output}"
shell(part_string)
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"
input: "{xml_base}-{file_id}-00.h5"
output: "{xml_base}.job_{file_id,\d+}.xml"#, "{xml_base}-{file_id,\d+}-00.h5_registered",
log: "{xml_base}-{file_id}-registration.log"
run:
cmd_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dparallel_timepoints={file_id_w} \
-Dimage_file_directory={jdir} \
-Dxml_filename={input_xml} \
-Dprocess_timepoint={timepoint} \
-Dprocess_channel={channel} \
-Dprocess_illumination={illuminations} \
-Dprocess_angle={angle} \
-Dprocessing_channel={proc-ch} \
-Dlabel_interest_points={label_interest_points} \
-Dtype_of_registration={type_of_registration} \
-Dtype_of_detection={type_of_detection} \
-Dsubpixel_localization={subpixel_localization} \
-Dimglib_container={imglib_container} \
-Dradius_1={radius_1} \
-Dradius_2={radius_2} \
-Dthreshold={threshold} \
-Dinitial_sigma={initial_sigma} \
-Dthreshold_gaussian={threshold_gaussian} \
-Dregistration_algorithm={algorithm} \
-Dinterest_points_channel_0={interest_points_channel_0} \
-Dinterest_points_channel_1={interest_points_channel_1} \
-Dfix_tiles={fix_tiles} \
-Dmap_back_tiles={map_back_tiles} \
-Dtransformation_model={transformation_model} \
-Dmodel_to_regularize_with={model_to_regularize_with} \
-Dlambda={lambda} \
-Dallowed_error_for_ransac={allowed_error_for_ransac} \
-Ddetection_min_max={detection_min_max} \
-- --no-splash {bsh_file}""",
-Dparallel_timepoints={file_id_w} \
-Dimage_file_directory={jdir} \
-Dxml_filename={input_xml} \
-Dreg_process_timepoint={reg_process_timepoint} \
-Dreg_process_channel={reg_process_channel} \
-Dreg_process_illumination={reg_process_illumination} \
-Dreg_process_angle={reg_process_angle} \
-Dchannels={channels} \
-Dreg_processing_channel={reg_processing_channel} \
-Dlabel_interest_points={label_interest_points} \
-Dtype_of_registration={type_of_registration} \
-Dtype_of_detection={type_of_detection} \
-Dsubpixel_localization={subpixel_localization} \
-Dimglib_container={imglib_container} \
-Dreg_radius_1={reg_radius_1} \
-Dreg_radius_2={reg_radius_2} \
-Dreg_threshold={reg_threshold} \
-Dinitial_sigma={initial_sigma} \
-Dthreshold_gaussian={threshold_gaussian} \
-Dregistration_algorithm={algorithm} \
-Dreg_interest_points_channel={reg_interest_points_channel} \
-Dfix_tiles={fix_tiles} \
-Dmap_back_tiles={map_back_tiles} \
-Dtransformation_model={transformation_model} \
-Dmodel_to_regularize_with={model_to_regularize_with} \
-Dlambda={lambda} \
-Dallowed_error_for_ransac={allowed_error_for_ransac} \
-Ddetection_min_max={detection_min_max} \
-Dsignificance={significance} \
-- --no-splash {path_bsh}""",
config["common"],
config["registration"],
file_id_w="{wildcards.file_id}",
file_id_w=wildcards.file_id,
path_bsh=config["common"]["bsh_directory"] + config["registration"]["bsh_file"],
jdir=JOBDIR,
input_xml="{wildcards.xml_base}")
cmd_string += "> {log} 2>&1 && touch {output}"
input_xml=wildcards.xml_base)
cmd_string += " > {log} 2>&1 && touch {output}"
shell(cmd_string)
#shell("touch {output}")
rule xml_merge:
input: [ item+"_registered" for item in datasets ] #xml_merge_in
input: [ str(config["common"]["hdf5_xml_filename"].strip('\"')+".job_"+(padding_format.format(item))+".xml") for item in range(int(config["common"]["ntimepoints"])) ] #[ item+"_registered" for item in datasets ]
output: "{xml_base}_merge.xml"
log: "{xml_base}_merge.log"
run:
cmd_string = produce_string("{fiji-prefix} {fiji-app} -Dimage_file_directory={jdir} -Dmerged_xml={output} -- --no-splash {bsh_file} > {log} 2>&1",
cmd_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dmerged_xml={output} \
-- --no-splash {path_bsh}""",
config["common"],
config["xml_merge"],
log="{log}",
path_bsh=config["common"]["bsh_directory"] + config["xml_merge"]["bsh_file"],
jdir=JOBDIR,
output="{output}")
cmd_string += " > {log} 2>&1 && touch {output}"
shell(cmd_string)
rule external_trafo:
rule timelapse:
input: rules.xml_merge.output
output: rules.xml_merge.output[0] + "_external_trafo"
log: "external_trafo.log"
output: rules.xml_merge.output[0] + "_timelapse"
log: "{xml_base}_timelapse.log"
run:
cmd_string = produce_string("""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
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 {bsh_file}""",
-Dtimelapse_process_timepoints={timelapse_process_timepoints} \
-Dreg_process_channel={reg_process_channel} \
-Dreg_process_illumination={reg_process_illumination} \
-Dreg_process_angle={reg_process_angle} \
-Dreference_timepoint={reference_timepoint} \
-Dchannels={channels} \
-Dtype_of_registration_timelapse={type_of_registration_timelapse} \
-Dregistration_algorithm={algorithm} \
-Dreg_interest_points_channel={reg_interest_points_channel} \
-Dtransformation_model={transformation_model} \
-Dmodel_to_regularize_with={model_to_regularize_with} \
-Dlambda={lambda} \
-Dallowed_error_for_ransac={allowed_error_for_ransac} \
-Dsignificance={significance} \
-- --no-splash {path_bsh}""",
config["common"],
config["registration"],
config["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 fusion:
input: rules.timelapse.output, "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml"
output: "{xml_base}-{file_id,\d+}-00.h5_fusion"
log: "{xml_base}-{file_id,\d+}-00-fusion.log"
run:
cmd_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dparallel_timepoints={file_id_w} \
-Dmerged_xml={merged_xml_file} \
-Dprocess_timepoint={process_timepoint} \
-Dprocess_channel={process_channel} \
-Dprocess_illumination={process_illumination} \
-Dprocess_angle={process_angle} \
-Dxml_output={xml_output} \
-Dfused_image={fused_image} \
-Dminimal_x={minimal_x} \
-Dminimal_y={minimal_y} \
-Dminimal_z={minimal_z} \
-Dmaximal_x={maximal_x} \
-Dmaximal_y={maximal_y} \
-Dmaximal_z={maximal_z} \
-Ddownsample={downsample} \
-Dpixel_type={pixel_type} \
-Dimglib2_container_fusion={imglib2_container_fusion} \
-Dprocess_views_in_paralell={process_views_in_paralell} \
-Dinterpolation={interpolation} \
-Dimglib2_data_container={imglib2_data_container} \
-Dsubsampling_factors={subsampling_factors} \
-Dhdf5_chunk_sizes={hdf5_chunk_sizes} \
-Dtimepoints_per_partition={timepoints_per_partition} \
-Dsetups_per_partition={setups_per_partition} \
-- --no-splash {path_bsh}""",
config["common"],
config["fusion"],
config["resave_hdf5"],
path_bsh=config["common"]["bsh_directory"] + config["fusion"]["bsh_file"],
jdir=JOBDIR,
file_id_w="{wildcards.file_id}",
merged_xml_file="{input.merged_xml}"
)
cmd_string += " > {log} 2>&1 && touch {output}"
shell(cmd_string)
rule external_transform:
input: rules.timelapse.output, merged_xml="{xml_base}_merge.xml"
output: rules.timelapse.output[0] + "_external_trafo"
log: "external_transform.log"
run:
cmd_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dmerged_xml={merged_xml_file} \
-Dchannel_setting={channel_setting} \
-Dtransform_angle={transform_angle} \
-Dtransform_channel={transform_channel} \
-Dtransform_illumination={transform_illumination} \
-Dtransform_timepoint={transform_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_transform"]["bsh_file"],
jdir=JOBDIR,
input="{input}")
cmd_string += "> {log} 2>&1 && touch {output}"
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"
output: "{xml_base}-{file_id,\d+}-00.h5_deconvolved"
input: rules.timelapse.output, "{xml_base}-{file_id,\d+}-00.h5", merged_xml="{xml_base}_merge.xml" # 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_deconvolution"
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} \
-- --no-splash {bsh_file}""",
-Dparallel_timepoints={file_id_w} \
-Dprocess_timepoint={process_timepoint} \
-Dprocess_channel={process_channel} \
-Dprocess_illumination={process_illumination} \
-Dprocess_angle={process_angle} \
-Dchannels={channels} \
-Dminimal_x_deco={minimal_x_deco} \
-Dminimal_y_deco={minimal_y_deco} \
-Dminimal_z_deco={minimal_z_deco} \
-Dmaximal_x_deco={maximal_x_deco} \
-Dmaximal_y_deco={maximal_y_deco} \
-Dmaximal_z_deco={maximal_z_deco} \
-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={detections_to_extract_psf_for_channel} \
-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"],
file_id_w="{wildcards.file_id}",
path_bsh=config["common"]["bsh_directory"] + config["deconvolution"]["bsh_file"],
jdir=JOBDIR,
merged_xml_file="{input.merged_xml}"
)
cmd_string += "> {log} 2>&1 && touch {output}"
cmd_string += " > {log} 2>&1 && touch {output}"
shell(cmd_string)
rule define_output:
input: [ item + "_" + config["common"]["fusion_switch"] for item in datasets ], glob.glob('TP*')
output: config["hdf5_output"]["output_xml"].strip('\"') + ".xml"
log: "define_output.log"
run:
cmd_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dtimepoints={output_timepoints} \
-Dchannels={output_channels} \
-Dimage_file_pattern={output_image_file_pattern} \
-Dpixel_distance_x={output_pixel_distance_x} \
-Dpixel_distance_y={output_pixel_distance_y} \
-Dpixel_distance_z={output_pixel_distance_z} \
-Dpixel_unit={output_pixel_unit} \
-Dxml_filename={output_xml} \
-Dtype_of_dataset={output_type_of_dataset} \
-Dmultiple_timepoints={output_multiple_timepoints} \
-Dmultiple_channels={output_multiple_channels} \
-Dmultiple_illumination_directions={output_illumination_directions} \
-Dmultiple_angles={output_multiple_angles} \
-Dimglib_container={output_imglib_container} \
-- --no-splash {path_bsh}""",
config["common"],
config["hdf5_output"],
jdir=JOBDIR,
path_bsh=config["common"]["bsh_directory"] + config["hdf5_output"]["bsh_file_define"])
cmd_string +=" > {log} 2>&1"
shell(cmd_string)
# create mother .xml/.h5
rule hdf5_xml_output:
input: config["hdf5_output"]["output_xml"].strip('\"') + ".xml"
output: expand("{dataset}.{suffix}",dataset=[ config["common"]["hdf5_xml_filename"].strip('\"')], suffix=["xml","h5"]),
[ item+"_output" for item in datasets ]
log: "output_hdf5_xml.log"
run:
part_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dfirst_xml_filename={output_xml} \
-Dhdf5_xml_filename={output_hdf5_xml} \
-Dresave_angle={resave_angle} \
-Dresave_channel={resave_channel} \
-Dresave_illumination={resave_illumination} \
-Dresave_timepoint={resave_timepoint} \
-Dsubsampling_factors={subsampling_output} \
-Dhdf5_chunk_sizes={chunk_sizes_output} \
-Dtimepoints_per_partition={timepoints_per_partition} \
-Dsetups_per_partition={setups_per_partition} \
-Drun_only_job_number=0 \
-Doutput_data_type={output_data_type} \
-Dconvert_32bit={convert_32bit}\
-- --no-splash {path_bsh}""",
config["common"],
config["hdf5_output"],
config["resave_hdf5"],
jdir=JOBDIR,
path_bsh=config["common"]["bsh_directory"] + config["hdf5_output"]["bsh_file_hdf5"])
part_string += " > {log} 2>&1 && touch {output}"
shell(part_string)
rule resave_hdf5_output:
input: rules.hdf5_xml_output.output
output: "{xml_base}-{file_id,\d+}-00.h5_output_hdf5"
log: "resave_output-{file_id}.log"
run:
part_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dfirst_xml_filename={output_xml} \
-Dhdf5_xml_filename={output_hdf5_xml} \
-Dresave_angle={resave_angle} \
-Dresave_channel={resave_channel} \
-Dresave_illumination={resave_illumination} \
-Dresave_timepoint={resave_timepoint} \
-Dsubsampling_factors={subsampling_output} \
-Dhdf5_chunk_sizes={chunk_sizes_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} \
-Dconvert_32bit={convert_32bit}\
-- --no-splash {path_bsh}""",
config["common"],
config["hdf5_output"],
config["resave_hdf5"],
jdir=JOBDIR,
path_bsh=config["common"]["bsh_directory"] + config["hdf5_output"]["bsh_file_hdf5"],
input_xml_base="{wildcards.xml_base}",
job_number=int(wildcards.file_id)+1)
part_string += " > {log} 2>&1 && touch {output}"
shell(part_string)
rule distclean:
shell : "rm -rf *registered *tif *log *_deconvolved *.xml~* interestpoints "+str(" ".join(xml_merge_in))
params : glob.glob(config["common"]["hdf5_xml_filename"].strip('\"')+"*"), glob.glob(config["common"]["first_xml_filename"].strip('\"')+"*"), glob.glob("*registered"), glob.glob("*_fusion"), glob.glob("*_timelapse"), glob.glob("*log"), glob.glob("*_deconvolved"), glob.glob("*.xml~*"),"interestpoints", glob.glob("*empty"), expand("{dataset}.{suffix}",dataset=[ config["common"]["hdf5_xml_filename"].strip('\"')], suffix=["xml","h5"]), glob.glob("*_output_hdf5"), glob.glob("*_output")# xml_merge_in,
message : os.path.abspath(os.path.curdir) + ": rm -rf {params}"
shell : "rm -rf {params}"
......@@ -9,8 +9,13 @@
{
"lsf_extra" : "-R \"span[hosts=1] rusage[mem=100000]\""
},
"timelapse" :
{
"lsf_extra" : "-n 6 -R \"span[hosts=1] rusage[mem=100000]\""
},
"external_trafo" :
"external_transfrom" :
{
"lsf_extra" : "-R \"span[hosts=1] rusage[mem=10000]\""
},
......@@ -19,5 +24,10 @@
{
"lsf_extra" : "-n 7 -R \"span[hosts=1] rusage[mem=50000]\"",
"lsf_q" : "gpu"
},
"resave_hdf5_output" :
{
"lsf_extra" : "-n 7 -R \"span[hosts=1] rusage[mem=50000]\""
}
}
// Load Fiji dependencies
import ij.IJ;
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");
System.out.println( "Start to load Parameters:" );
// Select xml
image_file_directory = System.getProperty( "image_file_directory" );
merged_xml = System.getProperty( "merged_xml" );
if ( ! merged_xml.endsWith(".xml") )
merged_xml = merged.xml + ".xml";
System.out.println( "-------------------------------------------------------" );
System.out.println( "Load xml file: " );
System.out.println( "selected_xml = " + image_file_directory + merged_xml);
// Load general Parameters
parallel_timepoints = Integer.parseInt(System.getProperty( "parallel_timepoints" ));
process_timepoint = System.getProperty( "process_timepoint" );
process_channel = System.getProperty( "process_channel" );
process_illumination = System.getProperty( "process_illumination" );
process_angle = System.getProperty( "process_angle" );
System.out.println( "-------------------------------------------------------" );
System.out.println( "General parameters: " );
System.out.println( "timepoint_processed = " + parallel_timepoints );
System.out.println( "process_timepoints = " + process_timepoint );
System.out.println( "process_channel = " + process_channel );
System.out.println( "process_illumination = " + process_illumination );
System.out.println( "process_angle = " + process_angle );
// Load bounding box
minimal_x_deco = System.getProperty( "minimal_x_deco" );
minimal_y_deco = System.getProperty( "minimal_y_deco" );
minimal_z_deco = System.getProperty( "minimal_z_deco" );
maximal_x_deco = System.getProperty( "maximal_x_deco" );
maximal_y_deco = System.getProperty( "maximal_y_deco" );
maximal_z_deco = System.getProperty( "maximal_z_deco" );
System.out.println( "-------------------------------------------------------" );
System.out.println( "Bounding box: " );
System.out.println( "minimal_x_deco = " + minimal_x_deco );
System.out.println( "minimal_y_deco = " + minimal_y_deco );
System.out.println( "minimal_z_deco = " + minimal_z_deco );
System.out.println( "maximal_x_deco = " + maximal_x_deco );
System.out.println( "maximal_y_deco = " + maximal_y_deco );
System.out.println( "maximal_z_deco = " + maximal_z_deco );
// Load deconvolution Parameters
imglib2_container_deco = System.getProperty( "imglib2_container_deco" );
type_of_iteration = System.getProperty( "type_of_iteration" );
osem_acceleration = System.getProperty( "osem_acceleration" );
Tikhonov_parameter = System.getProperty( "Tikhonov_parameter" );
//float Tikhonov_parameter = Float.parseFloat( System.getProperty( "Tikhonov_parameter" ) );
compute = System.getProperty( "compute" );
psf_estimation = System.getProperty( "psf_estimation" );
iterations = System.getProperty( "iterations" );
deco_output_file_directory = System.getProperty( "deco_output_file_directory" );
detections_to_extract_psf_for_channel_0 = System.getProperty( "detections_to_extract_psf_for_channel_0" );
detections_to_extract_psf_for_channel_1 = System.getProperty( " detections_to_extract_psf_for_channel_1" );
System.out.println( "-------------------------------------------------------" );
System.out.println( "Deconvolution settings: " );
System.out.println( "imglib2_container = " + imglib2_container_deco );
System.out.println( "type_of_iteration = "+ type_of_iteration );
System.out.println( "osem_acceleration = " + osem_acceleration );
System.out.println( "Tikhonov_parameter = " + Tikhonov_parameter );
System.out.println( "compute = " + compute );
System.out.println( "psf_estimation = " + psf_estimation );
System.out.println( "number_of_iterations = " + iterations );
System.out.println( "deco_output_file_directory = " + deco_output_file_directory );
System.out.println( "detections_to_extract_psf_for_channel_0 = " + detections_to_extract_psf_for_channel_0 );
System.out.println( "detections_to_extract_psf_for_channel_1 = " + detections_to_extract_psf_for_channel_1 );
// Search for CUDA
directory_cuda = System.getProperty( "directory_cuda" );
System.out.println( "-------------------------------------------------------" );
System.out.println( "Loading CUDA directory: " );
System.out.println( "directory_cuda = " + directory_cuda );
// PSF Parameters
psf_size_x = System.getProperty( "psf_size_x" );
psf_size_y = System.getProperty( "psf_size_y" );
psf_size_z = System.getProperty( "psf_size_z" );
System.out.println( "-------------------------------------------------------" );
System.out.println( "PSF Parameters: " );
System.out.println( "psf_size_x = " + psf_size_x );
System.out.println( "psf_size_y = " + psf_size_y );
System.out.println( "psf_size_z = " + psf_size_z );
// Execute Fiji Plugin
System.out.println( "=======================================================" );
System.out.println( "Starting Deconvolution" );
try {
IJ.run("Fuse/Deconvolve Dataset",
"select_xml=" + image_file_directory + merged_xml + " " +
"process_angle=[All angles] " +
"process_channel=[All channels] " +
"process_illumination=[All illuminations] " +
"process_timepoint=[" + process_timepoint + "] " +
"processing_timepoint=[Timepoint " + parallel_timepoints + "] " +
"type_of_image_fusion=[Multi-view deconvolution] " +
"bounding_box=[Define manually] " +
"fused_image=[Save as TIFF stack] " +
"minimal_x=" + minimal_x_deco + " " +
"minimal_y=" + minimal_y_deco + " " +
"minimal_z=" + minimal_z_deco + " " +
"maximal_x=" + maximal_x_deco + " " +
"maximal_y=" + maximal_y_deco + " " +
"maximal_z=" + maximal_z_deco + " " +
"imglib2_container=" + imglib2_container_deco + " " +
"type_of_iteration=[" + type_of_iteration + "] " +
"osem_acceleration=[" + osem_acceleration + "] " +
"number_of_iterations=" + iterations + " " +
// "adjust_blending_parameters " +
"use_tikhonov_regularization " +
"tikhonov_parameter=" + Tikhonov_parameter + " " +
"compute=[" + compute + "] " +
"compute_on=[CPU (Java)] " +
"psf_estimation=[" + psf_estimation + "] " +
"psf_display=[Do not show PSFs] " +
"output_file_directory=" + deco_output_file_directory + " " +
"detections_to_extract_psf_for_channel_0=" + detections_to_extract_psf_for_channel_0 + " " +
"detections_to_extract_psf_for_channel_1=" + detections_to_extract_psf_for_channel_1 + " " + // Dual Channel
"psf_size_x=" + psf_size_x + " " +
"psf_size_y=" + psf_size_y + " " +
"psf_size_z=" + psf_size_z + "");
}
catch ( e ) {
print( "[deconvolution-CPU] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
/* shutdown */
runtime.exit(0);
// Load Fiji dependencies
import ij.IJ;
import ij.ImagePlus;
import ij.IJ; // calls imagej
import ij.Prefs; // calls imagej settings
import java.lang.Runtime;
import java.io.File;
import java.io.FilenameFilter;
......@@ -8,25 +8,28 @@ import java.io.FilenameFilter;
runtime = Runtime.getRuntime();
System.out.println(runtime.availableProcessors() + " cores available for multi-threading");
System.out.println( "Start to load Parameters:" );
Prefs.setThreads(7); // defines the number of threads allowed
print("Threads: "+Prefs.getThreads()); // prints thread setting in output
System.out.println( "Start to load Parameters:" );
// Select xml
image_file_directory = System.getProperty( "image_file_directory" );
merged_xml = System.getProperty( "merged_xml" );
if ( ! merged_xml.endsWith(".xml") )
merged_xml = merged.xml + ".xml";
System.out.println( "-------------------------------------------------------" );
System.out.println( "Load xml file: " );
System.out.println( "selected_xml = " + image_file_directory + merged_xml);
System.out.println( "selected_xml = " + image_file_directory + merged_xml + ".xml");
// Load general Parameters
parallel_timepoints = Integer.parseInt(System.getProperty( "parallel_timepoints" ));
int parallel_timepoints = Integer.parseInt(System.getProperty( "parallel_timepoints" ));
process_timepoint = System.getProperty( "process_timepoint" );
process_channel = System.getProperty( "process_channel" );
process_illumination = System.getProperty( "process_illumination" );
process_angle = System.getProperty( "process_angle" );
System.out.println( "-------------------------------------------------------" );
System.out.println( "General parameters: " );
System.out.println( "timepoint_processed = " + parallel_timepoints );
......@@ -62,8 +65,7 @@ compute = System.getProperty( "compute" );
psf_estimation = System.getProperty( "psf_estimation" );
iterations = System.getProperty( "iterations" );
deco_output_file_directory = System.getProperty( "deco_output_file_directory" );
detections_to_extract_psf_for_channel_0 = System.getProperty( "detections_to_extract_psf_for_channel_0" );
detections_to_extract_psf_for_channel_1 = System.getProperty( "detections_to_extract_psf_for_channel_1" );
System.out.println( "-------------------------------------------------------" );
System.out.println( "Deconvolution settings: " );
......@@ -75,14 +77,11 @@ System.out.println( "compute = " + compute );
System.out.println( "psf_estimation = " + psf_estimation );
System.out.println( "number_of_iterations = " + iterations );
System.out.println( "deco_output_file_directory = " + deco_output_file_directory );
System.out.println( "detections_to_extract_psf_for_channel_0 = " + detections_to_extract_psf_for_channel_0 );
System.out.println( "detections_to_extract_psf_for_channel_1 = " + detections_to_extract_psf_for_channel_1 );
// Search for CUDA
directory_cuda = System.getProperty( "directory_cuda" );
System.out.println( "-------------------------------------------------------" );
System.out.println( "Loading CUDA directory: " );
directory_cuda = System.getProperty( "directory_cuda" );
System.out.println( "directory_cuda = " + directory_cuda );
// PSF Parameters
......@@ -96,19 +95,48 @@ System.out.println( "psf_size_x = " + psf_size_x );
System.out.println( "psf_size_y = " + psf_size_y );
System.out.println( "psf_size_z = " + psf_size_z );
// Channel settings
System.out.println( "-------------------------------------------------------" );
System.out.println( "Channel Settings: " );
// Channel setting for Deconvolution
// parses channels and takes from there the number of channels
// parses detections_to_extract_psf_for_channel
channels = System.getProperty( "channels" );
System.out.println( "Channels = " + channels );
detections_to_extract_psf_for_channel = System.getProperty( "detections_to_extract_psf_for_channel" );
System.out.println( "PSF: " + detections_to_extract_psf_for_channel );
// Splits channels and detections_to_extract_psf_for_channel
String delims = "[,]";
String[] channel_token = channels.split(delims);
String[] psf_token = detections_to_extract_psf_for_channel.split(delims);
// Assembles channel_string
StringBuilder channel_string = new StringBuilder();
for (int channel=0; channel < channel_token.length; channel++ )
{
String channel_part = "detections_to_extract_psf_for_channel_" + channel_token[channel] + "=" + psf_token[channel] + " ";
channel_string.append( channel_part );
channel_string.append(" ");
}
System.out.println( channel_string );
// Execute Fiji Plugin
System.out.println( "=======================================================" );
System.out.println( "Starting Deconvolution" );
try {
IJ.run("Fuse/Deconvolve Dataset",
"select_xml=" + image_file_directory + merged_xml + " " +
"select_xml=" + image_file_directory + merged_xml + " " +
"process_angle=[All angles] " +
"process_channel=[All channels] " +
"process_illumination=[All illuminations] " +
"process_timepoint=[" + process_timepoint + "] " +
"processing_timepoint=[Timepoint " + parallel_timepoints + "] " +
// "processing_timepoint=[Timepoint 0] " +
"type_of_image_fusion=[Multi-view deconvolution] " +
"bounding_box=[Define manually] " +
"fused_image=[Save as TIFF stack] " +
......@@ -130,13 +158,10 @@ IJ.run("Fuse/Deconvolve Dataset",
"psf_estimation=[" + psf_estimation + "] " +
"psf_display=[Do not show PSFs] " +
"output_file_directory=" + deco_output_file_directory + " " +
// "directory=[/sw/users/schmied/packages/Fiji.app.cuda_new/lib/] " +
"directory=[" + directory_cuda + "] " +
"cuda_directory=[" + directory_cuda + "] " +
"select_native_library_for_cudafourierconvolution=libFourierConvolutionCUDALib.so " +
"gpu_1 " +
// "gpu_2 " +
"detections_to_extract_psf_for_channel_0=" + detections_to_extract_psf_for_channel_0 + " " +
// "detections_to_extract_psf_for_channel_1=" + detections_to_extract_psf_for_channel_1 + " " + // Dual Channel
channel_string +
"psf_size_x=" + psf_size_x + " " +
"psf_size_y=" + psf_size_y + " " +
"psf_size_z=" + psf_size_z + "");
......
// 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("Angle Settings:");
// Angle settings
// Parses angles and determines the number of angles
// uses tokens of string angles to assemble the string for angle_string
// via StringBuilder
angles = System.getProperty( "angles" );
System.out.println( "Angles = " + angles );
// Parses string angles
String delims = "[,]";
String[] angle_token = angles.split(delims);
// Builds string using the number of tokens and inserts the tokens in the string
StringBuilder angle_string = new StringBuilder();
String angle_part;
for ( int angle = 0; angle < angle_token.length; angle++) {
int num_angles = angle + 1;
angle_part = "angle_" + num_angles + "=" + angle_token[angle];
angle_string.append(angle_part);
angle_string.append(" ");
}
System.out.println( angle_string );
System.out.println("---------------------------------------------------------");
System.out.println("Channel Settings:");
// Channel settings
// This parses channels and determines the number of channels
// then uses the tokens of channels to assemble the necessary string
// for channel_string via StringBuilder
channels = System.getProperty( "channels" );
System.out.println( "Channel Names = " + channels );
// Parses string channel_names
String delims = "[,]";
String[] channel_token = channels.split(delims);
// Builds string using the number of tokens and inserts the tokens in the string
StringBuilder channel_string = new StringBuilder();
String channel_part;
for ( int channel = 0; channel < channel_token.length; channel++) {
int num_channel = channel + 1;
channel_part = "channel_" + num_channel + "=" + channel_token[channel];
channel_string.append(channel_part);
channel_string.append(" ");
}
System.out.println( "Channel String = " + channel_string );
System.out.println("---------------------------------------------------------");
System.out.println("Illumination Settings:");
// Illuminatin settings
// This parses illumination and determines the number of illuminations
// then uses the tokens of illuminations to assemble the string for
// illum_string via StringBuilder
illumination = System.getProperty( "illumination" );
System.out.println( "Illumination = " + illumination );
// Parses string illumination
String delims = "[,]";
String[] illum_token = illumination.split(delims);
// Builds string using the number of tokens and inserts the tokens in the string
StringBuilder illum_string = new StringBuilder();
String illum_part;
for ( int illum= 0; illum< illum_token.length; illum++) {
int num_illum = illum + 1;
illum_part = "_______illumination_" + num_illum + "=" + illum_token[illum];
illum_string.append(illum_part);
illum_string.append(" ");
}
System.out.println( illum_string );
System.out.println("---------------------------------------------------------");
System.out.println("Rotation setting:");
rotation_around = System.getProperty( "rotation_around" );
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:");
System.out.println("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_string +
channel_string +
illum_string +
"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 + "");
try {
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_string +
channel_string +
illum_string +
"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 + "");
}
catch ( e ) {
print( "[define_czi] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
/* shutdown */
runtime.exit(0);
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
System.out.println("=========================================================");
System.out.println("Directory:");
image_file_directory = System.getProperty( "image_file_directory" );
xml_filename = System.getProperty( "xml_filename" );
System.out.println( "image_file_directory = " + image_file_directory );
System.out.println( "xml_filename = " + xml_filename );
// Dataset settings
System.out.println("=========================================================");
System.out.println("Dataset:");
timepoints = System.getProperty( "timepoints" );
image_file_pattern = System.getProperty( "image_file_pattern" );
type_of_dataset = System.getProperty( "type_of_dataset" );
multiple_timepoints = System.getProperty( "multiple_timepoints" );
multiple_illumination_directions = System.getProperty( "multiple_illumination_directions" );
multiple_angles = System.getProperty( "multiple_angles" );
imglib_container = System.getProperty( "imglib_container" );
System.out.println( "timepoints = " + timepoints );
System.out.println( "image_file_pattern = " + image_file_pattern );
System.out.println( "type_of_dataset = " + type_of_dataset );
System.out.println( "multiple_timepoints = " + multiple_timepoints );
System.out.println( "multiple_illumination_directions = " + multiple_illumination_directions );
System.out.println( "multiple_angles = " + multiple_angles );
System.out.println( "imglib_container = " + imglib_container );
// 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 );
// Channel switch
System.out.println("=========================================================");
System.out.println("Channel Switch:");
multiple_channels = System.getProperty( "multiple_channels" );
System.out.println( "multiple_channels = " + multiple_channels );
channels = System.getProperty( "channels" );
if ( multiple_channels.equalsIgnoreCase( "NO (one channel)" ) )
{
channels="";
}
else if ( multiple_channels.equalsIgnoreCase( "YES (one file per channel)" ) )
{
channels = "channels_=" + channels + " ";
}
else {
System.out.println( "Channel switch setting gibberish" );
}
System.out.println( "channels = " + channels );
System.out.println("Define Multi-View Dataset , type_of_dataset=[" + type_of_dataset + "] " +
"xml_filename=[" + xml_filename + ".xml] " +
"multiple_timepoints=[" + multiple_timepoints + "] " +
"multiple_channels=[" + multiple_channels + "] " +
"_____multiple_illumination_directions=[" + multiple_illumination_directions + "] " +
"multiple_angles=[" + multiple_angles + "] " +
"image_file_directory=" + image_file_directory + " " +
"image_file_pattern=" + image_file_pattern + " " +
"timepoints_=" + timepoints + " " +
channels +
"calibration_type=[Same voxel-size for all views] calibration_definition=[User define voxel-size(s)]" + " " +
"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 + "");
// Executes Fiji plugin
System.out.println("=========================================================");
System.out.println("Start plugin:");
try {
IJ.run("Define Multi-View Dataset",
"type_of_dataset=[" + type_of_dataset + "] " +
"xml_filename=[" + xml_filename + ".xml] " +
"multiple_timepoints=[" + multiple_timepoints + "] " +
"multiple_channels=[" + multiple_channels + "] " +
"_____multiple_illumination_directions=[" + multiple_illumination_directions + "] " +
"multiple_angles=[" + multiple_angles + "] " +
"image_file_directory=" + image_file_directory + " " +
"image_file_pattern=" + image_file_pattern + " " +
"timepoints_=" + timepoints + " " +
channels +
"calibration_type=[Same voxel-size for all views] calibration_definition=[User define voxel-size(s)]" + " " +
"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 + "");
}
catch ( e ) {
print( "[define_output] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
/* shutdown */
runtime.exit(0);
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
System.out.println("=========================================================");
System.out.println("Directory:");
image_file_directory = System.getProperty( "image_file_directory" );
xml_filename = System.getProperty( "xml_filename" );
System.out.println( "image_file_directory = " + image_file_directory );
System.out.println( "xml_filename = " + xml_filename );
// Dataset settings
System.out.println("=========================================================");
System.out.println("Dataset:");
image_file_pattern = System.getProperty( "image_file_pattern" );
type_of_dataset = System.getProperty( "type_of_dataset" );
timepoints = System.getProperty( "timepoints" );
angles = System.getProperty( "angles" );
System.out.println( "image_file_pattern = " + image_file_pattern );
System.out.println( "type_of_dataset = " + type_of_dataset );
System.out.println( "timepoints = " + timepoints );
System.out.println( "angles = " + angles );
multiple_timepoints = System.getProperty( "multiple_timepoints" );
multiple_channels = System.getProperty( "multiple_channels" );
multiple_illumination_directions = System.getProperty( "multiple_illumination_directions" );
multiple_angles = System.getProperty( "multiple_angles" );
imglib_container = System.getProperty( "imglib_container" );
System.out.println( "multiple_timepoints = " + multiple_timepoints );
System.out.println( "multiple_channels = " + multiple_channels );
System.out.println( "multiple_illumination_directions = " + multiple_illumination_directions );
System.out.println( "multiple_angles = " + multiple_angles );
System.out.println( "imglib_container = " + imglib_container );
System.out.println("---------------------------------------------------------");
System.out.println("Channel setting:");
// Channel switch: parses channels and determines if Single or Multi Channel
// assembles the appropriate string for the channel setting
channels = System.getProperty( "channels" );
String channel_string = null;
String delims = "[,]";
String[] channel_token = channels.split(delims);
if (channels.equalsIgnoreCase(""))
{
System.out.println("Warning: There are no channels set");
}
else if ( channel_token.length == 1 )
{
channel_string="";
System.out.println("Single Channel");
}
else if ( channel_token.length > 1)
{
channel_string = "channels_=" + channels + " ";
System.out.println("Multi Channel");
}
System.out.println( "Channels = " + channel_string );
System.out.println("---------------------------------------------------------");
System.out.println("Illumination setting:");
// Illuminatin switch: parses illumination and determines if there is a single
// or multiple illumination sides and then assembles the illum_string
illumination = System.getProperty( "illumination" );
String illum_string = null;
String delims = "[,]";
String[] illum_token = illumination.split(delims);
if (illumination.equalsIgnoreCase(""))
{
System.out.println("Warning: There are no illuminations set");
}
else if ( illum_token.length == 1 )
{
illum_string="";
System.out.println("One illumination side or fused illumination");
}
else if ( illum_token.length > 1)
{
illum_string = "illumination_=" + illumination + " ";
System.out.println("Dual Illumination sides");
}
System.out.println( "Illuminations = " + illum_string );
// 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 );
System.out.println("Define Multi-View Dataset , type_of_dataset=[" + type_of_dataset + "] " +
"xml_filename=[" + xml_filename + ".xml] " +
"multiple_timepoints=[" + multiple_timepoints + "] " +
"multiple_channels=[" + multiple_channels + "] " +
"_____multiple_illumination_directions=[" + multiple_illumination_directions + "] " +
"multiple_angles=[" + multiple_angles + "] " +
"image_file_directory=" + image_file_directory + " " +
"image_file_pattern=" + image_file_pattern + " " +
"timepoints_=" + timepoints + " " +
channel_string +
illum_string +
"acquisition_angles_=" + acquisition_angles + " " +
"calibration_type=[Same voxel-size for all views] calibration_definition=[User define voxel-size(s)]" + " " +
"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 + "");
// Executes Fiji plugin
System.out.println("=========================================================");
System.out.println("Start plugin:");
try {
IJ.run("Define Multi-View Dataset",
"type_of_dataset=[" + type_of_dataset + "] " +
"xml_filename=[" + xml_filename + ".xml] " +
"multiple_timepoints=[" + multiple_timepoints + "] " +
"multiple_channels=[" + multiple_channels + "] " +
"_____multiple_illumination_directions=[" + multiple_illumination_directions + "] " +
"multiple_angles=[" + multiple_angles + "] " +
"image_file_directory=" + image_file_directory + " " +
"image_file_pattern=" + image_file_pattern + " " +
"timepoints_=" + timepoints + " " +
channel_string +
illum_string +
"acquisition_angles_=" + angles + " " +
"calibration_type=[Same voxel-size for all views] calibration_definition=[User define voxel-size(s)]" + " " +
"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 + "");
}
catch ( e ) {
print( "[define_tif_zip] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
/* shutdown */
runtime.exit(0);
// 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:");
try {
IJ.run("Toggle Cluster Processing", "display_cluster");
}
catch ( e ) {
print( "[export::cluster setting] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
// Executes Fiji plugin
System.out.println("=========================================================");
System.out.println("Start plugin:");
try {
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 );
}
catch ( e ) {
print( "[export::resaving] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
/* shutdown */
System.exit(0);
// 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 );
// 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 );
convert_32bit = System.getProperty( "convert_32bit" );
if ( output_data_type.equalsIgnoreCase( "32Bit" ) )
{
data_string = "convert_32bit=" + convert_32bit;
}
else if ( output_data_type.equalsIgnoreCase( "16Bit" ) )
{
data_string = "";
}
System.out.println( "Data string = " + data_string );
// Activate cluster processing
System.out.println("=========================================================");
System.out.println("Cluster setting:");
try{
IJ.run("Toggle Cluster Processing", "display_cluster");
}
catch ( e ) {
print( "[export_output::cluster setting] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
// Executes Fiji plugin
System.out.println("=========================================================");
System.out.println("Start plugin:");
try{
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 + " " +
data_string + "");
}
catch ( e ) {
print( "[export_output::resaving] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
/* shutdown */
System.exit(0);
// 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");
System.out.println( "Start to load Parameters:" );
Prefs.setThreads(6); // defines the number of threads allowed
print("Threads: "+Prefs.getThreads()); // prints thread setting in output
System.out.println( "Start to load Parameters:" );
// select xml
System.out.println( "-------------------------------------------------------" );
System.out.println( "Load xml file: " );
image_file_directory = System.getProperty( "image_file_directory" );
merged_xml = System.getProperty( "merged_xml" );
if ( ! merged_xml.endsWith(".xml") )
merged_xml = merged.xml + ".xml";
System.out.println( "xml_path=" + image_file_directory + merged_xml + ".xml" );
// Load general Parameters
System.out.println( "-------------------------------------------------------" );
System.out.println( "General parameters: " );
int parallel_timepoints = Integer.parseInt( System.getProperty( "parallel_timepoints" ) );
process_timepoint = System.getProperty( "process_timepoint" );
process_channel = System.getProperty( "process_channel" );
process_illumination = System.getProperty( "process_illumination" );
process_angle = System.getProperty( "process_angle" );
System.out.println( process_timepoint );
System.out.println( "timepoint = " + parallel_timepoints);
System.out.println( "illuminations = " + process_illumination );
System.out.println( "angles = " + process_angle );
//Load bounding box
System.out.println( "-------------------------------------------------------" );
System.out.println( "Load bounding box: " );
minimal_x = System.getProperty( "minimal_x" );
minimal_y = System.getProperty( "minimal_y" );
minimal_z = System.getProperty( "minimal_z" );
maximal_x = System.getProperty( "maximal_x" );
maximal_y = System.getProperty( "maximal_y" );
maximal_z = System.getProperty( "maximal_z" );
downsample = System.getProperty( "downsample" );
System.out.println( "minimal_x=" + minimal_x );
System.out.println( "minimal_y=" + minimal_y );
System.out.println( "minimal_z=" + minimal_z );
System.out.println( "maximal_x=" + maximal_x );
System.out.println( "maximal_y=" + maximal_y );
System.out.println( "maximal_z=" + maximal_z );
System.out.println( "downsample=" + downsample );
// Load fusion parameters
System.out.println( "-------------------------------------------------------" );
System.out.println( "Fusion parameters: " );
pixel_type = System.getProperty( "pixel_type" );
imglib2_container_fusion = System.getProperty( "imglib2_container_fusion" );
interpolation = System.getProperty( "interpolation" );
imglib2_data_container = System.getProperty( "imglib2_data_container" );
System.out.println( "pixel_type=" + pixel_type );
System.out.println( "imglib2_container_fusion=" + imglib2_container_fusion );
System.out.println( "interpolation=" + interpolation );
System.out.println( "imglib2_data_container=" + imglib2_data_container );
// Execute Fiji Plugin
System.out.println( "=======================================================" );
System.out.println( "Starting Fusion" );
try{
IJ.run("Fuse/Deconvolve Dataset",
"select_xml=" + image_file_directory + merged_xml + " " +
"process_angle=[" + process_angle + "] " +
"process_illumination=[" + process_illumination + "] " +
"process_timepoint=[" + process_timepoint + "] " +
"processing_timepoint=[Timepoint " + parallel_timepoints + "] " +
// "xml_output=[Do not process on cluster] " +
"processing_timepoint=[Timepoint "+ parallel_timepoints +"] " +
"type_of_image_fusion=[Weighted-average fusion] " +
"bounding_box=[Define manually] " +
"fused_image=[Save as TIFF stack] " + // works but does not create xml file
"minimal_x=" + minimal_x + " " +
"minimal_y=" + minimal_y + " " +
"minimal_z=" + minimal_z + " " +
"maximal_x=" + maximal_x + " " +
"maximal_y=" + maximal_y + " " +
"maximal_z=" + maximal_z + " " +
"downsample=" + downsample + " " +
"pixel_type=[" + pixel_type + "] " +
"imglib2_container=" + imglib2_container_fusion + " " +
"process_views_in_paralell=All " +
"interpolation=[" + interpolation + "] " +
//"blend " +
//"content-based " +
"output_file_directory=" + image_file_directory + " " +
"lossless " +
"imglib2_data_container=[" + imglib2_data_container + "]");
}
catch ( e ) {
print( "[Contentbased multiview fusion] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
/* shutdown */
runtime.exit(0);
This diff is collapsed.
import re
import os
import math
def produce_xml_merge_job_files(_datasets):
fre = re.compile(r'(?P<xml_base>\w+)-(?P<file_id>\d+)-00.h5')
value = []
for ds in _datasets:
bn = os.path.basename(ds)
bn_res = fre.search(bn)
if bn_res:
xml_base,file_id = bn_res.group('xml_base'),bn_res.group('file_id')
value.append("{xbase}.job_{fid}.xml".format(xbase=xml_base, fid=int(file_id)))
return value
def produce_string(_fstring, *args, **kwargs):
contents = dict()
for item in args:
if type(item) == type(kwargs):
contents.update(item)
contents.update(kwargs)
return _fstring.format(**contents)
def padding_of_file_id(_n_timepoints):
value = math.ceil(math.log10(_n_timepoints))
if value < 2:
return 2
else:
return value
// 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
// Load xml file
System.out.println("---------------------------------------------------------");
System.out.println("Xml file:");
xml_path = System.getProperty( "image_file_directory" );
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 );
// General Registration Parameters and Channel Settings
System.out.println("---------------------------------------------------------");
System.out.println( "General parameters: " );
timelapse_process_timepoints = System.getProperty( "timelapse_process_timepoints" );
reg_process_illumination = System.getProperty( "reg_process_illumination" );
reg_process_angle = System.getProperty( "reg_process_angle" );
System.out.println( "process_timepoints = " + timelapse_process_timepoints );
System.out.println( "process_illumination = " + reg_process_illumination );
System.out.println( "process_angle = " + reg_process_angle );
// Timelapse registration Parameter
System.out.println("---------------------------------------------------------");
System.out.println( "Timelapse Registration: " );
reference_timepoint = System.getProperty( "reference_timepoint" );
System.out.println( "reference_timepoint=" + reference_timepoint );
type_of_registration_timelapse = System.getProperty( "type_of_registration_timelapse" );
registration_algorithm = System.getProperty( "registration_algorithm" );
System.out.println( "type_of_registration = " + type_of_registration_timelapse );
System.out.println( "registration_algorithm = " + registration_algorithm );
transformation_model = System.getProperty( "transformation_model" );
model_to_regularize_with = System.getProperty( "model_to_regularize_with" );
float lambda = Float.parseFloat( System.getProperty( "lambda" ) );
int allowed_error_for_ransac = Integer.parseInt( System.getProperty( "allowed_error_for_ransac" ) );
significance = System.getProperty( "significance" );
System.out.println( "transformation = " + transformation_model );
System.out.println( "model_to_regularize_with = " + model_to_regularize_with );
System.out.println( "lambda = " + lambda );
System.out.println( "allowed_error_for_ransac = " + allowed_error_for_ransac );
System.out.println( "significance = " + significance );
// Timelapse registration Parameter
System.out.println("---------------------------------------------------------");
System.out.println( "Channel Settings: " );
// Channel Setting Registration
// parses channels and takes from there the number of channels
// takes from reg_process_channel if it is Single Channel, Dual Channel or Dual Channel
// were one Channel contains the beads
// from this it decides which string to assemble
reg_process_channel = System.getProperty( "reg_process_channel" );
System.out.println( "process_channel = " + reg_process_channel );
channels = System.getProperty( "channels" );
System.out.println( "Channels = " + channels );
reg_interest_points_channel = System.getProperty( "reg_interest_points_channel" );
System.out.println( "reg_interest_points_channel = " + reg_interest_points_channel );
// Splits up channels, reg_interest_points_channel
String delims = "[,]";
String[] channel_token = channels.split(delims);
String[] interest_token = reg_interest_points_channel.split(delims);
String reg_single_channel_string = "";
StringBuilder reg_multi_channel_string = new StringBuilder();
if (channels.equalsIgnoreCase(""))
{
System.out.println("Warning: There are no channels set");
}
// Assembles string for Single Channel registration
else if (reg_process_channel.equalsIgnoreCase( "All channels" ) && channel_token.length == 1 )
{
reg_multi_channel_string.append( "" );
reg_single_channel_string = "interest_points_channel_" + channels + "=" + reg_interest_points_channel + " ";
}
// Assembles string for Multi Channel registration
else if (reg_process_channel.equalsIgnoreCase( "All channels" ) && channel_token.length > 1 )
{
for (int channel=0; channel < channel_token.length; channel++ )
{
String channel_part = "interest_points_channel_" + channel_token[channel] + "=" + interest_token[channel] + " ";
reg_multi_channel_string.append( channel_part );
reg_multi_channel_string.append(" ");
}
}
// Returns error of Multi Channels one Channel contains the beads is selected but not enough settings in channels or reg_interest_points_channel
else if (reg_process_channel.equalsIgnoreCase( "Single channel (Select from List)" ) && ( channel_token.length < 1 || interest_token.length < 1 ))
{
System.out.println( "Error: Multi Channel one Channel contains beads selected but only one setting in channls or reg_interest_points_channel" );
}
// Assembles string for Multi Channel Processing one Channel Contains the beads
else if (reg_process_channel.equalsIgnoreCase( "Single channel (Select from List)" ) && channel_token.length > 1 && interest_token.length > 1 )
{
for (int channel=0; channel < channel_token.length; channel++ )
{
String channel_part = "interest_points_channel_" + channel_token[channel] + "=" + interest_token[channel] + " ";
reg_multi_channel_string.append( channel_part );
reg_multi_channel_string.append(" ");
}
}
System.out.println( "reg_single_channel_string = " + reg_single_channel_string );
System.out.println( "reg_multi_channel_string = " + reg_multi_channel_string );
System.out.println( "=======================================================" );
System.out.println( "Starting Timelapse Registration" );
System.out.println( "Register Dataset based on Interest Points , select_xml=" + xml_path + merged_xml + " " +
"process_angle=[" + reg_process_angle + "] " +
"process_channel=[" + reg_process_channel + "] " +
"process_illumination=[" + reg_process_illumination + "] " +
"process_timepoint=[" + timelapse_process_timepoints + "] " +
"registration_algorithm=[" + registration_algorithm + "] " +
"type_of_registration=[" + type_of_registration_timelapse + "] " +
reg_multi_channel_string +
reg_single_channel_string +
// "interest_points_channel_" + channel_1 + "=" + reg_1_interest_points_channel + " " +
// "interest_points_channel_" + channel_2 + "=" + reg_2_interest_points_channel + " " + // Dual Channel
"reference=" + reference_timepoint + " " +
"consider_each_timepoint_as_rigid_unit " +
"transformation=" + transformation_model + " " +
"regularize_model " +
"model_to_regularize_with=" + model_to_regularize_with + " " +
"lamba=" + lambda + " " +
"allowed_error_for_ransac=" + allowed_error_for_ransac + " " +
"significance=" + significance + "");
try {
IJ.run("Register Dataset based on Interest Points",
"select_xml=" + xml_path + merged_xml + " " +
"process_angle=[" + reg_process_angle + "] " +
"process_channel=[" + reg_process_channel + "] " +
"process_illumination=[" + reg_process_illumination + "] " +
"process_timepoint=[" + timelapse_process_timepoints + "] " +
"registration_algorithm=[" + registration_algorithm + "] " +
"type_of_registration=[" + type_of_registration_timelapse + "] " +
reg_multi_channel_string +
reg_single_channel_string +
// "interest_points_channel_" + channel_1 + "=" + reg_1_interest_points_channel + " " +
// "interest_points_channel_" + channel_2 + "=" + reg_2_interest_points_channel + " " + // Dual Channel
"reference=" + reference_timepoint + " " +
"consider_each_timepoint_as_rigid_unit " +
"transformation=" + transformation_model + " " +
"regularize_model " +
"model_to_regularize_with=" + model_to_regularize_with + " " +
"lamba=" + lambda + " " +
"allowed_error_for_ransac=" + allowed_error_for_ransac + " " +
"significance=" + significance + "");
}
catch ( e ) {
print( "[registration::timelapse] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
/* shutdown */
runtime.exit(0);
{
"common" :
{
"fiji-app" : "/projects/hpcsupport/steinbac/unicore/christopher-sandbox/unicore_jobs/Fiji.app.cuda_new/ImageJ-linux64",
"fiji-app" : "/projects/hpcsupport/steinbac/unicore/christopher/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"
......
{
"common" :
{
"fiji-app" : "/projects/hpcsupport/steinbac/unicore/christopher/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",
"bsh_directory" : "/home/steinbac/development/cschmied-snakemake-workflows/spim_registration/timelapse/",
"first_xml_filename" : "test_unicore",
"hdf5_xml_filename" : "\"hdf5_test_unicore\"",
"fusion_switch" : "deconvolution",
"ntimepoints" : 3
},
"define_xml_czi" :
{
"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"
},
"define_xml_tif" :
{
"timepoints" : "0-1",
"acquisition_angles" : "0,72,144,216,288",
"channels" : "0",
"image_file_pattern" : "img_TL{{t}}_Angle{{a}}.tif",
"pixel_distance_x" : "0.2875535786151886",
"pixel_distance_y" : "0.2875535786151886",
"pixel_distance_z" : "1.50000",
"pixel_unit" : "um",
"multiple_timepoints" : "\"YES (one file per time-point)\"",
"multiple_channels" : "\"NO (one channel)\"",
"multiple_illumination_directions" : "\"NO (one illumination direction)\"",
"multiple_angles" : "\"YES (one file per angle)\"",
"type_of_dataset" : "\"Image Stacks (ImageJ Opener)\"",
"imglib_container" : "\"ArrayImg (faster)\"",
"bsh_file" : "define_tif_zip.bsh"
},
"resave_hdf5" :
{
"parallel_timepoints" : "3",
"resave_angle" : "\"All angles\"",
"resave_channel" : "\"All channels\"",
"resave_illumination" : "\"All illuminations\"",
"resave_timepoint" : "\"All Timepoints\"",
"subsampling_factors" : "\"{{ {{1,1,1}}, {{2,2,1}}, {{4,4,1}}, {{8,8,1}} }}\"",
"hdf5_chunk_sizes" : "\"{{ {{32,32,4}}, {{32,32,4}}, {{16,16,16}}, {{16,16,16}} }}\"",
"timepoints_per_partition" : "1",
"setups_per_partition" : "0",
"bsh_file" : "export.bsh"
},
"registration" :
{
"timepoint" : "\"Single Timepoint (Select from List)\"",
"illuminations" : "\"All illuminations\"",
"angle" : "\"All angles\"",
"channel" : "\"All channels\"",
"proc-ch" : "\"channel 0\"",
"algorithm" : "\"Fast 3d geometric hashing (rotation invariant)\"",
"label_interest_points" : "\"beads\"",
"type_of_registration" : "\"Register timepoints individually\"",
"type_of_detection" : "\"Difference-of-Mean (Integral image based)\"" ,
"subpixel_localization" : "\"3-dimensional quadratic fit\"",
"imglib_container" : "\"ArrayImg (faster)\"",
"radius_1" : "2",
"radius_2" : "3",
"threshold" : "0.005",
"interest_points_channel_0" : "\"beads\"",
"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",
"bsh_file" : "registration.bsh"
},
"xml_merge" :
{
"bsh_file" : "xml_merge.bsh"
},
"timelapse" :
{
"reference_timepoint" : "0",
"timelapse_process_timepoints" : "\"All Timepoints\"",
"type_of_registration_timelapse" : "\"Match against one reference timepoint (no global optimization)\"",
"bsh_file" : "timelapse_registration.bsh"
},
"external_transform" :
{
"bsh_file" : "transform.bsh",
"angle" : "\"All angles\"",
"channel" : "\"All channels\"",
"illumination" : "\"All illuminations\"",
"timepoint" : "\"All Timepoints\"",
"transformation" : "\"Rigid\"",
"apply_transformation" : "\"Current view transformations (appends to current transforms)\"",
"define_mode_transform" : "\"Matrix\"",
"matrix_transform" : "\"0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0\""
},
"fusion" :
{
"minimal_x" : "128",
"minimal_y" : "-13",
"minimal_z" : "-407",
"maximal_x" : "986",
"maximal_y" : "1927",
"maximal_z" : "498",
"downsample" : "1",
"process_timepoint" : "\"Single Timepoint (Select from List)\"",
"process_channel" : "\"All channels\"",
"process_illumination" : "\"All illuminations\"",
"process_angle" : "\"All angles\"",
"xml_output" : "\"Save every XML with user-provided unique id\"",
"fused_image" : "\"Append to current XML Project\"",
"pixel_type" : "\"16-bit unsigned integer\"",
"imglib2_container_fusion" : "\"ArrayImg\"",
"process_views_in_paralell" : "\"All\"",
"interpolation" : "\"Linear Interpolation\"",
"imglib2_data_container" : "\"ArrayImg (faster)\"",
"bsh_file" : "fusion.bsh"
},
"deconvolution" :
{
"bsh_file" : "deconvolution_GPU.bsh",
"process_timepoint" : "\"Single Timepoint (Select from List)\"",
"process_channel" : "\"All channels\"",
"process_illumination" : "\"All illuminations\"",
"process_angle" : "\"All angles\"",
"minimal_x" : "76",
"minimal_y" : "4",
"minimal_z" : "-192",
"maximal_x" : "488",
"maximal_y" : "956",
"maximal_z" : "214",
"imglib2_container" : "\"ArrayImg \"",
"type_of_iteration" : "\"Efficient Bayesian - Optimization I (fast, precise)\"",
"osem_acceleration" : "\"1 (balanced)\"",
"Tikhonov_parameter" : "0.0006",
"compute" : "\"in 512x512x512 blocks\"",
"compute_on" : "\"GPU (Nvidia CUDA via JNA)\"",
"psf_estimation" : "\"Extract from beads\"",
"iterations" : "5",
"detections_to_extract_psf_for_channel_0" : "\"beads\"",
"detections_to_extract_psf_for_channel_1" : "\"beads\"",
"psf_size_x" : "19",
"psf_size_y" : "19",
"psf_size_z" : "25"
},
"hdf5_output" :
{
"output_image_file_pattern" : "TP{{t}}_Ch{{c}}_Ill0_Ang0,72,144,216,288.tif",
"output_data_type" : "32Bit",
"output_xml" : "\"fused_Dual_Channel\"",
"output_hdf5_xml" : "\"hdf5_fused_Stock68\"",
"output_multiple_channels" : "\"NO (one channel)\"",
"output_timepoints" : "0-1",
"output_channels" : "green",
"output_pixel_distance_x" : "0.5718",
"output_pixel_distance_y" : "0.5718",
"output_pixel_distance_z" : "0.5718",
"output_pixel_unit" : "um",
"output_multiple_timepoints" : "\"YES (one file per time-point)\"",
"output_illumination_directions" : "\"NO (one illumination direction)\"",
"output_multiple_angles" : "\"NO (one angle)\"",
"output_type_of_dataset" : "\"Image Stacks (ImageJ Opener)\"",
"output_imglib_container" : "\"ArrayImg (faster)\"",
"bsh_file_define" : "/define_output.bsh",
"bsh_file_hdf5" : "/export_output.bsh",
"convert_32bit" : "\"[Use min/max of first image (might saturate intenities over time)]\""
}
}
{
"common" :
{
"fiji-app" : "/projects/hpcsupport/steinbac/unicore/christopher/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",
"bsh_directory" : "/home/steinbac/development/schmied-snakemake-workflows/spim_registration/timelapse/",
"first_xml_filename" : "test_unicore",
"hdf5_xml_filename" : "\"hdf5_test_unicore\"",
"fusion_switch" : "deconvolution",
"ntimepoints" : 5
},
"define_xml_czi" :
{
"pixel_distance_x" : "0.28590106964",
"pixel_distance_y" : "0.28590106964",
"pixel_distance_z" : "1.50000",
"pixel_unit" : "um",
"first_czi" : "2015-04-11_LZ2_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"
},
"define_xml_tif" :
{
"acquisition_angles" : "0,72,144,216,288",
"channels" : "0",
"image_file_pattern" : "img_TL{{t}}_Angle{{a}}.tif",
"pixel_distance_x" : "0.28590106964",
"pixel_distance_y" : "0.28590106964",
"pixel_distance_z" : "1.50000",
"pixel_unit" : "um",
"multiple_timepoints" : "\"YES (one file per time-point)\"",
"multiple_channels" : "\"NO (one channel)\"",
"multiple_illumination_directions" : "\"NO (one illumination direction)\"",
"multiple_angles" : "\"YES (one file per angle)\"",
"type_of_dataset" : "\"Image Stacks (ImageJ Opener)\"",
"imglib_container" : "\"ArrayImg (faster)\"",
"bsh_file" : "define_tif_zip.bsh"
},
"resave_hdf5" :
{
"resave_angle" : "\"All angles\"",
"resave_channel" : "\"All channels\"",
"resave_illumination" : "\"All illuminations\"",
"resave_timepoint" : "\"All Timepoints\"",
"subsampling_factors" : "\"{{ {{1,1,1}}, {{2,2,1}}, {{4,4,1}}, {{8,8,1}} }}\"",
"hdf5_chunk_sizes" : "\"{{ {{32,32,4}}, {{32,32,4}}, {{16,16,16}}, {{16,16,16}} }}\"",
"timepoints_per_partition" : "1",
"setups_per_partition" : "0",
"bsh_file" : "export.bsh"
},
"registration" :
{
"timepoint" : "\"Single Timepoint (Select from List)\"",
"illuminations" : "\"All illuminations\"",
"angle" : "\"All angles\"",
"channel" : "\"All channels\"",
"proc-ch" : "\"channel 0\"",
"algorithm" : "\"Fast 3d geometric hashing (rotation invariant)\"",
"label_interest_points" : "\"beads\"",
"type_of_registration" : "\"Register timepoints individually\"",
"type_of_detection" : "\"Difference-of-Mean (Integral image based)\"" ,
"subpixel_localization" : "\"3-dimensional quadratic fit\"",
"imglib_container" : "\"ArrayImg (faster)\"",
"radius_1" : "2",
"radius_2" : "3",
"threshold" : "0.005",
"interest_points_channel_0" : "\"beads\"",
"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",
"bsh_file" : "registration.bsh"
},
"xml_merge" :
{
"bsh_file" : "xml_merge.bsh"
},
"timelapse" :
{
"reference_timepoint" : "0",
"timelapse_process_timepoints" : "\"All Timepoints\"",
"type_of_registration_timelapse" : "\"Match against one reference timepoint (no global optimization)\"",
"bsh_file" : "timelapse_registration.bsh"
},
"external_transform" :
{
"bsh_file" : "transform.bsh",
"angle" : "\"All angles\"",
"channel" : "\"All channels\"",
"illumination" : "\"All illuminations\"",
"timepoint" : "\"All Timepoints\"",
"transformation" : "\"Rigid\"",
"apply_transformation" : "\"Current view transformations (appends to current transforms)\"",
"define_mode_transform" : "\"Matrix\"",
"matrix_transform" : "\"0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0\""
},
"fusion" :
{
"minimal_x" : "190",
"minimal_y" : "-16",
"minimal_z" : "-348",
"maximal_x" : "1019",
"maximal_y" : "1941",
"maximal_z" : "486",
"downsample" : "1",
"process_timepoint" : "\"Single Timepoint (Select from List)\"",
"process_channel" : "\"All channels\"",
"process_illumination" : "\"All illuminations\"",
"process_angle" : "\"All angles\"",
"xml_output" : "\"Save every XML with user-provided unique id\"",
"fused_image" : "\"Append to current XML Project\"",
"pixel_type" : "\"16-bit unsigned integer\"",
"imglib2_container_fusion" : "\"ArrayImg\"",
"process_views_in_paralell" : "\"All\"",
"interpolation" : "\"Linear Interpolation\"",
"imglib2_data_container" : "\"ArrayImg (faster)\"",
"bsh_file" : "fusion.bsh"
},
"deconvolution" :
{
"bsh_file" : "deconvolution_GPU.bsh",
"process_timepoint" : "\"Single Timepoint (Select from List)\"",
"process_channel" : "\"All channels\"",
"process_illumination" : "\"All illuminations\"",
"process_angle" : "\"All angles\"",
"minimal_x" : "95",
"minimal_y" : "-8",
"minimal_z" : "-174",
"maximal_x" : "509",
"maximal_y" : "970",
"maximal_z" : "243",
"imglib2_container" : "\"ArrayImg \"",
"type_of_iteration" : "\"Efficient Bayesian - Optimization I (fast, precise)\"",
"osem_acceleration" : "\"1 (balanced)\"",
"Tikhonov_parameter" : "0.0006",
"compute" : "\"in 512x512x512 blocks\"",
"compute_on" : "\"GPU (Nvidia CUDA via JNA)\"",
"psf_estimation" : "\"Extract from beads\"",
"iterations" : "5",
"detections_to_extract_psf_for_channel_0" : "\"beads\"",
"detections_to_extract_psf_for_channel_1" : "\"beads\"",
"psf_size_x" : "19",
"psf_size_y" : "19",
"psf_size_z" : "25"
},
"hdf5_output" :
{
"output_image_file_pattern" : "TP{{t}}_Ch{{c}}_Ill0_Ang0,72,144,216,288.tif",
"output_data_type" : "32Bit",
"output_xml" : "\"fused_Dual_Channel\"",
"output_hdf5_xml" : "\"hdf5_fused_Stock68\"",
"output_multiple_channels" : "\"NO (one channel)\"",
"output_timepoints" : "0-4",
"output_channels" : "green",
"output_pixel_distance_x" : "0.5718",
"output_pixel_distance_y" : "0.5718",
"output_pixel_distance_z" : "0.5718",
"output_pixel_unit" : "um",
"output_multiple_timepoints" : "\"YES (one file per time-point)\"",
"output_illumination_directions" : "\"NO (one illumination direction)\"",
"output_multiple_angles" : "\"NO (one angle)\"",
"output_type_of_dataset" : "\"Image Stacks (ImageJ Opener)\"",
"output_imglib_container" : "\"ArrayImg (faster)\"",
"bsh_file_define" : "/define_output.bsh",
"bsh_file_hdf5" : "/export_output.bsh",
"convert_32bit" : "\"[Use min/max of first image (might saturate intenities over time)]\""
}
}
common: {
# directory that contains the bean shell scripts
bsh_directory: "/projects/pilot_spim/Christopher/snakemake-workflows/spim_registration/timelapse/",
directory_cuda: "/sw/users/schmied/packages/2015-06-08_Fiji.app.cuda/lib/",
fiji-app: "/sw/users/schmied/packages/2015-06-08_Fiji.app.cuda/ImageJ-linux64",
fiji-prefix: "/sw/bin/xvfb-run -a",
first_xml_filename: "test_unicore",
hdf5_xml_filename: '"hdf5_test_unicore"',
merged_xml: "hdf5_test_unicore_merge",
ntimepoints: 5,
angles: "0,72,144,216,288",
channels: "green",
illumination: "0",
pixel_distance_x: '0.28590106964',
pixel_distance_y: '0.28590106964',
pixel_distance_z: '1.50000',
pixel_unit: "um",
fusion_switch: "deconvolution"
# fusion_switch: "fusion"
}
define_xml_czi: {
first_czi: "2015-04-11_LZ2_Stock68_3.czi",
rotation_around: "X-Axis",
bsh_file: "define_czi.bsh"
}
define_xml_tif: {
image_file_pattern: 'img_TL{{t}}_Angle{{a}}.tif',
imglib_container: '"ArrayImg (faster)"',
multiple_angles: '"YES (one file per angle)"',
multiple_channels: '"NO (one channel)"',
multiple_illumination_directions: '"NO (one illumination direction)"',
multiple_timepoints: '"YES (one file per time-point)"',
type_of_dataset: '"Image Stacks (ImageJ Opener)"',
bsh_file: "define_tif_zip.bsh"
}
resave_hdf5: {
hdf5_chunk_sizes: '"{{ {{32,32,4}}, {{32,32,4}}, {{16,16,16}}, {{16,16,16}} }}"',
resave_angle: '"All angles"',
resave_channel: '"All channels"',
resave_illumination: '"All illuminations"',
resave_timepoint: '"All Timepoints"',
setups_per_partition: '0',
subsampling_factors: '"{{ {{1,1,1}}, {{2,2,1}}, {{4,4,1}}, {{8,8,1}} }}"',
timepoints_per_partition: '1',
bsh_file: "export.bsh"
}
registration: {
# "Single Channel" is not a valid choice for "Process_channel"
reg_process_channel: '"All channels"',
reg_processing_channel: '"green"',
reg_interest_points_channel: '"beads"',
reg_radius_1: '2',
reg_radius_2: '3',
reg_threshold: '0.005',
initial_sigma: '1.8',
threshold_gaussian: '0.0080',
type_of_detection: '"Difference-of-Mean (Integral image based)"',
label_interest_points: '"beads"',
reg_process_timepoint: '"Single Timepoint (Select from List)"',
reg_process_angle: '"All angles"',
reg_process_illumination: '"All illuminations"',
subpixel_localization: '"3-dimensional quadratic fit"',
detection_min_max: "find_maxima",
type_of_registration: '"Register timepoints individually"',
algorithm: '"Fast 3d geometric hashing (rotation invariant)"',
transformation_model: "Affine",
allowed_error_for_ransac: '5',
significance: '10',
fix_tiles: '"Fix first tile"',
map_back_tiles: '"Map back to first tile using rigid model"',
model_to_regularize_with: "Rigid",
lambda: '0.10',
imglib_container: '"ArrayImg (faster)"',
bsh_file: "registration.bsh"
}
xml_merge: {
bsh_file: "xml_merge.bsh"
}
timelapse: {
reference_timepoint: '0',
type_of_registration_timelapse: '"Match against one reference timepoint (no global optimization)"',
timelapse_process_timepoints: '"All Timepoints"',
bsh_file: "timelapse_registration.bsh"
}
Dublicate_transformations: {
source_dublication: "red",
target_dublication: "green",
bsh_file: "dublicate_channel.bsh"
}
fusion: {
bsh_file: "fusion.bsh",
downsample: '4',
fused_image: '"Append to current XML Project"',
imglib2_container_fusion: '"ArrayImg"',
imglib2_data_container: '"ArrayImg (faster)"',
interpolation: '"Linear Interpolation"',
minimal_x: '190',
minimal_y: '-16',
minimal_z: '-348',
maximal_x: '1019',
maximal_y: '1941',
maximal_z: '486',
pixel_type: '"16-bit unsigned integer"',
process_angle: '"All angles"',
process_channel: '"All channels"',
process_illumination: '"All illuminations"',
process_timepoint: '"Single Timepoint (Select from List)"',
process_views_in_paralell: '"All"',
xml_output: '"Save every XML with user-provided unique id"'
}
external_transform: {
# channel setting: '"all_channels"'
channel_setting: '"green"',
transform_timepoint: '"All Timepoints"',
transform_angle: '"All angles"',
transform_channel: '"All channels"',
# illumination setting only one illumination side
transform_illumination: '"All illuminations"',
apply_transformation: '"Current view transformations (appends to current transforms)"',
define_mode_transform: '"Matrix"',
matrix_transform: '"0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0"',
transformation: '"Rigid"',
bsh_file: "transform.bsh"
}
deconvolution: {
iterations: '1',
minimal_x_deco: '190',
minimal_y_deco: '-16',
minimal_z_deco: '-348',
maximal_x_deco: '1019',
maximal_y_deco: '1941',
maximal_z_deco: '486',
detections_to_extract_psf_for_channel: '"beads"',
process_timepoint: '"Single Timepoint (Select from List)"',
process_angle: '"All angles"',
process_channel: '"All channels"',
process_illumination: '"All illuminations"',
Tikhonov_parameter: '0.0006',
compute: '"in 512x512x512 blocks"',
compute_on: '"GPU (Nvidia CUDA via JNA)"',
imglib2_container: '"ArrayImg"',
osem_acceleration: '"1 (balanced)"',
psf_estimation: '"Extract from beads"',
psf_size_x: '19',
psf_size_y: '19',
psf_size_z: '25',
type_of_iteration: '"Efficient Bayesian - Optimization I (fast, precise)"',
bsh_file: "deconvolution_GPU.bsh"
}
hdf5_output: {
output_image_file_pattern: 'TP{{t}}_Chgreen_Ill0_Ang0,72,144,216,288.tif',
output_xml: '"fused_Single_Channel"',
output_hdf5_xml: '"hdf5_fused_Single_Channel"',
output_multiple_channels: '"NO (one channel)"',
output_timepoints: '0-4',
output_pixel_distance_x: 0.5718,
output_pixel_distance_y: 0.5718,
output_pixel_distance_z: 0.5718,
output_pixel_unit: 'um',
output_channels: "green",
output_data_type: "32Bit",
convert_32bit: '"[Use min/max of first image (might saturate intenities over time)]"',
output_type_of_dataset: '"Image Stacks (ImageJ Opener)"',
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)"',
subsampling_output: '"{{ {{1,1,1}}, {{2,2,2}}, {{4,4,4}}, {{8,8,8}} }}"',
chunk_sizes_output: '"{{ {{16,16,16}}, {{16,16,16}}, {{16,16,16}}, {{16,16,16}} }}"',
# subsampling_output: '"{{ {{1,1,1}}, {{2,2,2}} }}"',
# chunk_sizes_output: '"{{ {{16,16,16}}, {{16,16,16}} }}"',
bsh_file_define: "define_output.bsh",
bsh_file_hdf5: "export_output.bsh"
}
// is problematic needs to be adjusted for
// multi channel and multi illumination datasets
import ij.IJ;
import ij.ImagePlus;
import java.lang.Runtime;
......@@ -11,13 +13,11 @@ System.out.println(runtime.availableProcessors() + " cores available for multi-t
// Load Parameters form job file
image_file_directory = System.getProperty( "image_file_directory" );
merged_xml = System.getProperty( "merged_xml" );
if ( ! merged_xml.endsWith(".xml") )
merged_xml = merged.xml + ".xml";
transform_angle = System.getProperty( "transform_angle" );
transform_channel = System.getProperty( "transform_channel" );
transform_illumination = System.getProperty( "transform_illumination" );
transform_timepoint = System.getProperty( "transform_timepoint" );
channel_setting = System.getProperty( "channel_setting" );
transformation = System.getProperty( "transformation" );
apply_transformation = System.getProperty( "apply_transformation" );
define_mode_transform = System.getProperty( "define_mode_transform" );
......@@ -26,15 +26,16 @@ matrix_transform = System.getProperty( "matrix_transform" );
// Print Parameters into output file
System.out.println( "browse = " + image_file_directory );
System.out.println( "select_xml = " + image_file_directory + merged_xml );
System.out.println( "select_xml = " + image_file_directory + merged_xml );
System.out.println( "apply_to_angle = " + transform_angle );
System.out.println( "apply_to_channel = " + transform_channel );
System.out.println( "apply_to_illumination = " + transform_illumination );
System.out.println( "apply_to_timepoint = " + transform_timepoint );
System.out.println( "Channel_setting = " + channel_setting );
System.out.println( "transformation = " + transformation );
System.out.println( "apply = " + apply_transformation );
System.out.println( "define = " + define_mode_transform );
System.out.println( "all_timepoints_channel_0_illumination_0_all_angles = " + matrix_transform );
System.out.println( "all_timepoints_channel_" + channel_setting + "_illumination_0_all_angles = " + matrix_transform );
// Execute Fiji Plugin
try {
......@@ -50,12 +51,11 @@ IJ.run("Apply Transformations",
"define=" + define_mode_transform + " " +
"same_transformation_for_all_timepoints " +
"same_transformation_for_all_angles " +
// "all_timepoints_channel_0_illumination_0_all_angles=[0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0]");
"all_timepoints_channel_0_illumination_0_all_angles=[" + matrix_transform + "]");
"all_timepoints_channel_" + channel_setting + "_illumination_0_all_angles=[" + matrix_transform + "]");
}
catch ( e ) {
print( "[transform] caught exception: "+e );
print( "[external transformation] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
......
import ij.IJ;
// 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;
......@@ -7,16 +9,18 @@ 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( "Load Parameters:");
// Getting parameters from job file
// Getting parameters from job file
image_file_directory = System.getProperty( "image_file_directory" );
merged_xml = System.getProperty( "merged_xml" );
if ( ! merged_xml.endsWith(".xml") )
merged_xml = merged.xml + ".xml";
// Printing parameters into output file
System.out.println( "directory=" + image_file_directory );
System.out.println( "merged_xml=" + merged_xml );
......@@ -31,7 +35,8 @@ IJ.run("Merge Cluster Jobs",
"filename_contains=job_ " +
"filename_also_contains=.xml " +
"display " +
"merged_xml=" + merged_xml);
// "delete_xml's " +
"merged_xml=" + merged_xml + "");
}
catch ( e ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment