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

Updated xml merge, timelapse registration and transform

Added dual channel processing for these parts
updated .bsh file
parent 8abee024
No related branches found
No related tags found
No related merge requests found
......@@ -230,15 +230,14 @@ rule timelapse:
-Dimage_file_directory={jdir} \
-Dmerged_xml={input} \
-Dtimelapse_process_timepoints={timelapse_process_timepoints} \
-Dprocess_channel_timelapse={channel} \
-Dprocess_illumination={illuminations} \
-Dprocess_angle={angle} \
-Dreg_process_channel={reg_process_channel} \
-Dreg_process_illumination={reg_process_illumination} \
-Dreg_process_angle={reg_process_angle} \
-Dreference_timepoint={reference_timepoint} \
-Dchannel_1={proc-ch} \
-Dchannels={channels} \
-Dtype_of_registration_timelapse={type_of_registration_timelapse} \
-Dregistration_algorithm={algorithm} \
-Dreg_1_interest_points_channel={interest_points_channel_0} \
-Dreg_2_interest_points_channel={interest_points_channel_1} \
-Dreg_interest_points_channel={reg_interest_points_channel} \
-Dtransformation_model={transformation_model} \
-Dmodel_to_regularize_with={model_to_regularize_with} \
-Dlambda={lambda} \
......@@ -307,10 +306,10 @@ rule external_transform:
"""{fiji-prefix} {fiji-app} \
-Dimage_file_directory={jdir} \
-Dmerged_xml={merged_xml_file} \
-Dtransform_angle={angle} \
-Dtransform_channel={channel} \
-Dtransform_illumination={illumination} \
-Dtransform_timepoint={timepoint} \
-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} \
......
......@@ -28,7 +28,8 @@ System.out.println( "selected_xml = " + xml_path + xml_filename + ".xml");
System.out.println( "-------------------------------------------------------" );
System.out.println( "General parameters: " );
parallel_timepoints = System.getProperty( "parallel_timepoints" );
int parallel_timepoints = Integer.parseInt(System.getProperty( "parallel_timepoints" ));
unique_id = System.getProperty( "parallel_timepoints" );
reg_process_timepoint = System.getProperty( "reg_process_timepoint" );
reg_process_illumination = System.getProperty( "reg_process_illumination" );
reg_process_angle = System.getProperty( "reg_process_angle" );
......@@ -290,7 +291,7 @@ System.out.println( "=======================================================" );
System.out.println( "Starting Detection of Interest Points" );
System.out.println("Detect Interest Points for Registration , select_xml=" + xml_path + xml_filename + ".xml " +
"unique_id=" + parallel_timepoints + " " +
"unique_id=" + unique_id + " " +
"process_angle=[" + reg_process_angle + "] " +
"process_channel=[" + reg_process_channel + "] " +
"process_illumination=[" + reg_process_illumination + "] " +
......@@ -308,7 +309,7 @@ System.out.println("Detect Interest Points for Registration , select_xml=" + xml
try {
IJ.run("Detect Interest Points for Registration",
"select_xml=" + xml_path + xml_filename + ".xml " +
"unique_id=" + parallel_timepoints + " " +
"unique_id=" + unique_id + " " +
"process_angle=[" + reg_process_angle + "] " +
"process_channel=[" + reg_process_channel + "] " +
"process_illumination=[" + reg_process_illumination + "] " +
......@@ -325,7 +326,7 @@ IJ.run("Detect Interest Points for Registration",
}
catch ( e ) {
print( "[registration::activate_cluster_processing] caught exception: "+e );
print( "[registration::interest_points] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
......@@ -335,7 +336,7 @@ catch ( e ) {
System.out.println( "=======================================================" );
System.out.println( "Starting Registration" );
System.out.println("Register Dataset based on Interest Points , select_xml=" + xml_path + xml_filename + ".job_" + parallel_timepoints + ".xml " +
System.out.println("Register Dataset based on Interest Points , select_xml=" + xml_path + xml_filename + ".job_" + unique_id + ".xml " +
"process_angle=[" + reg_process_angle + "] " +
"process_channel=[" + reg_process_channel + "] " +
"process_illumination=[" + reg_process_illumination + "] " +
......@@ -357,7 +358,7 @@ System.out.println("Register Dataset based on Interest Points , select_xml=" + x
try {
IJ.run("Register Dataset based on Interest Points",
"select_xml=" + xml_path + xml_filename + ".job_" + parallel_timepoints + ".xml " +
"select_xml=" + xml_path + xml_filename + ".job_" + unique_id + ".xml " +
"process_angle=[" + reg_process_angle + "] " +
"process_channel=[" + reg_process_channel + "] " +
"process_illumination=[" + reg_process_illumination + "] " +
......@@ -379,7 +380,7 @@ IJ.run("Register Dataset based on Interest Points",
}
catch ( e ) {
print( "[registration::activate_cluster_processing] caught exception: "+e );
print( "[registration::based_on_interestpoints] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
......
......@@ -16,30 +16,27 @@ print("Threads: "+Prefs.getThreads()); // prints thread setting in output
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 + ".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" );
process_channel_timelapse = System.getProperty( "process_channel_timelapse" );
process_illumination = System.getProperty( "process_illumination" );
process_angle = System.getProperty( "process_angle" );
channel_1 = System.getProperty( "channel_1" );
channel_2 = System.getProperty( "channel_2" );
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_channel = " + process_channel_timelapse );
System.out.println( "process_illumination = " + process_illumination );
System.out.println( "process_angle = " + process_angle );
System.out.println( "channel_1 = " + channel_1 );
System.out.println( "channel_2 = " + channel_2 );
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: " );
......@@ -49,13 +46,11 @@ System.out.println( "reference_timepoint=" + reference_timepoint );
type_of_registration_timelapse = System.getProperty( "type_of_registration_timelapse" );
registration_algorithm = System.getProperty( "registration_algorithm" );
reg_1_interest_points_channel = System.getProperty( "reg_1_interest_points_channel" );
reg_2_interest_points_channel = System.getProperty( "reg_2_interest_points_channel" ); // Dual Channel
System.out.println( "type_of_registration = " + type_of_registration_timelapse );
System.out.println( "registration_algorithm = " + registration_algorithm );
System.out.println( "interest_points_channel_" + channel_1 + " = " + reg_1_interest_points_channel );
System.out.println( "interest_points_channel_" + channel_2 + " = " + reg_2_interest_points_channel );
transformation_model = System.getProperty( "transformation_model" );
model_to_regularize_with = System.getProperty( "model_to_regularize_with" );
......@@ -63,25 +58,132 @@ 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 );
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");
}
// Returns Error if Single Channel selected but multiple settings in channels or reg_interest_points_channel
else if ( reg_process_channel.equalsIgnoreCase( "Single Channel" ) && (channel_token.length > 1 || interest_token.length > 1 ))
{
System.out.println( "Error: Single Channel selected but multiple settings in channls or reg_interest_points_channel" );
}
// Assembles string for Single Channel registration
else if (reg_process_channel.equalsIgnoreCase( "Single channel" ) && channel_token.length == 1 )
{
reg_multi_channel_string.append( "" );
reg_single_channel_string = "interest_points_channel_" + channels + "=" + reg_interest_points_channel + " ";
}
// Returns error if Multi Channels are selected but not enough settings in channels or reg_interest_points_channel
else if (reg_process_channel.equalsIgnoreCase( "All channels" ) && ( channel_token.length < 1 || interest_token.length < 1) )
{
System.out.println( "Error: Multi Channel selected but only one setting in channels or 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=[" + process_angle + "] " +
"process_channel=[" + process_channel_timelapse + "] " +
"process_illumination=[" + process_illumination + "] " +
"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 + "] " +
"interest_points_channel_" + channel_1 + "=" + reg_1_interest_points_channel + " " +
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 " +
......@@ -94,11 +196,10 @@ IJ.run("Register Dataset based on Interest Points",
}
catch ( e ) {
print( "[deconvolution-GPU] caught exception: "+e );
print( "[registration::timelapse] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
/* shutdown */
runtime.exit(0);
......@@ -72,7 +72,6 @@ registration: {
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"
}
......@@ -82,10 +81,16 @@ xml_merge: {
}
timelapse: {
bsh_file: "timelapse_registration.bsh",
reference_timepoint: '0',
type_of_registration_timelapse: '"Match against one reference timepoint (no global optimization)"',
timelapse_process_timepoints: '"All Timepoints"',
type_of_registration_timelapse: '"Match against one reference timepoint (no global optimization)"'
bsh_file: "timelapse_registration.bsh"
}
Dublicate_transformations: {
source_dublication: "red",
target_dublication: "green",
bsh_file: "dublicate_channel.bsh"
}
fusion: {
......@@ -111,16 +116,15 @@ fusion: {
}
external_transform: {
angle: '"All angles"',
apply_transformation: '"Current view transformations
(appends to current transforms)"',
bsh_file: "transform.bsh",
channel: '"All channels"',
transform_timepoint: '"All Timepoints"',
transform_angle: '"All angles"',
transform_channel: '"All channels"',
transform_illumination: '"All illuminations"',
apply_transformation: '"Current view transformations (appends to current transforms)"',
define_mode_transform: '"Matrix"',
illumination: '"All illuminations"',
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"',
timepoint: '"All Timepoints"',
transformation: '"Rigid"'
transformation: '"Rigid"',
bsh_file: "transform.bsh"
}
deconvolution: {
......
......@@ -11,13 +11,12 @@ 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_1 = System.getProperty( "channel_1" );
channel_2 = System.getProperty( "channel_2" );
transformation = System.getProperty( "transformation" );
apply_transformation = System.getProperty( "apply_transformation" );
define_mode_transform = System.getProperty( "define_mode_transform" );
......@@ -26,15 +25,17 @@ 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_1 = " + channel_1 );
System.out.println( "channel_2 = " + channel_2 );
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_1 + "_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_1 + "_illumination_0_all_angles=[" + matrix_transform + "]");
}
catch ( e ) {
print( "[transform] caught exception: "+e );
print( "[registration::interest_points] 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