-
Notifications
You must be signed in to change notification settings - Fork 35
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
MCD: calculate channel count based on metadata, not pixel bytes #255
MCD: calculate channel count based on metadata, not pixel bytes #255
Conversation
In some cases, the number of pixel bytes stored for a particular acquisition may not match the expected number of bytes, so calculating the channel count based on the stored number of pixel bytes will cause problems. Instead of throwing an exception, this sets the channel count to the number of channels linked to the acquisition, and logs that some image data may be blank. This more closely matches the behavior of MCDViewer (the vendor software).
This prevents incorrect data from being read when the number of stored pixel bytes is smaller than expected.
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.
Code changes look sound. One question, shouldn't affect this PRs mergeability.
for (int c=0; c<channels.size(); c++) { | ||
Channel channel = channels.get(c); | ||
if (channel.acqID == acq.id) { | ||
acq.channelIndexes[channel.index] = c; | ||
while (channel.index >= acq.channelIndexes.size()) { | ||
acq.channelIndexes.add(-1); |
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.
Is this meant to signify anything different than null
? Are we checking this value anywhere?
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.
That will get checked in line 291/292. If null
is preferable, it would be easy enough to rework that check.
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.
A ha, gotcha. No, that's fine.
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.
No errors seen after these changes, and resulting output after raw2ometiff appears to match what can be seen with MCDViewer.
In some cases, the number of pixel bytes stored for a particular acquisition may not match the expected number of bytes, so calculating the channel count based on the stored number of pixel bytes will cause problems.
Instead of throwing an exception, this sets the channel count to the number of channels linked to the acquisition, and logs that some image data may be blank. This more closely matches the behavior of MCDViewer (the vendor software).
I have checked a few older datasets that do not exhibit the missing pixel bytes problem and have found no difference in behavior with this change, but that should be double-checked in addition to testing the broken file.
Adding @mabruce for functional review and @chris-allan for code review, but can reassign if time runs out this week.
As mentioned separately, #253 is the only thing merged since 0.9.3, so we should be OK to do a 0.9.4 as soon as this is merged.