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

Updated deconvolution

parent 3e7152ed
No related branches found
No related tags found
No related merge requests found
...@@ -89,7 +89,7 @@ rule define_xml_tif: ...@@ -89,7 +89,7 @@ rule define_xml_tif:
cmd_string +=" > {log} 2>&1" cmd_string +=" > {log} 2>&1"
shell(cmd_string) shell(cmd_string)
ruleorder: define_xml_tif > define_xml_czi ruleorder: define_xml_czi > define_xml_tif
# create mother .xml/.h5 # create mother .xml/.h5
rule hdf5_xml: rule hdf5_xml:
...@@ -339,12 +339,13 @@ rule deconvolution: ...@@ -339,12 +339,13 @@ rule deconvolution:
-Dprocess_channel={process_channel} \ -Dprocess_channel={process_channel} \
-Dprocess_illumination={process_illumination} \ -Dprocess_illumination={process_illumination} \
-Dprocess_angle={process_angle} \ -Dprocess_angle={process_angle} \
-Dminimal_x_deco={minimal_x} \ -Dchannels={channels} \
-Dminimal_y_deco={minimal_y} \ -Dminimal_x_deco={minimal_x_deco} \
-Dminimal_z_deco={minimal_z} \ -Dminimal_y_deco={minimal_y_deco} \
-Dmaximal_x_deco={maximal_x} \ -Dminimal_z_deco={minimal_z_deco} \
-Dmaximal_y_deco={maximal_y} \ -Dmaximal_x_deco={maximal_x_deco} \
-Dmaximal_z_deco={maximal_z} \ -Dmaximal_y_deco={maximal_y_deco} \
-Dmaximal_z_deco={maximal_z_deco} \
-Dimglib2_container_deco={imglib2_container} \ -Dimglib2_container_deco={imglib2_container} \
-Dtype_of_iteration={type_of_iteration} \ -Dtype_of_iteration={type_of_iteration} \
-Dosem_acceleration={osem_acceleration} \ -Dosem_acceleration={osem_acceleration} \
...@@ -352,8 +353,7 @@ rule deconvolution: ...@@ -352,8 +353,7 @@ rule deconvolution:
-Dcompute={compute} \ -Dcompute={compute} \
-Dpsf_estimation={psf_estimation} \ -Dpsf_estimation={psf_estimation} \
-Ddirectory_cuda={directory_cuda} \ -Ddirectory_cuda={directory_cuda} \
-Ddetections_to_extract_psf_for_channel_0={detections_to_extract_psf_for_channel_0} \ -Ddetections_to_extract_psf_for_channel={detections_to_extract_psf_for_channel} \
-Ddetections_to_extract_psf_for_channel_1={detections_to_extract_psf_for_channel_1} \
-Dpsf_size_x={psf_size_x} \ -Dpsf_size_x={psf_size_x} \
-Dpsf_size_y={psf_size_y} \ -Dpsf_size_y={psf_size_y} \
-Dpsf_size_z={psf_size_z} \ -Dpsf_size_z={psf_size_z} \
......
// Load Fiji dependencies // Load Fiji dependencies
import ij.IJ; import ij.IJ; // calls imagej
import ij.ImagePlus; import ij.Prefs; // calls imagej settings
import java.lang.Runtime; import java.lang.Runtime;
import java.io.File; import java.io.File;
import java.io.FilenameFilter; import java.io.FilenameFilter;
...@@ -8,17 +8,19 @@ import java.io.FilenameFilter; ...@@ -8,17 +8,19 @@ import java.io.FilenameFilter;
runtime = Runtime.getRuntime(); runtime = Runtime.getRuntime();
System.out.println(runtime.availableProcessors() + " cores available for multi-threading"); 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 // Select xml
image_file_directory = System.getProperty( "image_file_directory" ); image_file_directory = System.getProperty( "image_file_directory" );
merged_xml = System.getProperty( "merged_xml" ); merged_xml = System.getProperty( "merged_xml" );
if ( ! merged_xml.endsWith(".xml") ) if ( ! merged_xml.endsWith(".xml") )
merged_xml = merged.xml + ".xml"; merged_xml = merged.xml + ".xml";
System.out.println( "-------------------------------------------------------" ); System.out.println( "-------------------------------------------------------" );
System.out.println( "Load xml file: " ); 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 // Load general Parameters
int parallel_timepoints = Integer.parseInt(System.getProperty( "parallel_timepoints" )); int parallel_timepoints = Integer.parseInt(System.getProperty( "parallel_timepoints" ));
...@@ -27,6 +29,7 @@ process_channel = System.getProperty( "process_channel" ); ...@@ -27,6 +29,7 @@ process_channel = System.getProperty( "process_channel" );
process_illumination = System.getProperty( "process_illumination" ); process_illumination = System.getProperty( "process_illumination" );
process_angle = System.getProperty( "process_angle" ); process_angle = System.getProperty( "process_angle" );
System.out.println( "-------------------------------------------------------" ); System.out.println( "-------------------------------------------------------" );
System.out.println( "General parameters: " ); System.out.println( "General parameters: " );
System.out.println( "timepoint_processed = " + parallel_timepoints ); System.out.println( "timepoint_processed = " + parallel_timepoints );
...@@ -62,8 +65,7 @@ compute = System.getProperty( "compute" ); ...@@ -62,8 +65,7 @@ compute = System.getProperty( "compute" );
psf_estimation = System.getProperty( "psf_estimation" ); psf_estimation = System.getProperty( "psf_estimation" );
iterations = System.getProperty( "iterations" ); iterations = System.getProperty( "iterations" );
deco_output_file_directory = System.getProperty( "deco_output_file_directory" ); 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( "-------------------------------------------------------" );
System.out.println( "Deconvolution settings: " ); System.out.println( "Deconvolution settings: " );
...@@ -75,14 +77,11 @@ System.out.println( "compute = " + compute ); ...@@ -75,14 +77,11 @@ System.out.println( "compute = " + compute );
System.out.println( "psf_estimation = " + psf_estimation ); System.out.println( "psf_estimation = " + psf_estimation );
System.out.println( "number_of_iterations = " + iterations ); System.out.println( "number_of_iterations = " + iterations );
System.out.println( "deco_output_file_directory = " + deco_output_file_directory ); 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 // Search for CUDA
directory_cuda = System.getProperty( "directory_cuda" );
System.out.println( "-------------------------------------------------------" ); System.out.println( "-------------------------------------------------------" );
System.out.println( "Loading CUDA directory: " ); System.out.println( "Loading CUDA directory: " );
directory_cuda = System.getProperty( "directory_cuda" );
System.out.println( "directory_cuda = " + directory_cuda ); System.out.println( "directory_cuda = " + directory_cuda );
// PSF Parameters // PSF Parameters
...@@ -96,19 +95,48 @@ System.out.println( "psf_size_x = " + psf_size_x ); ...@@ -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_y = " + psf_size_y );
System.out.println( "psf_size_z = " + psf_size_z ); 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 // Execute Fiji Plugin
System.out.println( "=======================================================" ); System.out.println( "=======================================================" );
System.out.println( "Starting Deconvolution" ); System.out.println( "Starting Deconvolution" );
try { try {
IJ.run("Fuse/Deconvolve Dataset", IJ.run("Fuse/Deconvolve Dataset",
"select_xml=" + image_file_directory + merged_xml + " " + "select_xml=" + image_file_directory + merged_xml + " " +
"process_angle=[All angles] " + "process_angle=[All angles] " +
"process_channel=[All channels] " + "process_channel=[All channels] " +
"process_illumination=[All illuminations] " + "process_illumination=[All illuminations] " +
"process_timepoint=[" + process_timepoint + "] " + "process_timepoint=[" + process_timepoint + "] " +
"processing_timepoint=[Timepoint " + parallel_timepoints + "] " + "processing_timepoint=[Timepoint " + parallel_timepoints + "] " +
// "processing_timepoint=[Timepoint 0] " +
"type_of_image_fusion=[Multi-view deconvolution] " + "type_of_image_fusion=[Multi-view deconvolution] " +
"bounding_box=[Define manually] " + "bounding_box=[Define manually] " +
"fused_image=[Save as TIFF stack] " + "fused_image=[Save as TIFF stack] " +
...@@ -130,12 +158,10 @@ IJ.run("Fuse/Deconvolve Dataset", ...@@ -130,12 +158,10 @@ IJ.run("Fuse/Deconvolve Dataset",
"psf_estimation=[" + psf_estimation + "] " + "psf_estimation=[" + psf_estimation + "] " +
"psf_display=[Do not show PSFs] " + "psf_display=[Do not show PSFs] " +
"output_file_directory=" + deco_output_file_directory + " " + "output_file_directory=" + deco_output_file_directory + " " +
// "directory=[/sw/users/schmied/packages/Fiji.app.cuda_new/lib/] " + "cuda_directory=[" + directory_cuda + "] " +
"directory=[" + directory_cuda + "] " +
"select_native_library_for_cudafourierconvolution=libFourierConvolutionCUDALib.so " + "select_native_library_for_cudafourierconvolution=libFourierConvolutionCUDALib.so " +
"gpu_1 " + "gpu_1 " +
"detections_to_extract_psf_for_channel_0=" + detections_to_extract_psf_for_channel_0 + " " + channel_string +
// "detections_to_extract_psf_for_channel_1=" + detections_to_extract_psf_for_channel_1 + " " + // Dual Channel
"psf_size_x=" + psf_size_x + " " + "psf_size_x=" + psf_size_x + " " +
"psf_size_y=" + psf_size_y + " " + "psf_size_y=" + psf_size_y + " " +
"psf_size_z=" + psf_size_z + ""); "psf_size_z=" + psf_size_z + "");
......
common: { common: {
# directory that contains the bean shell scripts # directory that contains the bean shell scripts
bsh_directory: "/projects/pilot_spim/Christopher/snakemake-workflows/spim_registration/timelapse/", bsh_directory: "/projects/pilot_spim/Christopher/snakemake-workflows/spim_registration/timelapse/",
directory_cuda: "/sw/users/schmied/packages/2015-06-08_Fiji.app.cuda/lib/lib/", 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-app: "/sw/users/schmied/packages/2015-06-08_Fiji.app.cuda/ImageJ-linux64",
fiji-prefix: "/sw/bin/xvfb-run -a", fiji-prefix: "/sw/bin/xvfb-run -a",
first_xml_filename: "test_unicore", first_xml_filename: "test_unicore",
...@@ -128,30 +128,31 @@ external_transform: { ...@@ -128,30 +128,31 @@ external_transform: {
} }
deconvolution: { deconvolution: {
iterations: '5',
maximal_x_deco: '509',
maximal_y_deco: '970',
maximal_z_deco: '243',
minimal_x_deco: '95',
minimal_y_deco: '-8',
minimal_z_deco: '-174',
detections_to_extract_psf_for_channel: '"beads"',
#detections_to_extract_psf_for_channel_0: '"beads"',
#detections_to_extract_psf_for_channel_1: '"beads"',
process_timepoint: '"Single Timepoint (Select from List)"',
process_angle: '"All angles"',
process_channel: '"All channels"',
process_illumination: '"All illuminations"',
Tikhonov_parameter: '0.0006', Tikhonov_parameter: '0.0006',
bsh_file: "deconvolution_GPU.bsh",
compute: '"in 512x512x512 blocks"', compute: '"in 512x512x512 blocks"',
compute_on: '"GPU (Nvidia CUDA via JNA)"', compute_on: '"GPU (Nvidia CUDA via JNA)"',
detections_to_extract_psf_for_channel_0: '"beads"',
detections_to_extract_psf_for_channel_1: '"beads"',
imglib2_container: '"ArrayImg"', imglib2_container: '"ArrayImg"',
iterations: '5',
maximal_x: '509',
maximal_y: '970',
maximal_z: '243',
minimal_x: '95',
minimal_y: '-8',
minimal_z: '-174',
osem_acceleration: '"1 (balanced)"', osem_acceleration: '"1 (balanced)"',
process_angle: '"All angles"',
process_channel: '"All channels"',
process_illumination: '"All illuminations"',
process_timepoint: '"Single Timepoint (Select from List)"',
psf_estimation: '"Extract from beads"', psf_estimation: '"Extract from beads"',
psf_size_x: '19', psf_size_x: '19',
psf_size_y: '19', psf_size_y: '19',
psf_size_z: '25', psf_size_z: '25',
type_of_iteration: '"Efficient Bayesian - Optimization I (fast, precise)"' type_of_iteration: '"Efficient Bayesian - Optimization I (fast, precise)"',
bsh_file: "deconvolution_GPU.bsh"
} }
hdf5_output: { hdf5_output: {
......
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