-
Notifications
You must be signed in to change notification settings - Fork 39
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
[METEOR-1230][fix] store power correctly for each channel in metadata #2947
Open
patrickcleeve2
wants to merge
1
commit into
delmic:master
Choose a base branch
from
patrickcleeve2:meteor-1230-fix-multi-channel-md-power
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+45
−5
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -495,7 +495,23 @@ def _convertToOMEMD(images, multiple_files=False, findex=None, fname=None, uuids | |
description.text = da0.metadata[model.MD_HW_NOTE] | ||
|
||
# light source must come before detector for valid ome-xml | ||
if (model.MD_LIGHT_POWER in da0.metadata or | ||
# meteor multi-channel lightsource | ||
if model.MD_LIGHT_POWER in da0.metadata and ( | ||
model.MD_IN_WL in da0.metadata or model.MD_OUT_WL in da0.metadata | ||
): | ||
# TODO: what is the best way to check if image is meteor? | ||
# add a light source for each channel, as they can have different power | ||
for gdid, gr in enumerate(g): | ||
|
||
obj = ET.Element("LightEmittingDiode", | ||
attrib={"ID": "LightSource:%d" % gdid}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using just the gdid here is incorrect, as there can be several groups of zstacks. So, something like |
||
if model.MD_LIGHT_POWER in gr.metadata: | ||
pwr = gr.metadata[model.MD_LIGHT_POWER] * 1e3 # in mW | ||
obj.attrib["Power"] = "%.15f" % pwr | ||
obj.attrib["PowerUnit"] = "mW" | ||
light_sources.append(obj) | ||
|
||
elif (model.MD_LIGHT_POWER in da0.metadata or | ||
model.MD_EBEAM_CURRENT in da0.metadata or | ||
model.MD_EBEAM_CURRENT_TIME in da0.metadata | ||
): | ||
|
@@ -1611,7 +1627,12 @@ def _addImageElement(root, das, ifd, rois, fname=None, fuuid=None): | |
|
||
# TODO: non-standard metadata, treat it differently for different detectors | ||
cot = da.metadata.get(model.MD_EBEAM_CURRENT_TIME) | ||
if attrib or cot or model.MD_LIGHT_POWER in da.metadata: | ||
|
||
# support light source per channel (meteor) | ||
if not (attrib and cot) and model.MD_LIGHT_POWER in da.metadata: | ||
attrib["ID"] = "LightSource:%d" % subid | ||
ds = ET.SubElement(chan, "LightSourceSettings", attrib=attrib) | ||
elif attrib or cot or model.MD_LIGHT_POWER in da.metadata: | ||
attrib["ID"] = "LightSource:%d" % ifd | ||
ds = ET.SubElement(chan, "LightSourceSettings", attrib=attrib) | ||
# This is a non-standard metadata, it defines the emitter, which | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can further improve this test by having 2 Z stacks, with something like:
It fails due to the LightSource ID being incorrect, as you can see in the TIFF metadata: