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

MCD: calculate channel count based on metadata, not pixel bytes #255

Merged

Conversation

melissalinkert
Copy link
Member

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.

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.
Copy link
Member

@chris-allan chris-allan left a 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);
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link

@mabruce mabruce left a 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.

@melissalinkert melissalinkert merged commit 78f5929 into glencoesoftware:master Aug 7, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants