Skip to content

Commit

Permalink
Merge pull request #4112 from melissalinkert/imaris-hdf-channel-name
Browse files Browse the repository at this point in the history
Imaris HDF: populate channel names
  • Loading branch information
sbesson authored Dec 20, 2023
2 parents d566f70 + 2c444d1 commit 404da56
Showing 1 changed file with 40 additions and 9 deletions.
49 changes: 40 additions & 9 deletions components/formats-gpl/src/loci/formats/in/ImarisHDFReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ protected void initFile(String id) throws FormatException, IOException {
(int) (color[2] * 255), 255);
store.setChannelColor(realColor, s, i);
}
if (i < channelName.size()) {
store.setChannelName(channelName.get(i), s, i);
}
}
}
setSeries(0);
Expand Down Expand Up @@ -552,26 +555,54 @@ else if (name.equals("RecordingEntryPlaneSpacing")) {

while (cIndex >= getSizeC()) ms0.sizeC++;

if (name.equals("Gain")) gain.add(value);
else if (name.equals("LSMEmissionWavelength")) emWave.add(value);
else if (name.equals("LSMExcitationWavelength")) exWave.add(value);
else if (name.equals("Max")) channelMax.add(value);
else if (name.equals("Min")) channelMin.add(value);
else if (name.equals("Pinhole")) pinhole.add(value);
else if (name.equals("Name")) channelName.add(value);
else if (name.equals("MicroscopyMode")) microscopyMode.add(value);
if (name.equals("Gain")) {
addValue(gain, value, cIndex);
}
else if (name.equals("LSMEmissionWavelength")) {
addValue(emWave, value, cIndex);
}
else if (name.equals("LSMExcitationWavelength")) {
addValue(exWave, value, cIndex);
}
else if (name.equals("Max")) {
addValue(channelMax, value, cIndex);
}
else if (name.equals("Min")) {
addValue(channelMin, value, cIndex);
}
else if (name.equals("Pinhole")) {
addValue(pinhole, value, cIndex);
}
else if (name.equals("Name")) {
addValue(channelName, originalValue, cIndex);
}
else if (name.equals("MicroscopyMode")) {
addValue(microscopyMode, value, cIndex);
}
else if (name.equals("Color")) {
double[] color = new double[3];
String[] intensity = originalValue.split(" ");
for (int i=0; i<intensity.length; i++) {
color[i] = Double.parseDouble(intensity[i]);
}
colors.add(color);
addValue(colors, color, cIndex);
}
}

if (value != null) addGlobalMeta(name, value);
}
}

private void addValue(List l, Object value, int index) {
if (index < l.size()) {
l.set(index, value);
}
else {
while (index > l.size()) {
l.add(null);
}
l.add(value);
}
}

}

0 comments on commit 404da56

Please sign in to comment.