Skip to content

Commit

Permalink
fix: replace all remaining xfm.apply() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed May 20, 2024
1 parent 19f82d9 commit 5241f99
Show file tree
Hide file tree
Showing 3 changed files with 5,072 additions and 18 deletions.
11 changes: 6 additions & 5 deletions docs/notebooks/Reading and Writing transforms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"import numpy as np\n",
"import nibabel as nb\n",
"import nitransforms as nt\n",
"from nitransforms.resampling import apply\n",
"\n",
"cwd = TemporaryDirectory()\n",
"os.chdir(cwd.name)\n",
Expand Down Expand Up @@ -263,7 +264,7 @@
"metadata": {},
"outputs": [],
"source": [
"moved = xfm.apply(nii, order=0)\n",
"moved = apply(xfm, nii, order=0)\n",
"moved.to_filename('moved-nb.nii.gz')"
]
},
Expand Down Expand Up @@ -741,7 +742,7 @@
"outputs": [],
"source": [
"xfm.reference = oblique\n",
"moved_oblique = xfm.apply(las_anatomy)"
"moved_oblique = apply(xfm, las_anatomy)"
]
},
{
Expand Down Expand Up @@ -895,7 +896,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -909,9 +910,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.11.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
5,073 changes: 5,063 additions & 10 deletions docs/notebooks/isbi2020.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions nitransforms/tests/test_nonlinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def test_displacements_field1(
exit_code = check_call([cmd], shell=True)
assert exit_code == 0
sw_moved_mask = nb.load("resampled_brainmask.nii.gz")
nt_moved_mask = xfm.apply(msk, order=0)
nt_moved_mask = apply(xfm, msk, order=0)
nt_moved_mask.set_data_dtype(msk.get_data_dtype())
diff = np.asanyarray(sw_moved_mask.dataobj) - np.asanyarray(nt_moved_mask.dataobj)

Expand All @@ -189,7 +189,7 @@ def test_displacements_field1(
assert exit_code == 0
sw_moved = nb.load("resampled.nii.gz")

nt_moved = xfm.apply(nii, order=0)
nt_moved = apply(xfm, nii, order=0)
nt_moved.set_data_dtype(nii.get_data_dtype())
nt_moved.to_filename("nt_resampled.nii.gz")
sw_moved.set_data_dtype(nt_moved.get_data_dtype())
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_displacements_field2(tmp_path, testdata_path, sw_tool):
assert exit_code == 0
sw_moved = nb.load("resampled.nii.gz")

nt_moved = xfm.apply(img_fname, order=0)
nt_moved = apply(xfm, img_fname, order=0)
nt_moved.to_filename("nt_resampled.nii.gz")
sw_moved.set_data_dtype(nt_moved.get_data_dtype())
diff = np.asanyarray(
Expand Down

0 comments on commit 5241f99

Please sign in to comment.