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

CZI: fix image naming, especially for attachments #4141

Merged
merged 2 commits into from
Jan 19, 2024
Merged
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
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