Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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" );
}
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Calibaration
System.out.println("=========================================================");
System.out.println("Calibration:");
manual_calibration_output = System.getProperty( "manual_calibration_output" );
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" );
// builds string for calibration override
if (manual_calibration_output.equalsIgnoreCase( "No" ) )
{
modify_calibration = "calibration_definition=[Load voxel-size(s) from file(s)] ";
manual_calibration_string = "";
System.out.println( modify_calibration );
}
else if (manual_calibration_output.equalsIgnoreCase( "Yes" ) )
{
modify_calibration = "calibration_definition=[User define voxel-size(s)] ";
manual_calibration_string = " pixel_distance_x=" + pixel_distance_x + " " +
"pixel_distance_y=" + pixel_distance_y + " " +
"pixel_distance_z=" + pixel_distance_z + " " +
"pixel_unit=" + pixel_unit + " ";
System.out.println( "Calibration set to manual" );
System.out.println( modify_calibration );
System.out.println( "manual_calibration_string:" + manual_calibration_string );
}
else
{
System.out.println( "Manual calibration setting bad" );
}
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] " +
modify_calibration +
"imglib2_data_container=[" + imglib_container + "] " +
// 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 +
"calibration_type=[Same voxel-size for all views] " +
modify_calibration +
"imglib2_data_container=[" + imglib_container + "] " +
}
catch ( e ) {
print( "[define_output] caught exception: "+e );
//important to fail the process if exception occurs
runtime.exit(1);
}
/* shutdown */
runtime.exit(0);