Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
fslpy
Commits
b9f8ddb3
Commit
b9f8ddb3
authored
9 months ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
MNT: np.array(a, copy=False) raises an error in numpy 2 if the array cannot be copied
parent
37be45ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
fsl/data/bitmap.py
+1
-1
1 addition, 1 deletion
fsl/data/bitmap.py
fsl/transform/affine.py
+2
-2
2 additions, 2 deletions
fsl/transform/affine.py
fsl/utils/image/resample.py
+1
-1
1 addition, 1 deletion
fsl/utils/image/resample.py
fsl/utils/memoize.py
+2
-2
2 additions, 2 deletions
fsl/utils/memoize.py
with
6 additions
and
6 deletions
fsl/data/bitmap.py
+
1
−
1
View file @
b9f8ddb3
...
...
@@ -179,7 +179,7 @@ class Bitmap(object):
for
ci
,
ch
in
enumerate
(
dtype
.
names
):
data
[
ch
]
=
self
.
data
[...,
ci
]
data
=
np
.
array
(
data
,
order
=
'
F
'
,
copy
=
False
)
data
=
np
.
as
array
(
data
,
order
=
'
F
'
)
return
fslimage
.
Image
(
data
,
name
=
self
.
name
,
...
...
This diff is collapsed.
Click to expand it.
fsl/transform/affine.py
+
2
−
2
View file @
b9f8ddb3
...
...
@@ -62,7 +62,7 @@ def veclength(vec):
Multiple vectors may be passed in, with a shape of ``(n, 3)``.
"""
vec
=
np
.
array
(
vec
,
copy
=
False
).
reshape
(
-
1
,
3
)
vec
=
np
.
as
array
(
vec
).
reshape
(
-
1
,
3
)
return
np
.
sqrt
(
np
.
einsum
(
'
ij,ij->i
'
,
vec
,
vec
))
...
...
@@ -71,7 +71,7 @@ def normalise(vec):
Multiple vectors may be passed in, with a shape of ``(n, 3)``.
"""
vec
=
np
.
array
(
vec
,
copy
=
False
).
reshape
(
-
1
,
3
)
vec
=
np
.
as
array
(
vec
).
reshape
(
-
1
,
3
)
n
=
(
vec
.
T
/
veclength
(
vec
)).
T
if
n
.
size
==
3
:
...
...
This diff is collapsed.
Click to expand it.
fsl/utils/image/resample.py
+
1
−
1
View file @
b9f8ddb3
...
...
@@ -190,7 +190,7 @@ def resample(image,
if
origin
not
in
(
'
centre
'
,
'
corner
'
):
raise
ValueError
(
'
Invalid value for origin: {}
'
.
format
(
origin
))
data
=
np
.
array
(
image
[
sliceobj
],
dtype
=
dtype
,
copy
=
False
)
data
=
np
.
as
array
(
image
[
sliceobj
],
dtype
=
dtype
)
if
len
(
data
.
shape
)
!=
len
(
newShape
):
raise
ValueError
(
'
Data dimensions do not match new shape:
'
...
...
This diff is collapsed.
Click to expand it.
fsl/utils/memoize.py
+
2
−
2
View file @
b9f8ddb3
...
...
@@ -242,8 +242,8 @@ def skipUnchanged(func):
isarray
=
oldIsArray
or
newIsArray
if
isarray
:
a
=
np
.
array
(
oldVal
,
copy
=
False
)
b
=
np
.
array
(
value
,
copy
=
False
)
a
=
np
.
as
array
(
oldVal
)
b
=
np
.
as
array
(
value
)
nochange
=
(
a
.
shape
==
b
.
shape
)
and
np
.
allclose
(
a
,
b
)
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment