annotate stack_buildXml.groovy @ 0:e1cba36becb2 draft

planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
author lldelisle
date Tue, 19 Dec 2023 15:02:41 +0000
parents
children 3c942429f610
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
1 /*
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
2 ****************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
3 * Relative to the generation of the .companion.ome *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
4 ****************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
5 * #%L
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
6 * BSD implementations of Bio-Formats readers and writers
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
7 * %%
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
8 * The functions buildXML, makeImage, makePlate, postProcess and asString has been modified and adapted from
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
9 * https://github.com/ome/bioformats/blob/master/components/formats-bsd/test/loci/formats/utests/SPWModelMock.java
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
10 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
11 * Copyright (C) 2005 - 2015 Open Microscopy Environment:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
12 * - Board of Regents of the University of Wisconsin-Madison
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
13 * - Glencoe Software, Inc.
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
14 * - University of Dundee
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
15 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
16 * @author Chris Allan <callan at blackcat dot ca>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
17 * %%
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
18 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
19 ****************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
20 * Relative to the rest of the script *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
21 ****************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
22 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
23 * * = AUTHOR INFORMATION =
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
24 * Code written by Rémy Dornier, EPFL - SV - PTECH - BIOP
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
25 * and Romain Guiet, EPFL - SV - PTECH - BIOP
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
26 * and Lucille Delisle, EPFL - SV - UPDUB
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
27 * and Pierre Osteil, EPFL - SV - UPDUB
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
28 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
29 * Last modification: 2023-12-19
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
30 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
31 * = COPYRIGHT =
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
32 * © All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, BioImaging And Optics Platform (BIOP), 2023
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
33 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
34 * Licensed under the BSD-3-Clause License:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
35 * Redistribution and use in source and binary forms, with or without modification, are permitted provided
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
36 * that the following conditions are met:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
37 * 1. Redistributions of source code must retain the above copyright notice,
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
38 * this list of conditions and the following disclaimer.
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
39 * 2. Redistributions in binary form must reproduce the above copyright notice,
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
40 * this list of conditions and the following disclaimer
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
41 * in the documentation and/or other materials provided with the distribution.
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
42 * 3. Neither the name of the copyright holder nor the names of its contributors
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
43 * may be used to endorse or promote products
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
44 * derived from this software without specific prior written permission.
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
45 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
46 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
47 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
49 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
50 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
51 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
52 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
53 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
54 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
55 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
56 * POSSIBILITY OF SUCH DAMAGE.
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
57 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
58 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
59
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
60 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
61 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
62 * The purpose of this script is to combine a series of time-lapse images into
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
63 * one file per well/field with possibly multiple channels and multiple time points
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
64 * and in addition create a .companion.ome file to create an OMERO plate object,
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
65 * with a single image per well/field. This .companion.ome file can be directly uploaded on OMERO via
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
66 * OMERO.insight software or CLI, with screen import option.
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
67 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
68 * To make the script run
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
69 * 1. Create a parent folder (base_dir) and a output folder (output_dir)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
70 * 2. Create a dir *Phase, *Green, *Red with the corresponding channels
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
71 * 3. The image names must contains a prefix followed by '_', the name of the well (no 0-pad) followed by '_', followed by the field id followed by '_', the date of the acquisition in YYYYyMMmDDdHHhMMm and the extension '.tif'
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
72 * 4. The images can be either regular tif or the raw tif from Incucyte which contains multiple series.
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
73 * 5. You must provide the path of the Incucyte XML file to populate key values
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
74 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
75 * The expected outputs are:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
76 * 1. In the output_dir one tiff per well/field (multi-T and potentially multi-C)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
77 * 2. In the output_dir a .companion.ome
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
78 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
79
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
80 #@ File(style="directory", label="Directory with up to 3 subdirectories ending by Green, Phase and/or Red") base_dir
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
81 #@ File(label="Incucyte XML File (plateMap)") incucyteXMLFile
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
82 #@ File(style="directory", label="Output directory (must exist)") output_dir
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
83 #@ String(label="Final XML file name", value="Test") xmlName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
84 #@ String(label="Number of well in plate", choices={"96", "384"}, value="96") nWells
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
85 #@ Integer(label="Maximum number of images per well", value=1, min=1) n_images_per_well
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
86 #@ String(label="Objective", choices={"4x","10x","20x"}) objectiveChoice
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
87 #@ String(label="Plate name", value="Experiment:0") plateName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
88 #@ String(label="common Key Values formatted as key1=value1;key2=value2", value="") commonKeyValues
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
89 #@ Boolean(label="Ignore Compound concentration from plateMap", value=true) ignoreConcentration
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
90 #@ Boolean(label="Ignore Cell passage number from plateMap", value=true) ignorePassage
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
91 #@ Boolean(label="Ignore Cell seeding concentration from plateMap", value=true) ignoreSeeding
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
92
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
93
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
94 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
95 * *****************************************************************************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
96 * ********************************************* Final Variables **************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
97 * ********************************************* DO NOT MODIFY ****************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
98 * ****************************************************************************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
99 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
100
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
101 /** objectives and respective pixel sizes */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
102 objective = 0
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
103 objectives = new String[]{"4x", "10x", "20x"}
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
104 pixelSizes = new double[]{2.82, 1.24, 0.62}
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
105
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
106 /** pattern for date */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
107 REGEX_FOR_DATE = ".*_([0-9]{4})y([0-9]{2})m([0-9]{2})d_([0-9]{2})h([0-9]{2})m.tif"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
108
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
109 ALTERNATIVE_REGEX_FOR_DATE = ".*_([0-9]{2})d([0-9]{2})h([0-9]{2})m.tif"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
110
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
111 /** Image properties keys */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
112 DIMENSION_ORDER = "dimension_order"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
113 FILE_NAME = "file_name"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
114 IMG_POS_IN_WELL = "img_pos_in_well"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
115 FIRST_ACQUISITION_DATE = "acquisition_date"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
116 FIRST_ACQUISITION_TIME = "acquisition_time"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
117 RELATIVE_ACQUISITION_HOUR = "relative_acquisition_hour"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
118
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
119 /** global variable for index to letter conversion */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
120 LETTERS = new String("ABCDEFGHIJKLMNOP")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
121
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
122 // Version number = date of last modif
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
123 VERSION = "20231219"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
124
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
125 /** Key-Value pairs namespace */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
126 GENERAL_ANNOTATION_NAMESPACE = "openmicroscopy.org/omero/client/mapAnnotation"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
127 annotations = new StructuredAnnotations()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
128
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
129 /** Plate details and conventions */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
130 PLATE_ID = "Plate:0"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
131 PLATE_NAME = plateName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
132
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
133 if (nWells == "96") {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
134 nRows = 8
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
135 nCols = 12
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
136 } else if (nWells == "384") {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
137 nRows = 16
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
138 nCols = 24
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
139 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
140
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
141 WELL_ROWS = new PositiveInteger(nRows)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
142 WELL_COLS = new PositiveInteger(nCols)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
143 WELL_ROW = NamingConvention.LETTER
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
144 WELL_COL = NamingConvention.NUMBER
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
145
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
146 /** XML namespace. */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
147 XML_NS = "http://www.openmicroscopy.org/Schemas/OME/2010-06"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
148
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
149 /** XSI namespace. */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
150 XSI_NS = "http://www.w3.org/2001/XMLSchema-instance"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
151
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
152 /** XML schema location. */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
153 SCHEMA_LOCATION = "http://www.openmicroscopy.org/Schemas/OME/2010-06/ome.xsd"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
154
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
155
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
156 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
157 * *****************************************************************************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
158 * **************************************** Beginning of the script ***********************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
159 * ****************************************************************************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
160 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
161
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
162 try {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
163
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
164 println "Beginning of the script"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
165
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
166 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
167 * Prepare list of wells name
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
168 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
169 String[] well = []
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
170
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
171 well = [(0..(nRows - 1)),(0..(nCols - 1))].combinations().collect{ r,c -> LETTERS.substring(r, r + 1) +""+ (c+ 1).toString() }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
172
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
173 IJ.run("Close All", "")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
174
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
175 // loop for all the wells
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
176
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
177 // Store all merged ImagePlus into a HashMap where
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
178 // keys are well name (A1, A10)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
179 // values are a list of ImagePlus corresponding to different field of view
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
180 Map<String, List<ImagePlus>> wellSamplesMap = new HashMap<>()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
181
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
182 well.each{ input ->
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
183 IJ.run("Close All", "")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
184
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
185 List<ImagePlus> final_imp_list = process_well(base_dir, input, n_images_per_well) //, perform_bc, mediaChangeTime )
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
186 if (!final_imp_list.isEmpty()) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
187 wellSamplesMap.put(input, final_imp_list)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
188 for(ImagePlus final_imp : final_imp_list){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
189 final_imp.setTitle(input+"_"+final_imp.getProperty(IMG_POS_IN_WELL))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
190 //final_imp.show()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
191
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
192 def fs = new FileSaver(final_imp)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
193 File output_path = new File (output_dir ,final_imp.getTitle()+"_merge.tif" )
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
194 fs.saveAsTiff(output_path.toString() )
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
195 final_imp.setProperty(FILE_NAME, output_path.getName())
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
196
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
197 IJ.run("Close All", "")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
198 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
199 } else {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
200 println "No match for " + input
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
201 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
202 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
203
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
204
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
205 // get folder and xml file path
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
206 output_dir_abs = output_dir.getAbsolutePath()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
207 incucyteXMLFilePath = incucyteXMLFile.getAbsolutePath()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
208
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
209 if (! new File(incucyteXMLFilePath).exists()) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
210 println "The incucyte file does not exists"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
211 return
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
212 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
213
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
214 // select the right objective
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
215 switch (objectiveChoice){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
216 case "4x":
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
217 objective = 0
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
218 break
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
219 case "10x":
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
220 objective = 1
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
221 break
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
222 case "20x":
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
223 objective = 2
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
224 break
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
225 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
226
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
227 // get plate scheme as key-values
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
228 Map<String, List<MapPair>> keyValuesPerWell = parseIncucyteXML(incucyteXMLFilePath, ignoreConcentration, ignorePassage, ignoreSeeding)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
229
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
230 // get global key-values
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
231 List<MapPair> globalKeyValues = getGlobalKeyValues(objective, commonKeyValues)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
232 double pixelSize = pixelSizes[objective]
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
233
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
234 // generate OME-XML metadata file
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
235 OME ome = buildXMLFile(wellSamplesMap, keyValuesPerWell, globalKeyValues, pixelSize)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
236
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
237 // create XML document
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
238 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
239 DocumentBuilder parser = factory.newDocumentBuilder()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
240 Document document = parser.newDocument()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
241
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
242 // Produce a valid OME DOM element hierarchy
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
243 Element root = ome.asXMLElement(document)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
244 postProcess(root, document)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
245
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
246 // Produce string XML
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
247 try(OutputStream outputStream = new FileOutputStream(output_dir_abs + File.separator + xmlName + ".companion.ome")){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
248 outputStream.write(asString(document).getBytes())
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
249 } catch(Exception e){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
250 e.printStackTrace()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
251 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
252 println "End of the script"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
253
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
254 } catch (Throwable e) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
255 println("Something went wrong: " + e)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
256 e.printStackTrace()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
257 throw e
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
258
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
259 if (GraphicsEnvironment.isHeadless()){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
260 // Force to give exit signal of error
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
261 System.exit(1)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
262 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
263
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
264 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
265
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
266 return
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
267
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
268 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
269 * ****************************************************************************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
270 * ******************************************* End of the script **************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
271 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
272 * ****************************************************************************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
273 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
274 * *********************************** Helpers and processing methods *********************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
275 * ***************************************************************************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
276 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
277
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
278 def process_well(baseDir, input_wellId, n_image_per_well){ //, perform_bc, mediaChangeTime){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
279 File bf_dir = baseDir.listFiles().find{ it =~ /.*Phase.*/}
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
280 File green_dir = baseDir.listFiles().find{ it =~ /.*Green.*/}
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
281 File red_dir = baseDir.listFiles().find{ it =~ /.*Red.*/}
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
282 //if (verbose) println bf_dir
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
283 //if (verbose) println green_dir
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
284
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
285 // The images are stored in a TreeMap where
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
286 // keys are wellSampleId = field identifier
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
287 // values are a TreeMap that we call channelMap where:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
288 // keys are colors (Green, Grays, Red)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
289 // values are an ImagePlus (T-stack)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
290 Map<Integer, Map<String, ImagePlus>> sampleToChannelMap = new TreeMap<>()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
291
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
292 List<File> folder_list = [bf_dir, green_dir, red_dir]
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
293 List<String> channels_list = ["Grays", "Green", "Red"]
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
294
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
295 // loop over the field and open images
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
296 for(int wellSampleId = 1; wellSampleId <= n_image_per_well; wellSampleId++) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
297 // nT is the number of time-points for the well input_wellId
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
298 int nT = 0
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
299 String first_channel = ""
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
300 String first_acq_date = ""
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
301 String first_acq_time = ""
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
302 String rel_acq_hour = ""
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
303
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
304 // Initiate a channel map for the wellSampleId
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
305 Map<String, ImagePlus> channelMap = new TreeMap<>()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
306
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
307 // Checking if there are images in the corresponding dir
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
308 // which corresponds to the input_wellId
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
309 // and to the wellSampleId
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
310 // The image name should be:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
311 // Prefix + "_" + input_wellId + "_" + wellSampleId + "_" + year (4 digits) + "y" + month (2 digits) + "m" + day + "d_" + hour + "h" + minute + "m.tif"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
312 FileFilter fileFilter = new WildcardFileFilter("*_" + input_wellId + "_" + wellSampleId + "_*")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
313 for(int i = 0; i < folder_list.size(); i++){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
314 if (folder_list.get(i) != null) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
315 File[] files_matching = folder_list.get(i).listFiles(fileFilter as FileFilter).sort()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
316 if (files_matching.size() != 0) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
317 // In order to deal with raw images from Incucyte which are
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
318 // Multi series images
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
319 // We open the first image
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
320 ImagePlus first_imp = Opener.openUsingBioFormats(files_matching[0].getAbsolutePath())
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
321 // We check if we can read the infos
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
322 first_image_infos = Opener.getTiffFileInfo(files_matching[0].getAbsolutePath())
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
323 // We define the imageplus object
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
324 ImagePlus single_channel_imp
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
325 if (first_image_infos == null) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
326 // They are raw from incucyte
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
327 // We need to open images one by one and add them to the stack
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
328 ImageStack stack = new ImageStack(first_imp.width, first_imp.height);
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
329 files_matching.each{
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
330 ImagePlus single_imp = (new Opener()).openUsingBioFormats(it.getAbsolutePath())
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
331 String new_title = single_imp.getTitle().split(" - ")[0]
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
332 stack.addSlice(new_title, single_imp.getProcessor())
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
333 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
334 single_channel_imp = new ImagePlus(FilenameUtils.getBaseName(folder_list.get(i).getAbsolutePath()), stack);
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
335 } else {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
336 // They are regular tif file
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
337 // We can use FolderOpener to create the stack at once
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
338 single_channel_imp = FolderOpener.open(folder_list.get(i).getAbsolutePath(), " filter=_"+ input_wellId + "_"+wellSampleId+"_")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
339 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
340 // Phase are 8-bit and need to be changed to 16-bit
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
341 // Other are already 16-bit but it does not hurt
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
342 IJ.run(single_channel_imp, "16-bit", "")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
343
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
344 // check frame size
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
345 if (nT == 0) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
346 // This is the first channel with images
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
347 nT = single_channel_imp.getNSlices()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
348 first_channel = channels_list.get(i)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
349 // Process all dates:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
350 Pattern date_pattern = Pattern.compile(REGEX_FOR_DATE)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
351 ImageStack stack = single_channel_imp.getStack()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
352 // Go to the first time (which is slice)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
353 single_channel_imp.setSlice(1)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
354 int currentSlice = single_channel_imp.getCurrentSlice()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
355 String label = stack.getSliceLabel(currentSlice)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
356 LocalDateTime dateTime_ref = getDate(label, date_pattern)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
357 if (dateTime_ref == null) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
358 date_pattern = Pattern.compile(ALTERNATIVE_REGEX_FOR_DATE)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
359 dateTime_ref = getDate(label, date_pattern)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
360 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
361 if (dateTime_ref != null) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
362 first_acq_date = dateTime_ref.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
363 first_acq_time = dateTime_ref.format(DateTimeFormatter.ofPattern("HH:mm:ss"))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
364 for (int ti = 2; ti<= nT; ti++) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
365 // Process each frame starting at 2
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
366 single_channel_imp.setSlice(ti)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
367 int hours = getHoursFromImp(single_channel_imp, stack, dateTime_ref, date_pattern)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
368 if (rel_acq_hour == "") {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
369 rel_acq_hour = "" + hours
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
370 } else {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
371 rel_acq_hour += "," + hours
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
372 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
373 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
374 } else {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
375 first_acq_date = "NA"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
376 first_acq_time = "NA"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
377 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
378 } else {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
379 assert single_channel_imp.getNSlices() == nT : "The number of "+channels_list.get(i)+" images for well "+input_wellId+" and field " + wellSampleId + " does not match the number of images in " + first_channel + "."
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
380 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
381 // Set acquisition properties
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
382 single_channel_imp.setProperty(FIRST_ACQUISITION_DATE, first_acq_date)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
383 single_channel_imp.setProperty(FIRST_ACQUISITION_TIME, first_acq_time)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
384 single_channel_imp.setProperty(RELATIVE_ACQUISITION_HOUR, rel_acq_hour)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
385 println single_channel_imp.getProperty(FIRST_ACQUISITION_DATE)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
386 println single_channel_imp.getProperty(FIRST_ACQUISITION_TIME)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
387 // add the image stack to the channel map for the corresponding color
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
388 channelMap.put(channels_list.get(i), single_channel_imp)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
389 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
390 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
391 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
392 if (nT != 0) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
393 // add the channelmap to the sampleToChannelMap using the wellSampleId as key
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
394 sampleToChannelMap.put(wellSampleId, channelMap)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
395 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
396 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
397
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
398 ArrayList<ImagePlus> final_imp_list = []
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
399
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
400 // Now loop over the wellSampleId which have images
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
401 for(Integer wellSampleId : sampleToChannelMap.keySet()){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
402 // get the channel map
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
403 Map<String, ImagePlus> channelsMap = sampleToChannelMap.get(wellSampleId)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
404 ArrayList<String> channels = []
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
405 ArrayList<ImagePlus> current_images = []
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
406
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
407 for(String channel : channelsMap.keySet()){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
408 channels.add(channel)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
409 current_images.add(channelsMap.get(channel))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
410 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
411 // Get number of time:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
412 int nT = current_images[0].nSlices
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
413
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
414 // Merge all
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
415 ImagePlus merged_imps = Concatenator.run(current_images as ImagePlus[])
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
416 // Re-order to make a multi-channel, time-lapse image
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
417 ImagePlus final_imp
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
418 if (channels.size() == 1 && nT == 1) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
419 final_imp = merged_imps
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
420 } else {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
421 final_imp = HyperStackConverter.toHyperStack(merged_imps, channels.size() , 1, nT, "xytcz", "Color")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
422 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
423 // add properties to the image
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
424 final_imp.setProperty(DIMENSION_ORDER, DimensionOrder.XYCZT)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
425 final_imp.setProperty(IMG_POS_IN_WELL, wellSampleId)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
426 final_imp.setProperty(FIRST_ACQUISITION_DATE, current_images[0].getProperty(FIRST_ACQUISITION_DATE))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
427 final_imp.setProperty(FIRST_ACQUISITION_TIME, current_images[0].getProperty(FIRST_ACQUISITION_TIME))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
428 final_imp.setProperty(RELATIVE_ACQUISITION_HOUR, current_images[0].getProperty(RELATIVE_ACQUISITION_HOUR))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
429
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
430 // set LUTs
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
431 (0..channels.size()-1).each{
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
432 final_imp.setC(it + 1)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
433 IJ.run(final_imp, channels[it], "")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
434 final_imp.resetDisplayRange()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
435 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
436
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
437 final_imp_list.add(final_imp)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
438 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
439
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
440 return final_imp_list
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
441 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
442
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
443
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
444 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
445 * create the full XML metadata (plate, images, channels, annotations....)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
446 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
447 * @param imagesName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
448 * @param keyValuesPerWell
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
449 * @param globalKeyValues
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
450 * @param pixelSize
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
451 * @return OME-XML metadata instance
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
452 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
453 def buildXMLFile(Map<String,List<ImagePlus>> wellToImagesMap, Map<String, List<MapPair>> keyValuesPerWell, List<MapPair> globalKeyValues, double pixelSize) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
454 // create a new OME-XML metadata instance
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
455 OME ome = new OME()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
456
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
457 Map<String, Integer> imgInWellPosToListMap = new HashMap<>()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
458 int imgCmp = 0
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
459 for (String wellId: wellToImagesMap.keySet()) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
460 // get well position from image name
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
461 List<ImagePlus> imagesWithinWell = wellToImagesMap.get(wellId)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
462
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
463 for (ImagePlus image : imagesWithinWell) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
464 // get KVP corresponding to the current well
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
465 // Initiate a list of keyValues for the wellId
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
466 // (or use the existing one)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
467 List<MapPair> keyValues = []
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
468 if(keyValuesPerWell.containsKey(wellId))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
469 keyValues = keyValuesPerWell.get(wellId)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
470 keyValues.addAll(globalKeyValues)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
471
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
472 // create an Image node in the ome-xml
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
473 imgInWellPosToListMap.put(wellId+ "_" +image.getProperty(IMG_POS_IN_WELL),imgCmp)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
474 ome.addImage(makeImage(imgCmp++, image, keyValues, pixelSize))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
475 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
476 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
477
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
478 // create Plate node
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
479 ome.addPlate(makePlate(wellToImagesMap, imgInWellPosToListMap, pixelSize, ome))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
480
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
481 // add annotation nodes
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
482 ome.setStructuredAnnotations(annotations)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
483
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
484 return ome
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
485 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
486
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
487 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
488 * create an image xml-element, populated with annotations, channel, pixels and path elements
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
489 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
490 * @param index image ID
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
491 * @param imageName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
492 * @param keyValues
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
493 * @param pixelSize
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
494 * @return an image xml-element
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
495 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
496 def makeImage(int index, ImagePlus imagePlus, List<MapPair> keyValues, double pixelSize) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
497 // Create <Image/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
498 Image image = new Image()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
499 image.setID("Image:" + index)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
500 // The image name is the name of the file without extension
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
501 image.setName(((String)imagePlus.getProperty(FILE_NAME)).split("\\.")[0])
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
502 // Set the acquisitionDate:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
503 if (imagePlus.getProperty(FIRST_ACQUISITION_DATE) != "NA") {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
504 image.setAcquisitionDate(new Timestamp(imagePlus.getProperty(FIRST_ACQUISITION_DATE) + "T" + imagePlus.getProperty(FIRST_ACQUISITION_TIME)))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
505 // Also add it to the key values:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
506 keyValues.add(new MapPair("acquisition.day", (String)imagePlus.getProperty(FIRST_ACQUISITION_DATE)))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
507 keyValues.add(new MapPair("acquisition.time", (String)imagePlus.getProperty(FIRST_ACQUISITION_TIME)))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
508 keyValues.add(new MapPair("relative.acquisition.hours", (String)imagePlus.getProperty(RELATIVE_ACQUISITION_HOUR)))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
509 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
510 // Create <MapAnnotations/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
511 MapAnnotation mapAnnotation = new MapAnnotation()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
512 mapAnnotation.setID("ImageKeyValueAnnotation:" + index)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
513 mapAnnotation.setNamespace(GENERAL_ANNOTATION_NAMESPACE)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
514 mapAnnotation.setValue(keyValues)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
515 annotations.addMapAnnotation(mapAnnotation); // add the KeyValues to the general structured annotation element
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
516 image.linkAnnotation(mapAnnotation)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
517
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
518 // Create <Pixels/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
519 Pixels pixels = new Pixels()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
520 pixels.setID("Pixels:" + index)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
521 pixels.setSizeX(new PositiveInteger(imagePlus.getWidth()))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
522 pixels.setSizeY(new PositiveInteger(imagePlus.getHeight()))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
523 pixels.setSizeZ(new PositiveInteger(imagePlus.getNSlices()))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
524 pixels.setSizeC(new PositiveInteger(imagePlus.getNChannels()))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
525 pixels.setSizeT(new PositiveInteger(imagePlus.getNFrames()))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
526 pixels.setDimensionOrder((DimensionOrder) imagePlus.getProperty(DIMENSION_ORDER))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
527 pixels.setType(getPixelType(imagePlus))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
528 pixels.setPhysicalSizeX(new Length(pixelSize, UNITS.MICROMETER))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
529 pixels.setPhysicalSizeY(new Length(pixelSize, UNITS.MICROMETER))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
530
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
531 // Create <TiffData/> under <Pixels/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
532 TiffData tiffData = new TiffData()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
533 tiffData.setFirstC(new NonNegativeInteger(0))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
534 tiffData.setFirstT(new NonNegativeInteger(0))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
535 tiffData.setFirstZ(new NonNegativeInteger(0))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
536 tiffData.setPlaneCount(new NonNegativeInteger(imagePlus.getNSlices()*imagePlus.getNChannels()*imagePlus.getNFrames()))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
537
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
538 // Create <UUID/> under <TiffData/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
539 UUID uuid = new UUID()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
540 uuid.setFileName((String)imagePlus.getProperty(FILE_NAME))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
541 uuid.setValue(java.util.UUID.randomUUID().toString())
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
542 tiffData.setUUID(uuid)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
543
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
544 // Put <TiffData/> under <Pixels/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
545 pixels.addTiffData(tiffData)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
546
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
547 // Create <Channel/> under <Pixels/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
548 LUT[] luts = imagePlus.getLuts()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
549 for (int i = 0; i < luts.length; i++) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
550 Channel channel = new Channel()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
551 channel.setID("Channel:" + i)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
552 channel.setColor(new Color(luts[i].getRed(255),luts[i].getGreen(255), luts[i].getBlue(255),255))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
553 pixels.addChannel(channel)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
554 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
555
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
556 // Put <Pixels/> under <Image/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
557 image.setPixels(pixels)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
558
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
559 return image
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
560 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
561
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
562
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
563 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
564 * get pixel type based on the imagePlus type
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
565 * @param imp
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
566 * @return pixel type
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
567 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
568 def getPixelType(ImagePlus imp){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
569 switch (imp.getType()) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
570 case ImagePlus.GRAY8:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
571 return PixelType.UINT8
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
572 case ImagePlus.GRAY16:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
573 return PixelType.UINT16
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
574 case ImagePlus.GRAY32:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
575 return PixelType.FLOAT
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
576 default:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
577 return PixelType.FLOAT
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
578 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
579 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
580
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
581 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
582 * create a Plate xml-element, populated with wells and their attributes
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
583 * @param imagesName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
584 * @return Plate xml-element
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
585 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
586 def makePlate(Map<String, List<ImagePlus>> wellToImagesMap, Map<String, Integer> imgPosInListMap, double pixelSize, OME ome) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
587 // Create <Plate/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
588 Plate plate = new Plate()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
589 plate.setName(PLATE_NAME)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
590 plate.setID(PLATE_ID)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
591 plate.setRows(WELL_ROWS)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
592 plate.setColumns(WELL_COLS)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
593 plate.setRowNamingConvention(WELL_ROW)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
594 plate.setColumnNamingConvention(WELL_COL)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
595
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
596 // for each image (one image per well)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
597 for (String wellId: wellToImagesMap.keySet()) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
598 // get well position from image name
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
599 List<ImagePlus> imagesWithinWell = wellToImagesMap.get(wellId)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
600
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
601 // get well position from image name
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
602 int row = convertLetterToNumber(wellId.substring(0, 1))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
603 int col = Integer.parseInt(wellId.substring(1)) - 1
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
604
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
605 // row and col should correspond to a real well
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
606 if(row >= 0 && col >= 0 && col < 12) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
607 // Create <Well/> under <Plate/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
608 Well well = new Well()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
609 well.setID(String.format("Well:%d_%d", row, col))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
610 well.setRow(new NonNegativeInteger(row))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
611 well.setColumn(new NonNegativeInteger(col))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
612
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
613 for (ImagePlus imagePlus : imagesWithinWell) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
614 int wellSampleIndex = imgPosInListMap.get(wellId + "_" + imagePlus.getProperty(IMG_POS_IN_WELL))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
615
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
616 // Create <WellSample/> under <Well/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
617 WellSample sample = new WellSample()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
618 sample.setID(String.format("WellSample:%d", wellSampleIndex))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
619 sample.setIndex(new NonNegativeInteger(wellSampleIndex))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
620 if (imagePlus.getCalibration() != null) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
621 sample.setPositionX(new Length(imagePlus.getCalibration().xOrigin * pixelSize, UNITS.MICROMETER))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
622 sample.setPositionY(new Length(imagePlus.getCalibration().yOrigin * pixelSize, UNITS.MICROMETER))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
623 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
624 sample.linkImage(ome.getImage(wellSampleIndex))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
625
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
626 // Put <WellSample/> under <Well/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
627 well.addWellSample(sample)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
628 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
629
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
630 // Put <Well/> under <Plate/>
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
631 plate.addWell(well)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
632 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
633 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
634 return plate
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
635 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
636
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
637 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
638 * convert the XML metadata document into string
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
639 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
640 * @param document
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
641 * @return
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
642 * @throws TransformerException
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
643 * @throws UnsupportedEncodingException
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
644 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
645 def asString(Document document) throws TransformerException, UnsupportedEncodingException {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
646 TransformerFactory transformerFactory = TransformerFactory.newInstance()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
647 Transformer transformer = transformerFactory.newTransformer()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
648
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
649 //Setup indenting to "pretty print"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
650 transformer.setOutputProperty(OutputKeys.INDENT, "yes")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
651 transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
652
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
653 Source source = new DOMSource(document)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
654 ByteArrayOutputStream os = new ByteArrayOutputStream()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
655 Result result = new StreamResult(new OutputStreamWriter(os, "utf-8"))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
656 transformer.transform(source, result)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
657
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
658 return os.toString()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
659 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
660
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
661 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
662 * add document header
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
663 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
664 * @param root
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
665 * @param document
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
666 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
667 def postProcess(Element root, Document document) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
668 root.setAttribute("xmlns", XML_NS)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
669 root.setAttribute("xmlns:xsi", XSI_NS)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
670 root.setAttribute("xsi:schemaLocation", XML_NS + " " + SCHEMA_LOCATION)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
671 root.setAttribute("UUID", java.util.UUID.randomUUID().toString())
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
672 document.appendChild(root)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
673 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
674
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
675
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
676 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
677 * read Incucyte plate-scheme XML file, extract attributes per well and convert attributes to OMERO-compatible
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
678 * keys-value pairs XML elements.
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
679 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
680 * @param path Incucyte plate-scheme XML file path
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
681 * @return Map of OME-XML compatible key-values per well
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
682 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
683 def parseIncucyteXML(String path, Boolean ignoreConcentration, Boolean ignorePassage, Boolean ignoreSeeding) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
684 Map<String, List<MapPair>> keyValuesPerWell = new HashMap<>()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
685
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
686 final String rowAttribute = "row"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
687 final String columnAttribute = "col"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
688
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
689 final String wellNode = "well"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
690 final String itemsNode = "items"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
691 final String wellItemNode = "wellItem"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
692 final String referenceItemNode = "referenceItem"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
693
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
694 // There are 3 types of referenceItem: Compound, CellType, GrowthCondition
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
695 //
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
696 // For the Compound, each well can have a concentration and a concentrationUnits
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
697 // the referenceItem has a displayName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
698 // The key should be: displayName (concentrationUnits)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
699 // The value should be: concentration
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
700 // However, if ignoreConcentration is set to true:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
701 // The key should be: displayName (NA)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
702 // The value should be: 1
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
703 //
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
704 // For the CellType, each well can have a passage, a seedingDensity and a seedingDensityUnits
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
705 // the referenceItem has a displayName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
706 // The passage key should be: displayName_passage
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
707 // The value should be: passage
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
708 // However, if ignorePassage is set to true no key value should be stored for this
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
709 // Then:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
710 // The seeding key should be: displayName_seedingDensity (seedingDensityUnits)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
711 // The value should be: seedingDensity
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
712 // However, if ignoreSeeding is set to true:
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
713 // The key should be: displayName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
714 // The value should be: "yes"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
715 //
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
716 // For the GrowthCondition, the referenceItem has a displayName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
717 // The key should be: displayName
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
718 // The value should be: "yes"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
719
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
720 try {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
721 // create an document
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
722 DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
723 DocumentBuilder dBuilder = dbFactory.newDocumentBuilder()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
724
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
725 // read the xml file
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
726 Document doc = dBuilder.parse(new File(path))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
727 doc.getDocumentElement().normalize()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
728
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
729 // get all "well" nodes
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
730 NodeList wellList = doc.getElementsByTagName(wellNode)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
731
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
732 for(int i = 0; i < wellList.getLength(); i++) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
733 Node well = wellList.item(i)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
734
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
735 // extract well attributes
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
736 String row = well.getAttributes().getNamedItem(rowAttribute).getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
737 int r = row as int
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
738 String col = well.getAttributes().getNamedItem(columnAttribute).getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
739 String wellNumber = LETTERS.substring(r, r + 1) + (Integer.parseInt(col)+ 1)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
740
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
741 // extract items node, under well node
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
742 Node items = ((Element)well).getElementsByTagName(itemsNode).item(0)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
743 if (items != null) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
744 // get all "wellItem" nodes, under items node
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
745 NodeList wellItemList = ((Element)items).getElementsByTagName(wellItemNode)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
746
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
747 // read referenceItem node's attributes and convert them into key-values
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
748 List<MapPair> keyValues = new ArrayList<>()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
749 for (int j = 0; j < wellItemList.getLength(); j++) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
750 Node wellItem = wellItemList.item(j)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
751 // extract referenceItem node, under wellItem node
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
752 Node referenceItem = ((Element)wellItem).getElementsByTagName(referenceItemNode).item(0)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
753 String wellType = wellItem.getAttributes().getNamedItem("type").getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
754
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
755 // select the right key-values
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
756 switch (wellType){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
757 case "Compound":
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
758 String compound_name = referenceItem.getAttributes().getNamedItem("displayName").getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
759 if (ignoreConcentration) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
760 keyValues.add(new MapPair(compound_name + " (NA)", "1"))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
761 } else {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
762 String unit = wellItem.getAttributes().getNamedItem("concentrationUnits").getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
763 unit = unit.replace("\u00B5", "u")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
764 String value = wellItem.getAttributes().getNamedItem("concentration").getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
765 keyValues.add(new MapPair(compound_name + " (" + unit + ")", value))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
766 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
767 break
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
768 case "CellType":
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
769 String cell_name = referenceItem.getAttributes().getNamedItem("displayName").getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
770 if (!ignorePassage) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
771 String passage = wellItem.getAttributes().getNamedItem("passage").getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
772 keyValues.add(new MapPair(cell_name + "_passage", passage))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
773 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
774 if (ignoreSeeding) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
775 keyValues.add(new MapPair(cell_name, "yes"))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
776 } else {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
777 String unit = wellItem.getAttributes().getNamedItem("seedingDensityUnits").getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
778 unit = unit.replace("\u00B5", "u")
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
779 String value = wellItem.getAttributes().getNamedItem("seedingDensity").getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
780 keyValues.add(new MapPair(cell_name + "_seedingDensity (" + unit + ")", value))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
781 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
782 break
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
783 case "GrowthCondition":
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
784 String growth_condition = referenceItem.getAttributes().getNamedItem("displayName").getTextContent()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
785 keyValues.add(new MapPair(growth_condition, "yes"))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
786 break
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
787 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
788 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
789 keyValuesPerWell.put(wellNumber,keyValues)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
790
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
791 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
792 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
793 return keyValuesPerWell
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
794 } catch (Exception e) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
795 println "XML platemap could not be parsed"
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
796 e.printStackTrace()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
797 return new HashMap<>()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
798 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
799 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
800
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
801 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
802 * make a list of all key-values that are common to all images
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
803 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
804 * @param objective
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
805 * @param commonKeyValues (a String with the following format: key1=value1;key2=value2)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
806 * @return a list of OME-XML key-values
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
807 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
808 def getGlobalKeyValues(int objective, String commonKeyValues){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
809 List<MapPair> keyValues = new ArrayList<>()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
810 keyValues.add(new MapPair("groovy_version", VERSION))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
811 keyValues.add(new MapPair("objective", objectives[objective]))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
812 if (commonKeyValues != "") {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
813 String[] keyValList = commonKeyValues.split(';')
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
814 for (int i = 0; i < keyValList.size(); i ++) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
815 String keyval = keyValList[i]
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
816 String[] keyvalsplit = keyval.split('=')
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
817 int nPieces = keyvalsplit.size()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
818 String value = keyvalsplit[nPieces - 1]
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
819 String key = keyvalsplit[0]
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
820 // In case there are '=' in key
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
821 for (int j = 1; j < nPieces - 1; j++) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
822 key += '=' + keyvalsplit[j]
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
823 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
824 keyValues.add(new MapPair(key, value))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
825 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
826 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
827 return keyValues
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
828 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
829
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
830 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
831 * convert alphanumeric well position to numeric position
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
832 *
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
833 * @param letter
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
834 * @return
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
835 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
836 def convertLetterToNumber(String letter){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
837 for (int i = 0; i < LETTERS.size(); i++) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
838 if (LETTERS.substring(i, i + 1) == letter) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
839 return i
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
840 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
841 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
842 return -1
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
843 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
844
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
845 // Returns a date from a label and a date_pattern
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
846 def getDate(String label, Pattern date_pattern){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
847 // println "Trying to get date from " + label
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
848 Matcher date_m = date_pattern.matcher(label)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
849 LocalDateTime dateTime
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
850 if (date_m.matches()) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
851 if (date_m.groupCount() == 5) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
852 dateTime = LocalDateTime.parse(date_m.group(1) + "-" + date_m.group(2) + "-" + date_m.group(3) + "T" + date_m.group(4) + ":" + date_m.group(5))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
853 } else {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
854 dateTime = LocalDateTime.parse("1970-01-" + 1 + (date_m.group(1) as int) + "T" + date_m.group(2) + ":" + date_m.group(3))
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
855 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
856 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
857 // println "Found " + dateTime
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
858 return dateTime
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
859 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
860
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
861 // Returns the number of hours
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
862 def getHoursFromImp(ImagePlus imp, ImageStack stack, LocalDateTime dateTime_ref, Pattern date_pattern){
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
863 int currentSlice = imp.getCurrentSlice()
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
864 String label = stack.getSliceLabel(currentSlice)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
865 LocalDateTime dateTime = getDate(label, date_pattern)
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
866 if (dateTime != null) {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
867 return ChronoUnit.HOURS.between(dateTime_ref, dateTime) as int
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
868 } else {
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
869 return -1
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
870 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
871 }
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
872
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
873
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
874 /**
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
875 * *****************************************************************************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
876 * ************************************************* Imports ****************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
877 * ****************************************************************************************************************
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
878 */
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
879
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
880
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
881 import ij.IJ
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
882 import ij.ImagePlus
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
883 import ij.ImageStack
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
884 import ij.io.FileSaver
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
885 import ij.io.Opener
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
886 import ij.plugin.Concatenator
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
887 import ij.plugin.FolderOpener
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
888 import ij.plugin.HyperStackConverter
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
889 import ij.process.LUT
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
890
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
891 import java.awt.GraphicsEnvironment
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
892 import java.io.File
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
893 import java.time.format.DateTimeFormatter
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
894 import java.time.LocalDateTime
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
895 import java.time.temporal.ChronoUnit
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
896 import java.util.stream.Collectors
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
897 import java.util.stream.IntStream
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
898 import java.util.regex.*
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
899
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
900 import javax.xml.parsers.DocumentBuilder
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
901 import javax.xml.parsers.DocumentBuilderFactory
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
902 import javax.xml.transform.OutputKeys
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
903 import javax.xml.transform.Result
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
904 import javax.xml.transform.Source
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
905 import javax.xml.transform.Transformer
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
906 import javax.xml.transform.TransformerException
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
907 import javax.xml.transform.TransformerFactory
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
908 import javax.xml.transform.dom.DOMSource
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
909 import javax.xml.transform.stream.StreamResult
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
910
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
911 import ome.units.UNITS
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
912 import ome.units.quantity.Length
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
913
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
914 import ome.xml.model.Channel
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
915 import ome.xml.model.Image
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
916 import ome.xml.model.MapAnnotation
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
917 import ome.xml.model.MapPair
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
918 import ome.xml.model.OME
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
919 import ome.xml.model.Pixels
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
920 import ome.xml.model.Plate
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
921 import ome.xml.model.StructuredAnnotations
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
922 import ome.xml.model.TiffData
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
923 import ome.xml.model.UUID
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
924 import ome.xml.model.Well
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
925 import ome.xml.model.WellSample
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
926 import ome.xml.model.enums.DimensionOrder
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
927 import ome.xml.model.enums.NamingConvention
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
928 import ome.xml.model.enums.PixelType
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
929 import ome.xml.model.primitives.Color
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
930 import ome.xml.model.primitives.NonNegativeInteger
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
931 import ome.xml.model.primitives.PositiveInteger
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
932 import ome.xml.model.primitives.Timestamp
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
933
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
934 import org.apache.commons.io.filefilter.WildcardFileFilter
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
935 import org.apache.commons.io.FilenameUtils
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
936
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
937 import org.w3c.dom.Document
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
938 import org.w3c.dom.Element
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
939 import org.w3c.dom.Node
e1cba36becb2 planemo upload for repository https://github.com/lldelisle/tools-lldelisle/tree/master/tools/incucyte_stack_and_upload_omero commit 4ac9b1d66ba6857357867c8eccb6c9d1ad603364
lldelisle
parents:
diff changeset
940 import org.w3c.dom.NodeList