From 1a3e1caebcf9c94e331a3e5c58d3a44b1319dd80 Mon Sep 17 00:00:00 2001 From: Christopher Schmied <schmied@mpi-cbg.de> Date: Wed, 10 Jun 2015 21:08:48 +0200 Subject: [PATCH] Added hooks for ImagJ exceptions --- .../timelapse/deconvolution_CPU.bsh | 146 ------------------ spim_registration/timelapse/define_czi.bsh | 2 +- spim_registration/timelapse/define_output.bsh | 10 +- .../timelapse/define_tif_zip.bsh | 2 +- spim_registration/timelapse/export.bsh | 11 +- spim_registration/timelapse/export_output.bsh | 4 +- spim_registration/timelapse/registration.bsh | 4 +- 7 files changed, 25 insertions(+), 154 deletions(-) delete mode 100644 spim_registration/timelapse/deconvolution_CPU.bsh diff --git a/spim_registration/timelapse/deconvolution_CPU.bsh b/spim_registration/timelapse/deconvolution_CPU.bsh deleted file mode 100644 index f21f94d..0000000 --- a/spim_registration/timelapse/deconvolution_CPU.bsh +++ /dev/null @@ -1,146 +0,0 @@ -// 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); diff --git a/spim_registration/timelapse/define_czi.bsh b/spim_registration/timelapse/define_czi.bsh index 0b9b1ee..e3e1d30 100755 --- a/spim_registration/timelapse/define_czi.bsh +++ b/spim_registration/timelapse/define_czi.bsh @@ -165,7 +165,7 @@ IJ.run("Define Multi-View Dataset", } catch ( e ) { - print( "[registration::interest_points] caught exception: "+e ); + print( "[define_czi] caught exception: "+e ); //important to fail the process if exception occurs runtime.exit(1); diff --git a/spim_registration/timelapse/define_output.bsh b/spim_registration/timelapse/define_output.bsh index da8a3ce..e2469fe 100755 --- a/spim_registration/timelapse/define_output.bsh +++ b/spim_registration/timelapse/define_output.bsh @@ -105,6 +105,7 @@ System.out.println("Define Multi-View Dataset , type_of_dataset=[" + type_of_dat // 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] " + @@ -122,7 +123,14 @@ IJ.run("Define Multi-View Dataset", "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); diff --git a/spim_registration/timelapse/define_tif_zip.bsh b/spim_registration/timelapse/define_tif_zip.bsh index 32ab010..a5f4015 100755 --- a/spim_registration/timelapse/define_tif_zip.bsh +++ b/spim_registration/timelapse/define_tif_zip.bsh @@ -168,7 +168,7 @@ IJ.run("Define Multi-View Dataset", } catch ( e ) { - print( "[registration::interest_points] caught exception: "+e ); + print( "[define_tif_zip] caught exception: "+e ); //important to fail the process if exception occurs runtime.exit(1); diff --git a/spim_registration/timelapse/export.bsh b/spim_registration/timelapse/export.bsh index 6d620ad..1e928a8 100755 --- a/spim_registration/timelapse/export.bsh +++ b/spim_registration/timelapse/export.bsh @@ -56,7 +56,16 @@ 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("========================================================="); @@ -81,7 +90,7 @@ IJ.run("As HDF5", } catch ( e ) { - print( "[registration::interest_points] caught exception: "+e ); + print( "[export::resaving] caught exception: "+e ); //important to fail the process if exception occurs runtime.exit(1); diff --git a/spim_registration/timelapse/export_output.bsh b/spim_registration/timelapse/export_output.bsh index 2a16aed..f05798a 100755 --- a/spim_registration/timelapse/export_output.bsh +++ b/spim_registration/timelapse/export_output.bsh @@ -77,7 +77,7 @@ try{ IJ.run("Toggle Cluster Processing", "display_cluster"); } catch ( e ) { - print( "[export output: cluster setting] caught exception: "+e ); + print( "[export_output::cluster setting] caught exception: "+e ); //important to fail the process if exception occurs runtime.exit(1); } @@ -104,7 +104,7 @@ IJ.run("As HDF5", data_string + ""); } catch ( e ) { - print( "[export output: resaving caught exception: "+e ); + print( "[export_output::resaving] caught exception: "+e ); //important to fail the process if exception occurs runtime.exit(1); } diff --git a/spim_registration/timelapse/registration.bsh b/spim_registration/timelapse/registration.bsh index 0998046..0031b54 100755 --- a/spim_registration/timelapse/registration.bsh +++ b/spim_registration/timelapse/registration.bsh @@ -329,7 +329,7 @@ IJ.run("Detect Interest Points for Registration", } catch ( e ) { - print( "[registration::interest_points] caught exception: "+e ); + print( "[registration::detection of interest_points] caught exception: "+e ); //important to fail the process if exception occurs runtime.exit(1); @@ -383,7 +383,7 @@ IJ.run("Register Dataset based on Interest Points", } catch ( e ) { - print( "[registration::based_on_interestpoints] caught exception: "+e ); + print( "[registration::registration of interest points] caught exception: "+e ); //important to fail the process if exception occurs runtime.exit(1); -- GitLab