Skip to content

ENH add types for Database and transforms - #667

Draft
kroq-gar78 wants to merge 39 commits into
types/02-py23-cleanupfrom
types/01-03-04-infra-geometry-database
Draft

ENH add types for Database and transforms#667
kroq-gar78 wants to merge 39 commits into
types/02-py23-cleanupfrom
types/01-03-04-infra-geometry-database

Conversation

@kroq-gar78

@kroq-gar78 kroq-gar78 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

This PR adds type annotations to the subject surface database and associated transforms. It should have no behavioral changes.

It does make an assumption that the transform is a Nifti1 image. I can loosen that restriction: https://github.com/gallantlab/pycortex/pull/667/changes#diff-4df9c9b662d253d17cbbbbec9abe960e9ff277d48207bf98134266747f260cc8R42


Stack created with GitHub Stacks CLIGive Feedback 💬

Extracted from 6a91478; the dataset/view2D.py and dataset/viewRGB.py
hunks from that same original commit belong with the Dataset hierarchy
PR instead.
Extracted from e2bc651; the dataset/braindata.py hunk from that same
original commit belongs with the Dataset hierarchy PR instead.
Extracted from 7a1fb69; the dataset/braindata.py, dataset/viewRGB.py,
and webgl/data.py hunks from that same original commit belong with the
Dataset hierarchy and webgl PRs instead.
…ypy Wave 3)

scipy.ndimage.interpolation.affine_transform is a deprecated shim typed
as returning `object`, which mypy then can't follow through `.T`.
Import from scipy.ndimage instead, and narrow anat2epispace's `order`
param to the Literal[0..5] scipy actually accepts.
…d711d8b

Extracted from fd711d8b; the dataset/braindata.py and utils.py hunks
from that same original commit belong with the Dataset hierarchy and
utils PRs instead. The database.py hunk is deferred to later in this
branch's history, at the point in PR 4's own commit sequence where it
originally landed (item 17 of 22).
Extracted from fffcb00; the svgoverlay.py hunk from that same
original commit belongs with the svgoverlay PR instead.
Extracted from 4b97b45; the dataset/views.py hunk from that same
original commit belongs with the Dataset hierarchy PR instead.
Extracted from 137d9e7; the export/save_views.py, mapper/patch.py,
mapper/point.py, polyutils/misc.py, webgl/serve.py, and webgl/view.py
hunks from that same original commit belong with their respective PRs
instead.
Extracted from 410454d; the brainctm.py hunk from that same original
commit belongs with the CTM/webgl PR instead.
Extracted from fd711d8b (see also the earlier xfm/align commit in this
branch, which added Transform.reference_nifti itself); the
dataset/braindata.py and utils.py hunks from that same original commit
belong with the Dataset hierarchy and utils PRs instead.
Extracted from 245d95ff; the sha1(str) crash fix from this same
original commit moved to PR 0 and is deliberately not included here.
Keeps the Literal narrowing on get_anat's order / get_surf's hemi, the
cast() to Nifti1Image, and the targeted type: ignore comments on the
self.auxfile fallback pattern.
@kroq-gar78 kroq-gar78 changed the title ENH add types for Database and Transform ENH add types for Database and transforms Aug 13, 2026
Also fixes a string type bug, and type overloading for Dataset.get_surf

Ported from 9abb080 (types-data branch) / bb81c50a (types-easy).
@kroq-gar78
kroq-gar78 force-pushed the types/01-03-04-infra-geometry-database branch from 5b3496d to 4556e6d Compare August 18, 2026 08:25
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