Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix get time when big names or single time point #14

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<tool id="incucyte_stack_and_upload_omero" name="Stack Incucyte Plate" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="20.01" license="BSD-3">
<description>And upload to omero</description>
<macros>
<token name="@TOOL_VERSION@">20231219</token>
<token name="@TOOL_VERSION@">20231221</token>
<token name="@VERSION_SUFFIX@">0</token>
</macros>
<requirements>
Expand Down
21 changes: 13 additions & 8 deletions tools/incucyte_stack_and_upload_omero/stack_buildXml.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* and Lucille Delisle, EPFL - SV - UPDUB
* and Pierre Osteil, EPFL - SV - UPDUB
*
* Last modification: 2023-12-19
* Last modification: 2023-12-21
*
* = COPYRIGHT =
* © All rights reserved. ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, BioImaging And Optics Platform (BIOP), 2023
Expand Down Expand Up @@ -120,7 +120,7 @@ RELATIVE_ACQUISITION_HOUR = "relative_acquisition_hour"
LETTERS = new String("ABCDEFGHIJKLMNOP")

// Version number = date of last modif
VERSION = "20231219"
VERSION = "20231221"

/** Key-Value pairs namespace */
GENERAL_ANNOTATION_NAMESPACE = "openmicroscopy.org/omero/client/mapAnnotation"
Expand Down Expand Up @@ -322,13 +322,15 @@ def process_well(baseDir, input_wellId, n_image_per_well){ //, perform_bc, media
first_image_infos = Opener.getTiffFileInfo(files_matching[0].getAbsolutePath())
// We define the imageplus object
ImagePlus single_channel_imp
ImageStack stack
if (first_image_infos == null) {
// They are raw from incucyte
// We need to open images one by one and add them to the stack
ImageStack stack = new ImageStack(first_imp.width, first_imp.height);
stack = new ImageStack(first_imp.width, first_imp.height);
files_matching.each{
ImagePlus single_imp = (new Opener()).openUsingBioFormats(it.getAbsolutePath())
String new_title = single_imp.getTitle().split(" - ")[0]
String new_title = it.getName()
// println "Title of slice: " + new_title
stack.addSlice(new_title, single_imp.getProcessor())
}
single_channel_imp = new ImagePlus(FilenameUtils.getBaseName(folder_list.get(i).getAbsolutePath()), stack);
Expand All @@ -340,15 +342,18 @@ def process_well(baseDir, input_wellId, n_image_per_well){ //, perform_bc, media
// Phase are 8-bit and need to be changed to 16-bit
// Other are already 16-bit but it does not hurt
IJ.run(single_channel_imp, "16-bit", "")

// check frame size
if (nT == 0) {
// This is the first channel with images
nT = single_channel_imp.getNSlices()
first_channel = channels_list.get(i)
// Process all dates:
Pattern date_pattern = Pattern.compile(REGEX_FOR_DATE)
ImageStack stack = single_channel_imp.getStack()
// The IJ.run 16-bit seems to remove the name of the stack
// When there is only one stack
if (nT !=1 || stack == null) {
stack = single_channel_imp.getStack()
}
// Go to the first time (which is slice)
single_channel_imp.setSlice(1)
int currentSlice = single_channel_imp.getCurrentSlice()
Expand Down Expand Up @@ -844,7 +849,7 @@ def convertLetterToNumber(String letter){

// Returns a date from a label and a date_pattern
def getDate(String label, Pattern date_pattern){
// println "Trying to get date from " + label
// println "Trying to get date from " + label
Matcher date_m = date_pattern.matcher(label)
LocalDateTime dateTime
if (date_m.matches()) {
Expand All @@ -854,7 +859,7 @@ def getDate(String label, Pattern date_pattern){
dateTime = LocalDateTime.parse("1970-01-" + 1 + (date_m.group(1) as int) + "T" + date_m.group(2) + ":" + date_m.group(3))
}
}
// println "Found " + dateTime
// println "Found " + dateTime
return dateTime
}

Expand Down
Loading