`BSplineFieldTransform` ignores `order`
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start in nitransforms/nonlinear.py at BSplineFieldTransform, which stores order but evaluates cubic regardless; trace where map builds the spline coefficients and where the interpolation order is actually passed (likely scipy.ndimage.map_coordinates/spline_filter). Read the toy reproduction in the issue first and run it to confirm cubic and quartic agree today. Done means the evaluation honours odd orders, even orders raise a clear error, and existing cubic behaviour and tests still pass.
Written by the indexing model from the issue text.
Description
BSplineFieldTransform stores order but always evaluates a cubic spline. order only enters __eq__, so transforms that map every point the same way compare unequal. An unsupported order should raise rather than fall back to cubic.
Really, we should error on even values and support odd values. TIL that even-ordered splines are a thing. I've only ever seen odd, but NdBSpline appears to support even orders.
Reproduction
import nibabel as nb
import numpy as np
from nitransforms.nonlinear import BSplineFieldTransform
rng = np.random.default_rng(0)
coeffs = nb.Nifti1Image(rng.normal(size=(10, 10, 10, 3)).astype("float32"), np.eye(4))
cubic = BSplineFieldTransform(coeffs)
quartic = BSplineFieldTransform(coeffs, order=4)
points = rng.uniform(2, 7, size=(5, 3))
assert cubic != quartic
assert not np.allclose(cubic.map(points), quartic.map(points))
- Dominant language
- Python
- Stars
- 36
- Forks
- 18
- Avg merge
- 1h 24m
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nipy/nitransforms
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nipy/nitransforms#307 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nipy/nitransforms#306 ·
-
Difficulty 3/5 Half a day Newbie friendliness 25/100
nipy/nitransforms#305 ·
-
`BSplineFieldTransform.to_field()` reuses the weights of its first referencePossibly taken @effigies claimed this 1 day ago. Open
Difficulty 3/5 Half a day Newbie friendliness 55/100
nipy/nitransforms#301 ·
-
`BSplineFieldTransform.to_field()` ignores the orientation of the reference gridPossibly taken @effigies claimed this 1 day ago. Open
Difficulty 3/5 Half a day Newbie friendliness 45/100
nipy/nitransforms#300 ·
All issues in nipy/nitransforms
Similar issues
-
eegprep-lean: set channel types from the Zarr group's channel_typePossibly taken @claude claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
sccn/eegprep#668 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
blacklanternsecurity/bbot#3679 ·
Maintainers usually reply within 2 days
-
Link Checker ReportOpenBot Type: Bug Type: Documentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
speakeasy-api/speakeasy#2159 ·
Maintainers usually reply within 1 day