Skip to content
Snippets Groups Projects
Commit f19ccece authored by Christopher Schmied's avatar Christopher Schmied
Browse files

Added define xml tif

parent 7d7dbd95
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ rule done:
# defining xml for czi dataset
rule define_xml_czi:
input: glob.glob('*.czi')
output: config["define_xml_czi"]["first_xml_filename"] + ".xml"
output: config["common"]["first_xml_filename"] + ".xml"
message: "Execute define_xml_czi on the following files {input}"
log: "define_xml_czi.log"
run:
......@@ -71,7 +71,7 @@ rule resave_czi_hdf5:
input: rules.define_xml_czi.output, glob.glob('*.czi')
output: "hdf5_Stock68.h5", "hdf5_Stock68.xml"
message: "Execute resave_hdf5 on {input}"
threads: int(config["resave_hdf5"]["parallel_timepoints"]) # parallel timepoints should tell me how many timepoints to expect
# threads: int(config["resave_hdf5"]["parallel_timepoints"]) # parallel timepoints should tell me how many timepoints to expect
log: "export.log"
run:
part_string = produce_string("""{fiji-prefix} {fiji-app} \
......@@ -99,21 +99,45 @@ rule resave_czi_hdf5:
shell(cmd_string)
# defining xml for tif dataset
rule define_xml_tif:
rule resave_tif_hdf5
input: glob.glob('*.tif')
output: config["common"]["first_xml_filename"] + ".xml"
message: "Execute define_xml_czi on the following files {input}"
log: "define_xml_tif.log"
run:
cmd_string = produce_string(
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dtimepoints={timepoints} \
-Dacquisition_angles={acquisition_angles} \
-Dchannels={channels} \
-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"])
cmd_string +="> {log} 2>&1 && touch {output}"
shell(cmd_string)
rule resave_tif_hdf5
rule registration:
# input: "{xml_base}-{file_id}-00.h5"
input: rules.resave_hdf5.output, "{xml_base}-{file_id}-00.h5"
input: "{xml_base}-{file_id}-00.h5"
#input: rules.resave_hdf5.output, "{xml_base}-{file_id}-00.h5"
output: "{xml_base}-{file_id,\d+}-00.h5_registered", #"{xml_base}.job_{file_id,\d+}.xml"
log: "{xml_base}-{file_id}-registration.log"
run:
......
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" );
channels = System.getProperty( "channels" );
acquisition_angles = System.getProperty( "acquisition_angles" );
image_file_pattern = System.getProperty( "image_file_pattern" );
type_of_dataset = System.getProperty( "type_of_dataset" );
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( "timepoints = " + timepoints );
System.out.println( "channels = " + channels );
System.out.println( "acquisition_angles = " + acquisition_angles );
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_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 );
// Calibaration
System.out.println("=========================================================");
System.out.println("Calibration:");
float pixel_distance_x = Float.parseFloat( System.getProperty( "pixel_distance_x" ) );
float pixel_distance_y = Float.parseFloat( System.getProperty( "pixel_distance_y" ) );
float pixel_distance_z = Float.parseFloat( System.getProperty( "pixel_distance_z" ) );
pixel_unit = System.getProperty( "pixel_unit" );
System.out.println( "pixel_distance_x = " + pixel_distance_x );
System.out.println( "pixel_distance_y = " + pixel_distance_y );
System.out.println( "pixel_distance_z = " + pixel_distance_z );
System.out.println( "pixel_unit = " + pixel_unit );
// Executes Fiji plugin
System.out.println("=========================================================");
System.out.println("Start plugin:");
IJ.run("Define Multi-View Dataset",
"type_of_dataset=[" + 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_=" + channels + " " + // for dual channel comment out if single channel
"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 + "");
/* shutdown */
runtime.exit(0);
......@@ -5,12 +5,12 @@
"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" : "/projects/pilot_spim/Christopher/snakemake-workflows/spim_registration/timelapse/"
"bsh_directory" : "/projects/pilot_spim/Christopher/snakemake-workflows/spim_registration/timelapse/",
"first_xml_filename" : "Stock68"
},
"define_xml_czi" :
{
"first_xml_filename" : "Stock68",
"pixel_distance_x" : "0.2875535786151886",
"pixel_distance_y" : "0.2875535786151886",
"pixel_distance_z" : "1.50000",
......@@ -43,6 +43,25 @@
"bsh_file" : "export.bsh"
},
"define_xml_tif" :
{
"timepoints" : "1-2",
"acquisition_angles" : "1,2,3,4,5",
"channels" : "0,1",
"image_file_pattern" : "spim_TL{{tt}}_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" : "\"YES (one file per 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"
},
"registration" :
{
"timepoint" : "\"Single Timepoint (Select from List)\"",
......
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