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

Reworking LMSMetadata package and adding a new lif reader #4000

Open
wants to merge 94 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
a7874d0
LOFReader: #3818 LOF file error; [Fatal Error] :1:1: Content is not a…
XLEFReaderForBioformats Jan 2, 2023
d27015b
LIFReader: #3655 Incorrect channel colours, adding LIFReader2 which u…
XLEFReaderForBioformats Jan 4, 2023
16486c8
LMS metadata package: started rework of metadata translation
XLEFReaderForBioformats Jan 17, 2023
39af6a1
Merge remote-tracking branch 'upstream/develop' into xlefreader
XLEFReaderForBioformats Jan 17, 2023
20575a4
LMS metadata package: reworking stand details, objective, lasers, det…
XLEFReaderForBioformats Jan 20, 2023
84784a9
LMS metadata package: mapping of detector information from LDM block …
XLEFReaderForBioformats Jan 23, 2023
8e2eae0
LMS metadata package: mapping multiband / filter info from sequential…
XLEFReaderForBioformats Jan 24, 2023
7fa742c
LMS metadata package: formatting, author/copyright
XLEFReaderForBioformats Jan 24, 2023
755eb2a
rename LIFReader2, LMS metadata package: setting up new structure / a…
XLEFReaderForBioformats Jan 25, 2023
b2589fd
LMS metadata package: reworking channel and dimension metadata handling
XLEFReaderForBioformats Jan 26, 2023
5ee1b3a
LMSMetadataPackage: setting up usage of new classes
XLEFReaderForBioformats Jan 26, 2023
ab87d87
LMS metadata package: moving channel, dimension and position related …
XLEFReaderForBioformats Jan 27, 2023
0b7d202
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats Feb 13, 2023
aa5419e
LMSMetadata package: i.a. fixing filter and laser settings and physic…
XLEFReaderForBioformats Feb 13, 2023
390c359
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats Feb 14, 2023
9bfcea7
LMSMetadata package: detector read out rate, laser channel mapping d…
XLEFReaderForBioformats Feb 14, 2023
d2b1c74
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats Feb 14, 2023
94f5da0
LMS metadata package: removing LMSMetadataExtractor, MetadataStoreIni…
XLEFReaderForBioformats Feb 17, 2023
27182f8
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats Feb 22, 2023
0861cd5
LMSMetadata package: ignoring laser settings with intensitydev=0
XLEFReaderForBioformats Feb 22, 2023
2cd0510
LMSMetadata package: bugfix swapXY
XLEFReaderForBioformats Feb 22, 2023
e692e55
LMSMetadata package: fixing physical z sizes / positions
XLEFReaderForBioformats Feb 28, 2023
3385a23
LMSMetadata package: renaming Translator
XLEFReaderForBioformats Feb 28, 2023
d475982
LMSMetadata package: bugfix Z positions
XLEFReaderForBioformats Mar 1, 2023
9a5866a
LMSMetadata package: bugfixes for LIF XML image nodes finding, empty …
XLEFReaderForBioformats Mar 3, 2023
f7eadbb
LMSMetadata package: refactoring channel priorities / lut color index
XLEFReaderForBioformats Mar 6, 2023
dbed0d5
LMSMetadata package: bugfix z position extraction and z position per …
XLEFReaderForBioformats Mar 20, 2023
710e8da
LMSMetadataPackage: also allow basic metadata translation of SP5 images
XLEFReaderForBioformats Apr 27, 2023
e65427c
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats Apr 27, 2023
668b77e
LMSMetadataPackage: translate filters and exposure times for sequenti…
XLEFReaderForBioformats May 2, 2023
7de6ebe
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats May 2, 2023
210bf56
LMSMetadataPackage: adding (doc) comments
XLEFReaderForBioformats May 3, 2023
7cb2e2d
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats May 3, 2023
6ea8198
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats May 4, 2023
8a23660
Reverting temporary changes to LIFReader.isThisType(...) for testing
XLEFReaderForBioformats May 4, 2023
8a5f235
reverting mapping from .lif files to LMSLIFReader instead of LIFReader
XLEFReaderForBioformats May 4, 2023
97c25c9
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats Jan 22, 2024
1e773e2
temporarily deactivating LIFReader for LMSLifReader testing
XLEFReaderForBioformats Jan 24, 2024
cc2ce7f
fixing bugs: handling images without hardware settings attachment, wr…
XLEFReaderForBioformats Jan 24, 2024
f78233c
refactoring: 1 folder for core / OME metadata writers
XLEFReaderForBioformats Jan 24, 2024
8b7a2ad
refactoring: missing package reference adjustments
XLEFReaderForBioformats Jan 24, 2024
951588b
fix xml parsing sequential camera settings
XLEFReaderForBioformats Jan 24, 2024
4056876
LMSLIFReader, LOFReader: accessing inverse rgb for correct image (for…
XLEFReaderForBioformats Jan 26, 2024
a57dfb9
supporting MICA confocal, widefield and widefocal images
XLEFReaderForBioformats Jan 31, 2024
352f549
further adjustments for support of MICA CS/WF/WFO images
XLEFReaderForBioformats Jan 31, 2024
9e1d0d1
fixing bug in timestamp extraction
XLEFReaderForBioformats Feb 5, 2024
268bf4f
supporting different hardware setting setups, adding dye information …
XLEFReaderForBioformats Feb 6, 2024
570c716
reworking handling of hardware setting layouts varying with different…
XLEFReaderForBioformats Feb 9, 2024
035946a
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats Feb 9, 2024
47afe80
fixing bug in detector settings translation
XLEFReaderForBioformats Feb 9, 2024
1ae0e6e
adjusting translation of detectors and detector settings, also writi…
XLEFReaderForBioformats Feb 12, 2024
901d1b3
reworking filter (set) creation, using channel > lightpath > emission…
XLEFReaderForBioformats Feb 13, 2024
8b3c4be
major rework of instrument / channel settings translation
XLEFReaderForBioformats Feb 21, 2024
fffb6b4
remove unused imports
XLEFReaderForBioformats Feb 21, 2024
59a7d02
fix bug in widefield images (main camera setting not set)
XLEFReaderForBioformats Feb 21, 2024
0927e28
regarding lasers which are not coupled to AOTFs, shutters, light sour…
XLEFReaderForBioformats Feb 22, 2024
c054667
major refactoring of SingleImageTranslator to prepare separate calls …
XLEFReaderForBioformats Feb 23, 2024
9ff6cdc
core and store metadata are now correctly written for image tiles
XLEFReaderForBioformats Feb 26, 2024
62d6962
fixing timestamp / plane deltaT bug: is now correctly translated
XLEFReaderForBioformats Feb 26, 2024
c19fb6d
adding collection path to image name (LIF and XLEF)
XLEFReaderForBioformats Feb 27, 2024
84ee004
fix build
XLEFReaderForBioformats Feb 27, 2024
515b212
bugfix: widefield atl setting empty
XLEFReaderForBioformats Feb 27, 2024
1a93dbc
adding translation of objective correction
XLEFReaderForBioformats Feb 27, 2024
3abcb0d
avoiding crash for SP5 images without LDM block / atl settings
XLEFReaderForBioformats Feb 27, 2024
1043971
fixing laser isActive logic
XLEFReaderForBioformats Feb 28, 2024
5494b4c
fixing bug: crash on unformatted objective name
XLEFReaderForBioformats Feb 29, 2024
2955318
getting data source type for SP5 images without atl settings
XLEFReaderForBioformats Feb 29, 2024
e50969f
adding lasers for SP5 images without ATL settings
XLEFReaderForBioformats Feb 29, 2024
f1be021
getting instrument detectors for SP5 images without atl settings
XLEFReaderForBioformats Feb 29, 2024
73be214
adding immersion and correction lookup functions from objective name …
XLEFReaderForBioformats Mar 4, 2024
a5c1d1e
confocal settings extraction: major rework to support reading from ei…
XLEFReaderForBioformats Mar 4, 2024
f266ab8
refactoring folders / names
XLEFReaderForBioformats Mar 5, 2024
9f96fea
adding channel settings with lasers for SP5 images, support of MP las…
XLEFReaderForBioformats Mar 5, 2024
bb2494e
SP5 images without atl settings: mapping detectors to detector settings
XLEFReaderForBioformats Mar 5, 2024
d02d6db
adapting shutter check
XLEFReaderForBioformats Mar 5, 2024
35a804a
parsing shutter info from confocal setting records
XLEFReaderForBioformats Mar 11, 2024
c0d2c38
getting correct detector / filter names for SP5 images with and witho…
XLEFReaderForBioformats Mar 11, 2024
04b2d0a
adding objective from confocal setting records
XLEFReaderForBioformats Mar 11, 2024
06542f2
creating LIFDelegateReader so usage of LIFReader and LMSLIFReader can…
XLEFReaderForBioformats Mar 12, 2024
fb01a07
correct plane deltaTs and xy positions for RGB images
XLEFReaderForBioformats Mar 12, 2024
57b4544
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats Mar 12, 2024
8d12cda
class javadoc + copyright comments
XLEFReaderForBioformats Mar 13, 2024
ad8d8d6
rename folder, name might be confusing
XLEFReaderForBioformats Mar 13, 2024
0f7ede5
correct references
XLEFReaderForBioformats Mar 13, 2024
cca1703
increasing robustness against missing / unexpected data, preventing e…
XLEFReaderForBioformats Mar 14, 2024
bac07f8
using posZ attribute in tile scan info, if available
XLEFReaderForBioformats Mar 25, 2024
9e40086
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats Mar 25, 2024
47cbf13
bugfix: in LIF files containing "invalid" memory blocks (e.g. "frame …
XLEFReaderForBioformats Mar 26, 2024
dee599e
fixing mapping of WLLs to laser line settings
XLEFReaderForBioformats Apr 3, 2024
32147d2
translating Z range / position for SP5 images without ATL settings
XLEFReaderForBioformats Apr 10, 2024
dfaf67f
bug fix zEnd calculation
XLEFReaderForBioformats Apr 10, 2024
53a7a99
Merge branch 'ome:develop' into xlefreader
XLEFReaderForBioformats Oct 28, 2024
d3e5abf
fixing IndexOutOfBoundsException in LMSLIFReader.initFile()
XLEFReaderForBioformats Oct 28, 2024
105fd8a
fixing NullPointerException in ConfocalSettingsFromSettingRecordsExtr…
XLEFReaderForBioformats Oct 28, 2024
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
Prev Previous commit
Next Next commit
LMS metadata package: reworking stand details, objective, lasers, det…
…ectors and filters translation
  • Loading branch information
XLEFReaderForBioformats committed Jan 20, 2023
commit 20575a418fc34ffd07e7d4443b4a749280981d0a
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ public enum ChannelType {

public ChannelType channelType;


public Length cutIn;
public Length cutOut;
public String dye;
public Detector detector;
public Laser laser;
public Filter filter;
public String name;

// -- Constructor --
public Channel(int channelTag, int resolution, double min, double max, String unit,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package loci.formats.in.LeicaMicrosystemsMetadata;

public class Detector {
public String detectorId;
public String model;
public String type;
public double gain;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* #%L
* OME Bio-Formats package for reading and converting biological file formats.
* %%
* Copyright (C) 2005 - 2017 Open Microscopy Environment:
* - Board of Regents of the University of Wisconsin-Madison
* - Glencoe Software, Inc.
* - University of Dundee
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/

package loci.formats.in.LeicaMicrosystemsMetadata;

public class Filter {
public String filterSetId;
public double cutIn;
public double cutOut;
}
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,14 @@ public void translateScannerSettings(Element imageNode, int image)
continue;
}

if (id.equals("SystemType")) {
r.metaTemp.microscopeModels[image] = value;
}
else if (id.equals("dblPinhole")) {
// if (id.equals("SystemType")) {
// r.metaTemp.microscopeModels[image] = value;
// }
if (id.equals("dblPinhole")) {
r.metaTemp.pinholes[image] = DataTools.parseDouble(value.trim()) * METER_MULTIPLY;
}
else if (id.equals("dblZoom")) {
r.metaTemp.zooms[image] = DataTools.parseDouble(value.trim());
// r.metaTemp.zooms[image] = DataTools.parseDouble(value.trim());
}
else if (id.equals("dblStepSize")) {
r.metaTemp.zSteps[image] = DataTools.parseDouble(value.trim()) * METER_MULTIPLY;
Expand All @@ -493,7 +493,7 @@ else if (id.equals("nDelayTime_s")) {
r.metaTemp.tSteps[image] = DataTools.parseDouble(value.trim());
}
else if (id.equals("CameraName")) {
r.metaTemp.detectorModels.get(image).add(value);
// r.metaTemp.detectorModels.get(image).add(value);
}
else if (id.equals("eDirectional")) {
r.addSeriesMeta("Reverse X orientation", "1".equals(value.trim()));
Expand Down Expand Up @@ -549,14 +549,14 @@ else if ((id.endsWith("UesrDefName") || id.endsWith("UserDefName")) &&

value = confocalSetting.getAttribute("Zoom");

if (value != null && !value.trim().isEmpty()) {
r.metaTemp.zooms[image] = DataTools.parseDouble(value.trim());
}
// if (value != null && !value.trim().isEmpty()) {
// r.metaTemp.zooms[image] = DataTools.parseDouble(value.trim());
// }

value = confocalSetting.getAttribute("ObjectiveName");

if (value != null && !value.trim().isEmpty()) {
r.metaTemp.objectiveModels[image] = value.trim();
// r.metaTemp.objectiveModels[image] = value.trim();
}

value = confocalSetting.getAttribute("FlipX");
Expand Down Expand Up @@ -612,16 +612,16 @@ public void translateFilterSettings(Element imageNode, int image)
}
}
else if (attribute.equals("OrderNumber")) {
if (variant != null && !variant.trim().isEmpty()) {
r.metaTemp.serialNumber[image] = variant.trim();
}
// if (variant != null && !variant.trim().isEmpty()) {
// r.metaTemp.serialNumber[image] = variant.trim();
// }
}
else if (objectClass.equals("CDetectionUnit")) {
if (attribute.equals("State")) {
int channel = getChannelIndex(filterSetting);
if (channel < 0) continue;

r.metaTemp.detectorIndexes.get(image).put(Integer.parseInt(data), object);
// r.metaTemp.detectorIndexes.get(image).put(Integer.parseInt(data), object);
r.metaTemp.activeDetector.get(image).add("Active".equals(variant.trim()));
}
}
Expand All @@ -642,7 +642,7 @@ else if (attribute.equals("Objective")) {
}
na = token.substring(0, x);
if (na != null && !na.trim().isEmpty()) {
r.metaTemp.magnification[image] = DataTools.parseDouble(na.trim());
// r.metaTemp.magnification[image] = DataTools.parseDouble(na.trim());
}
}
else {
Expand All @@ -658,7 +658,7 @@ else if (attribute.equals("Objective")) {
immersion = "Other";
}
}
r.metaTemp.immersions[image] = immersion;
// r.metaTemp.immersions[image] = immersion;

String correction = "Other";
if (tokens.hasMoreTokens()) {
Expand All @@ -669,7 +669,7 @@ else if (attribute.equals("Objective")) {
}
r.metaTemp.corrections[image] = correction;

r.metaTemp.objectiveModels[image] = model.toString().trim();
// r.metaTemp.objectiveModels[image] = model.toString().trim();
}
else if (attribute.equals("RefractionIndex")) {
if (variant != null && !variant.trim().isEmpty()) {
Expand Down Expand Up @@ -1076,7 +1076,7 @@ private void translatePhysicalChannelInfo(Element imageNode, int image) {
if (definition == null)
return;

// add multiband cutin/out information to channel
// add multiband cutin/out information to channel as filter
Node spectro = getChildNodeWithName(definition, "Spectro");
NodeList multibands = spectro.getChildNodes();
for (int i = 0; i < multibands.getLength(); i++) {
Expand All @@ -1086,24 +1086,17 @@ private void translatePhysicalChannelInfo(Element imageNode, int image) {
} catch (Exception e){
continue;
}
int channelIndex = Integer.parseInt(multiband.getAttribute("Channel"));
int channelIndex = Integer.parseInt(multiband.getAttribute("Channel")) - 1;
if (channelIndex >= r.metaTemp.channels.get(image).size())
continue;

Double cutIn = DataTools.parseDouble(multiband.getAttribute("LeftWorld"));
Double cutOut = DataTools.parseDouble(multiband.getAttribute("RightWorld"));
if (cutIn != null && cutIn.intValue() > 0) {
Length in = FormatTools.getCutIn((double) Math.round(cutIn));
if (in != null) {
r.metaTemp.channels.get(image).get(channelIndex).cutIn = in;
}
}
if (cutOut != null && cutOut.intValue() > 0) {
Length out = FormatTools.getCutOut((double) Math.round(cutOut));
if (out != null) {
r.metaTemp.channels.get(image).get(channelIndex).cutOut = out;
}
}
Filter filter = new Filter();
filter.cutIn = DataTools.parseDouble(multiband.getAttribute("LeftWorld"));
filter.cutOut = DataTools.parseDouble(multiband.getAttribute("RightWorld"));

r.metaTemp.filters.get(image).add(filter);
r.metaTemp.channels.get(image).get(channelIndex).filter = filter;

String dye = multiband.getAttribute("DyeName");
r.metaTemp.channels.get(image).get(channelIndex).dye = dye;
}
Expand Down Expand Up @@ -1145,55 +1138,62 @@ private void printNode(Node node){
* @throws FormatException
*/
public void translateDetectors(Element imageNode, int image)
throws FormatException {
if (hardwareSetting == null)
return;

Node definition = getChildNodeWithName(hardwareSetting, "ATLConfocalSettingDefinition");
if (definition == null)
return;

String zoomS = getAttributeValue(definition, "Zoom");
double zoom = parseDouble(zoomS);

// create detectors from detector list
Node detectorList = getChildNodeWithName(definition, "DetectorList");
NodeList detectors = detectorList.getChildNodes();
for (int i = 0; i < detectors.getLength(); i++) {
Element detectorNode;
try {
detectorNode = (Element) detectors.item(i);
} catch (Exception e){
continue;
}
throws FormatException {
if (hardwareSetting == null)
return;

String gainS = detectorNode.getAttribute("Gain");
double gain = parseDouble(gainS.trim());
Node definition = getChildNodeWithName(hardwareSetting, "ATLConfocalSettingDefinition");
if (definition == null)
return;

String offsetS = detectorNode.getAttribute("Offset");
double offset = parseDouble(offsetS.trim());
String zoomS = getAttributeValue(definition, "Zoom");
double zoom = parseDouble(zoomS);

// create detectors from detector list
Node detectorList = getChildNodeWithName(definition, "DetectorList");
NodeList detectors = detectorList.getChildNodes();
for (int i = 0; i < detectors.getLength(); i++) {
Element detectorNode;
try {
detectorNode = (Element) detectors.item(i);
} catch (Exception e){
continue;
}

String isActiveS = detectorNode.getAttribute("IsActive");
boolean isActive = "1".equals(isActiveS);
String gainS = detectorNode.getAttribute("Gain");
double gain = parseDouble(gainS.trim());

String channelS = detectorNode.getAttribute("Channel");
int channelIndex = parseInt(channelS);
String offsetS = detectorNode.getAttribute("Offset");
double offset = parseDouble(offsetS.trim());

Detector detector = new Detector();
detector.gain = gain;
detector.offset = offset;
detector.isActive = isActive;
detector.channel = channelIndex;
detector.model = detectorNode.getAttribute("Name");
detector.type = detectorNode.getAttribute("Type");
detector.zoom = zoom;
String isActiveS = detectorNode.getAttribute("IsActive");
boolean isActive = "1".equals(isActiveS);

r.metaTemp.detectors.get(image).add(detector);
String channelS = detectorNode.getAttribute("Channel");
int channelIndex = parseInt(channelS) - 1;
//for channel references such as "100": using the less secure assumption that detectors and their mapped channels are listed in the same order
if (channelIndex >= r.metaTemp.channels.get(image).size())
channelIndex = r.metaTemp.detectors.get(image).size();

if (channelIndex < r.metaTemp.channels.get(image).size()){
r.metaTemp.channels.get(image).get(channelIndex).detector = detector;
}
String channelName = detectorNode.getAttribute("ChannelName");

Detector detector = new Detector();
detector.gain = gain;
detector.offset = offset;
detector.isActive = isActive;
detector.channel = channelIndex;
detector.model = detectorNode.getAttribute("Name");
detector.type = detectorNode.getAttribute("Type");
detector.zoom = zoom;

r.metaTemp.detectors.get(image).add(detector);

//link detector and channel information
if (channelIndex < r.metaTemp.channels.get(image).size() && detector.isActive){
r.metaTemp.channels.get(image).get(channelIndex).detector = detector;
r.metaTemp.channels.get(image).get(channelIndex).name = channelName;
}
}
}

/**
Expand Down Expand Up @@ -1233,9 +1233,9 @@ private void translateDetectors2(Element imageNode, int image)
String c = detector.getAttribute("Channel");
int channel = (c == null || c.trim().length() == 0) ? 0 : Integer.parseInt(c);
if (active) {
if (r.metaTemp.detectorIndexes.get(image) != null && r.metaTemp.detectorModels.get(image) != null) {
r.metaTemp.detectorModels.get(image).add(r.metaTemp.detectorIndexes.get(image).get(channel));
}
// if (r.metaTemp.detectorIndexes.get(image) != null && r.metaTemp.detectorModels.get(image) != null) {
// r.metaTemp.detectorModels.get(image).add(r.metaTemp.detectorIndexes.get(image).get(channel));
// }

Element multiband = null;

Expand Down
Loading