|
2 | 2 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
|
3 | 3 | # vi: set ft=python sts=4 ts=4 sw=4 et:
|
4 | 4 |
|
5 |
| -import numpy as np |
6 |
| -import nibabel as nb |
7 |
| - |
8 | 5 | from ..utils.filemanip import fname_presuffix
|
9 | 6 | from .base import (SimpleInterface, TraitedSpec, BaseInterfaceInputSpec,
|
10 | 7 | traits, File)
|
@@ -63,6 +60,9 @@ class Rescale(SimpleInterface):
|
63 | 60 | output_spec = RescaleOutputSpec
|
64 | 61 |
|
65 | 62 | def _run_interface(self, runtime):
|
| 63 | + import numpy as np |
| 64 | + import nibabel as nb |
| 65 | + |
66 | 66 | img = nb.load(self.inputs.in_file)
|
67 | 67 | data = img.get_data()
|
68 | 68 | ref_data = nb.load(self.inputs.ref_file).get_data()
|
@@ -171,6 +171,8 @@ class Reorient(SimpleInterface):
|
171 | 171 | output_spec = ReorientOutputSpec
|
172 | 172 |
|
173 | 173 | def _run_interface(self, runtime):
|
| 174 | + import numpy as np |
| 175 | + import nibabel as nb |
174 | 176 | from nibabel.orientations import (
|
175 | 177 | axcodes2ornt, ornt_transform, inv_ornt_aff)
|
176 | 178 |
|
@@ -211,6 +213,8 @@ def _run_interface(self, runtime):
|
211 | 213 |
|
212 | 214 | def _as_reoriented_backport(img, ornt):
|
213 | 215 | """Backport of img.as_reoriented as of nibabel 2.2.0"""
|
| 216 | + import numpy as np |
| 217 | + import nibabel as nb |
214 | 218 | from nibabel.orientations import inv_ornt_aff
|
215 | 219 | if np.array_equal(ornt, [[0, 1], [1, 1], [2, 1]]):
|
216 | 220 | return img
|
|
0 commit comments