Skip to content

Commit

Permalink
Add support for per-series channel wavelength specification
Browse files Browse the repository at this point in the history
  • Loading branch information
sbesson committed Feb 7, 2025
1 parent 0f47e17 commit e74143d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
12 changes: 12 additions & 0 deletions components/formats-bsd/src/loci/formats/in/FakeReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,18 @@ private void parseSeriesTable(IniTable table, MetadataStore store, int newSeries
for (int c=0; c<getEffectiveSizeC(); c++) {
String channelName = table.get("ChannelName_" + c);
store.setChannelName(channelName, newSeries, c);
String emissionWavelength = table.get("ChannelEmissionWavelength_" + c);
if (emissionWavelength != null) {
store.setChannelEmissionWavelength(
parseWavelength(emissionWavelength, getEmissionWavelengthUnitXsdDefault()),
newSeries, c);
}
String excitationWavelength = table.get("ChannelExcitationWavelength_" + c);
if (excitationWavelength != null) {
store.setChannelExcitationWavelength(
parseWavelength(excitationWavelength, getExcitationWavelengthUnitXsdDefault()),
newSeries, c);
}
}

for (int i=0; i<getImageCount(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,33 @@ public void testEmissionWavelengths() throws Exception {
reader.close();
}

@Test
public void testWavelengthSeries() throws Exception {
File fakeIni = mkIni("multiseries_wavelengths.fake.ini",
"series=2",
"sizeC=2",
"[series_0]",
"ChannelExcitationWavelength_0=340.0nm",
"ChannelEmissionWavelength_0=450.0nm",
"ChannelExcitationWavelength_1=470.0nm",
"ChannelEmissionWavelength_1=512.0nm",
"[series_1]",
"ChannelExcitationWavelength_0=350.0nm",
"ChannelEmissionWavelength_0=425.0nm",
"ChannelExcitationWavelength_1=500.0nm",
"ChannelEmissionWavelength_1=580.0nm");
reader.setId(fakeIni.getAbsolutePath());
m = service.asRetrieve(reader.getMetadataStore());
assertEquals(m.getChannelExcitationWavelength(0, 0), new Length(340.0, UNITS.NANOMETER));
assertEquals(m.getChannelEmissionWavelength(0, 0), new Length(450.0, UNITS.NANOMETER));
assertEquals(m.getChannelExcitationWavelength(0, 1), new Length(470.0, UNITS.NANOMETER));
assertEquals(m.getChannelEmissionWavelength(0, 1), new Length(512.0, UNITS.NANOMETER));
assertEquals(m.getChannelExcitationWavelength(1, 0), new Length(350.0, UNITS.NANOMETER));
assertEquals(m.getChannelEmissionWavelength(1, 0), new Length(425.0, UNITS.NANOMETER));
assertEquals(m.getChannelExcitationWavelength(1, 1), new Length(500.0, UNITS.NANOMETER));
assertEquals(m.getChannelEmissionWavelength(1, 1), new Length(580.0, UNITS.NANOMETER));
}

@Test
public void testInstrument() throws Exception {
reader.setId("test&withInstrument=true.fake");
Expand Down

0 comments on commit e74143d

Please sign in to comment.