Skip to content

Commit

Permalink
Merge pull request #4141 from melissalinkert/gh-4103
Browse files Browse the repository at this point in the history
CZI: fix image naming, especially for attachments
  • Loading branch information
dgault authored Jan 19, 2024
2 parents 077ed12 + 53cdef0 commit 40dbbfd
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions components/formats-gpl/src/loci/formats/in/ZeissCZIReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1406,14 +1406,9 @@ else if (positions == 1) {
}
}
}
else if (extraIndex == 0) {
store.setImageName("label image", i);
}
else if (extraIndex == 1) {
store.setImageName("macro image", i);
}
else {
store.setImageName("thumbnail image", i);
else if (extraIndex >= 0 && extraIndex < extraImages.size()) {
AttachmentEntry entry = extraImages.get(extraIndex).attachment;
store.setImageName(entry.getNormalizedName(), i);
}

// remaining acquisition settings (esp. channels) do not apply to
Expand Down Expand Up @@ -3392,7 +3387,8 @@ private void translateExperiment(Element root) throws FormatException {
platePositions.add(value);
}
String name = well.getAttribute("Name");
for (int f=0; f<well.getElementsByTagName("SingleTileRegion").getLength(); f++) {
int tileRegionCount = (int) Math.max(1, well.getElementsByTagName("SingleTileRegion").getLength());
for (int f=0; f<tileRegionCount; f++) {
imageNames.add(name);
}
}
Expand Down Expand Up @@ -4556,6 +4552,20 @@ public String toString() {
", filePart = " + filePart + ", contentGUID = " + contentGUID +
", contentFileType = " + contentFileType;
}

public String getNormalizedName() {
if (name == null) {
return "";
}
String n = name.trim();
if (n.toLowerCase().startsWith("label")) {
return "label image";
}
else if (n.toLowerCase().startsWith("slidepreview")) {
return "macro image";
}
return n;
}
}

static class Channel {
Expand Down

0 comments on commit 40dbbfd

Please sign in to comment.