Skip to content

add PimsMrcReader#1465

Draft
normanrz wants to merge 2 commits into
masterfrom
mrc-reader
Draft

add PimsMrcReader#1465
normanrz wants to merge 2 commits into
masterfrom
mrc-reader

Conversation

@normanrz
Copy link
Copy Markdown
Member

Description:

  • abc

Issues:

  • fixes #...

Todos:

Make sure to delete unnecessary points or to check all before merging:

  • Updated Changelog
  • Updated Documentation
  • Added / Updated Tests
  • Considered adding this to the Examples

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for MRC file formats by adding the mrcfile dependency and implementing a new PimsMrcReader class. The implementation includes tests for basic functionality and ensures compatibility with multiprocessing by reopening files for each frame. Feedback was provided regarding the current use of mrcfile.mmap, which may fail when handling remote paths (e.g., S3) since it expects a local filesystem path.

self.path = UPath(path)

# Open once to read metadata only, then close immediately.
with mrcfile.mmap(str(self.path), mode="r", permissive=True) as mrc:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using str(self.path) with mrcfile.mmap will fail if self.path is a remote UPath (e.g., s3://...), as mrcfile.mmap requires a local filesystem path. Since webknossos frequently works with remote storage, consider checking if the path is local. For remote paths, you should use mrcfile.open with a file-like object obtained via self.path.open("rb"), although this will not support memory mapping.

@github-actions
Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
11475 9709 85% 80% 🟢

New Files

File Coverage Status
webknossos/webknossos/dataset/_utils/pims_mrc_reader.py 80% 🟢
TOTAL 80% 🟢

Modified Files

File Coverage Status
webknossos/webknossos/dataset/_utils/pims_images.py 83% 🟢
TOTAL 83% 🟢

updated for commit: bfc3cb3 by action🐍

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.

1 participant