Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

bugfix/incorrect-ome-tiff-dim-order#24

Merged
evamaxfield merged 6 commits into
masterfrom
bugfix/incorrect-ome-tiff-dim-order
Oct 14, 2019
Merged

bugfix/incorrect-ome-tiff-dim-order#24
evamaxfield merged 6 commits into
masterfrom
bugfix/incorrect-ome-tiff-dim-order

Conversation

@evamaxfield

@evamaxfield evamaxfield commented Oct 11, 2019

Copy link
Copy Markdown
Collaborator

Pull request recommendations:

  • Name your pull request your-development-type/short-description. Ex: feature/read-tiff-files
  • Link to any relevant issue in the PR description. Ex: Resolves [Fix release #12], adds tiff file format support
  • Provide context of changes.
    • Adds a known_dims kwarg to the AICSImage object to allow explicit override of dimension ordering. The data is still reshaped to the standard STCZYX.
    • Fixes the problem found by @donovanr of the OmeTiffReader not using the parsed metadata to properly return available dimensions and dimension ordering.
  • Provide relevant tests for your feature or bug fix.
    • The only unfortunate thing was that I added a 15 MB image to the resources directory to properly test that the ome-tiff reader was fixed. Could probably reduce this but 🤷‍♀.
  • Provide or update documentation for any feature added by your pull request.

Thanks for contributing!

@evamaxfield evamaxfield added bug Something isn't working enhancement New feature or request labels Oct 11, 2019
@evamaxfield evamaxfield self-assigned this Oct 11, 2019
@codecov-io

codecov-io commented Oct 11, 2019

Copy link
Copy Markdown

Codecov Report

Merging #24 into master will increase coverage by 0.26%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #24      +/-   ##
==========================================
+ Coverage   86.96%   87.23%   +0.26%     
==========================================
  Files          27       27              
  Lines        1036     1042       +6     
==========================================
+ Hits          901      909       +8     
+ Misses        135      133       -2
Impacted Files Coverage Δ
aicsimageio/aics_image.py 97.77% <100%> (+0.05%) ⬆️
aicsimageio/readers/ome_tiff_reader.py 88.15% <100%> (ø) ⬆️
aicsimageio/tests/test_aics_image.py 100% <100%> (ø) ⬆️
aicsimageio/tests/readers/test_ome_tiff_reader.py 93.54% <100%> (+0.44%) ⬆️
aicsimageio/transforms.py 91.11% <0%> (+4.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e505d4d...2db3c09. Read the comment docs.

@AetherUnbound AetherUnbound left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple minor logic things, but looks good! 👍

Comment thread aicsimageio/aics_image.py Outdated
"""

# Hold onto known dims until data is requested
if known_dims:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since known_dims is None by default anyway, can't this just be self._known_dims?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart!

Comment thread aicsimageio/aics_image.py Outdated
Comment on lines +132 to +135
if self._known_dims:
pass_dims = self._known_dims
else:
pass_dims = self.reader.dims

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionally: (this could also be done below on L139)

Suggested change
if self._known_dims:
pass_dims = self._known_dims
else:
pass_dims = self.reader.dims
pass_dims = self._known_dims or self.reader.dims

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's enough to make me think it should be named override_dims instead of known_dims :)

dimension_order = dimension_order.replace("Z", "")
if self.size_z() < 2:
dimension_order = dimension_order.replace("Z", "")
if self.size_c() < 2:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhhh, subtle!

(np.zeros((10, 20)), "XY", (1, 1, 1, 1, 20, 10)),
pytest.param(np.zeros((2, 2, 2)), "ABI", None, marks=pytest.mark.raises(exception=TypeError))
])
def test_known_dims(data, dims, expected_shape):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Freaking love pytest.mark.parametrize

if self.size_c() < 2:
dimension_order = dimension_order.replace("Z", "")
if self.size_z() < 2:
dimension_order = dimension_order.replace("Z", "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I C Z BUG!!

@evamaxfield evamaxfield force-pushed the bugfix/incorrect-ome-tiff-dim-order branch from 4c09fc7 to 2db3c09 Compare October 11, 2019 19:18
@evamaxfield evamaxfield merged commit 429da13 into master Oct 14, 2019
@evamaxfield evamaxfield deleted the bugfix/incorrect-ome-tiff-dim-order branch October 14, 2019 16:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix OME-Tiff metadata parsing to actually use dims Allow passing of "known_dims" to AICSImage objects

4 participants