annotate stack_max_projs.groovy @ 0:a02156aa8bda draft

planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
author lldelisle
date Thu, 12 Dec 2024 12:42:20 +0000
parents
children 9be687213bc9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
1 /**
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
2 *
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
3 * The purpose of this script is to combine a series of time-lapse images into
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
4 * one file per image with possibly multiple channels and multiple time points
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
5 *
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
6 * To make the script run
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
7 * 1. Create a parent folder (base_dir) and a output folder (output_dir)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
8 * 2. The struction of the base_dir must be: one directory per final image and per channel. All the directories should be: `unique_identifier` `suffix specific to channel`.
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
9 * 3. The image names will be sorted before being merged.
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
10 * 4. The images must be regular tif.
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
11 *
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
12 * The expected outputs are:
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
13 * 1. In the output_dir one tiff per `unique_identifier` (potentially multi-T and potentially multi-C)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
14 */
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
15
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
16 #@ File(style="directory", label="Directory with one directory per final image and per channel") base_dir
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
17 #@ File(style="directory", label="Output directory (must exist)") output_dir
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
18 #@ String(label="Suffix for white channel directory", value="_BF_max", help="Leave empty if you are not interested") suffix_white
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
19 #@ String(label="Suffix for fluo channel(s) directory", value="_Fluo_max", help="Leave empty if you are not interested") suffix_fluo
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
20 #@ String(label="Pattern for green channel images", value="_H2B-GFP", help="Leave empty if you are not interested") pattern_green
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
21 #@ String(label="Pattern for red channel images", value="_RFP670", help="Leave empty if you are not interested") pattern_red
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
22
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
23
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
24 /**
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
25 * *****************************************************************************************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
26 * ********************************************* Final Variables **************************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
27 * ********************************************* DO NOT MODIFY ****************************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
28 * ****************************************************************************************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
29 */
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
30
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
31 // Version number = date of last modif
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
32 VERSION = "20241212"
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
33
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
34 /**
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
35 * *****************************************************************************************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
36 * **************************************** Beginning of the script ***********************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
37 * ****************************************************************************************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
38 */
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
39
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
40 try {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
41
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
42 println "Beginning of the script"
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
43
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
44 IJ.run("Close All", "")
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
45
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
46 // Find all directories
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
47 File[] dir_list = base_dir.listFiles()
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
48
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
49 // The images are stored in a TreeMap where
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
50 // keys are unique_identifier
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
51 // values are a TreeMap that we call channelMap where:
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
52 // keys are colors (Green, Grays, Red)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
53 // values are an ImagePlus (T-stack)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
54 Map<Integer, Map<String, ImagePlus>> samplesMap = new TreeMap<>()
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
55 List<String> dir_suffix_list = [suffix_white, suffix_fluo]
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
56 List<String> dir_channels_list = ["Grays", "Fluo"]
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
57
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
58 List<String> fluo_pattern_list = [pattern_green, pattern_red]
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
59 List<String> fluo_channels_list = ["Green", "Red"]
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
60
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
61 // Loop over directories:
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
62 for (File current_directory : dir_list) {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
63 // Ignore if it is not a directory
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
64 if (! current_directory.isDirectory()) {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
65 continue
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
66 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
67 String current_directory_name = current_directory.getName()
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
68 // Check if it matches one of the suffix
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
69 String final_color = ""
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
70 // And find the unique identifier:
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
71 String unique_identifier = ""
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
72 for(int i = 0; i < dir_suffix_list.size(); i++){
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
73 if (dir_suffix_list[i] != "" && current_directory_name.endsWith(dir_suffix_list[i])) {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
74 final_color = dir_channels_list[i]
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
75 unique_identifier = current_directory_name.replace(dir_suffix_list[i], "")
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
76 continue
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
77 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
78 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
79 if (final_color == "") {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
80 println current_directory_name + " do not match any suffix."
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
81 continue
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
82 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
83 if (! samplesMap.containsKey(unique_identifier) ) {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
84 // Initiate the Map
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
85 samplesMap.put(unique_identifier, new TreeMap<>())
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
86 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
87 // Generate the ImagePlus
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
88 if (final_color == "Fluo") {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
89 for(int i = 0; i < fluo_pattern_list.size(); i++){
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
90 // Use pattern for each color
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
91 if (fluo_pattern_list[i] != "") {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
92 println "Processing " + unique_identifier + " " + fluo_pattern_list[i]
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
93 samplesMap.get(unique_identifier).put(
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
94 fluo_channels_list[i],
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
95 FolderOpener.open(
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
96 current_directory.getAbsolutePath(),
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
97 " filter=" + fluo_pattern_list[i]
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
98 )
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
99 )
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
100 if (!GraphicsEnvironment.isHeadless()){
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
101 samplesMap.get(unique_identifier).get(
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
102 fluo_channels_list[i]).show()
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
103 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
104 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
105 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
106 } else {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
107 // It is easy as all images are used
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
108 println "Processing " + unique_identifier + " Greys"
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
109 samplesMap.get(unique_identifier).put(final_color, FolderOpener.open(current_directory.getAbsolutePath()))
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
110 if (!GraphicsEnvironment.isHeadless()){
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
111 samplesMap.get(unique_identifier).get(
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
112 final_color).show()
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
113 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
114 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
115 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
116
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
117 // Explore the HashMap and save to tiff
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
118 for(String unique_identifier : samplesMap.keySet()){
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
119 // get the channel map
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
120 Map<String, ImagePlus> channelsMap = samplesMap.get(unique_identifier)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
121 ArrayList<String> channels = []
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
122 ArrayList<ImagePlus> current_images = []
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
123
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
124 for(String channel : channelsMap.keySet()){
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
125 channels.add(channel)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
126 current_images.add(channelsMap.get(channel))
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
127 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
128 // Get number of time:
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
129 int nT = current_images[0].nSlices
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
130
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
131 // Merge all
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
132 ImagePlus merged_imps = Concatenator.run(current_images as ImagePlus[])
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
133 // Re-order to make a multi-channel, time-lapse image
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
134 ImagePlus final_imp
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
135 if (channels.size() == 1 && nT == 1) {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
136 final_imp = merged_imps
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
137 } else {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
138 final_imp = HyperStackConverter.toHyperStack(merged_imps, channels.size() , 1, nT, "xytcz", "Color")
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
139 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
140 // set LUTs
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
141 (0..channels.size()-1).each{
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
142 final_imp.setC(it + 1)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
143 IJ.run(final_imp, channels[it], "")
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
144 final_imp.resetDisplayRange()
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
145 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
146 // Save to tiff
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
147 final_imp.setTitle(unique_identifier)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
148
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
149 if (!GraphicsEnvironment.isHeadless()){
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
150 final_imp.show()
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
151 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
152
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
153 def fs = new FileSaver(final_imp)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
154 File output_path = new File (output_dir ,final_imp.getTitle()+"_merge.tif" )
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
155 fs.saveAsTiff(output_path.toString() )
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
156
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
157 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
158 println "End of the script"
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
159
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
160 } catch (Throwable e) {
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
161 println("Something went wrong: " + e)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
162 e.printStackTrace()
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
163 throw e
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
164
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
165 if (GraphicsEnvironment.isHeadless()){
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
166 // Force to give exit signal of error
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
167 System.exit(1)
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
168 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
169
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
170 }
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
171
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
172 return
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
173
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
174 /**
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
175 * ****************************************************************************************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
176 * ******************************************* End of the script **************************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
177 *
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
178 * ****************************************************************************************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
179 *
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
180 * *********************************** Helpers and processing methods *********************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
181 * ***************************************************************************************************************
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
182 */
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
183
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
184 import ij.IJ
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
185 import ij.ImagePlus
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
186 import ij.io.FileSaver
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
187 import ij.io.Opener
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
188 import ij.plugin.Concatenator
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
189 import ij.plugin.FolderOpener
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
190 import ij.plugin.HyperStackConverter
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
191 import ij.process.LUT
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
192
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
193 import java.awt.GraphicsEnvironment
a02156aa8bda planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/max_projections_stack_and_upload_omero commit 69a86e0a8ef82ce3c2232b99f72717a184f4d4cf
lldelisle
parents:
diff changeset
194 import java.io.File