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
482a1290
Commit
482a1290
authored
6 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
RF: Image.ndims renamed to Image.ndim. New Image.data property - easy way to
get image data as numpy array.
parent
0ee48df0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/data/image.py
+21
-2
21 additions, 2 deletions
fsl/data/image.py
fsl/data/melodicimage.py
+1
-1
1 addition, 1 deletion
fsl/data/melodicimage.py
with
22 additions
and
3 deletions
fsl/data/image.py
+
21
−
2
View file @
482a1290
...
...
@@ -490,8 +490,7 @@ class Nifti(notifier.Notifier, meta.Meta):
return
fileslice
.
canonical_slicers
(
sliceobj
,
self
.
__origShape
)
@property
def
ndims
(
self
):
def
ndim
(
self
):
"""
Returns the number of dimensions in this image. This number may not
match the number of dimensions specified in the NIFTI header, as
trailing dimensions of length 1 are ignored. But it is guaranteed to be
...
...
@@ -500,6 +499,15 @@ class Nifti(notifier.Notifier, meta.Meta):
return
len
(
self
.
__shape
)
@property
@deprecation.deprecated
(
deprecated_in
=
'
1.9.0
'
,
removed_in
=
'
2.0.0
'
,
details
=
'
Use ndim instead
'
)
def
ndims
(
self
):
"""
Deprecated - use :mod::meth:``ndim`` instead.
"""
return
self
.
ndim
()
@deprecation.deprecated
(
deprecated_in
=
'
1.1.0
'
,
removed_in
=
'
2.0.0
'
,
details
=
'
Use ndims instead
'
)
...
...
@@ -1006,6 +1014,17 @@ class Image(Nifti):
return
self
.
__nibImage
@property
def
data
(
self
):
"""
Returns the image data as a ``numpy`` array.
.. warning:: Calling this method will cause the entire image to be
loaded into memory.
"""
self
.
__imageWrapper
.
loadData
()
return
self
[:]
@property
def
saveState
(
self
):
"""
Returns ``True`` if this ``Image`` has been saved to disk, ``False``
...
...
This diff is collapsed.
Click to expand it.
fsl/data/melodicimage.py
+
1
−
1
View file @
482a1290
...
...
@@ -77,7 +77,7 @@ class MelodicImage(fslimage.Image):
dataImage
=
fslimage
.
Image
(
dataFile
,
loadData
=
False
,
calcRange
=
False
)
if
dataImage
.
ndim
s
>=
4
:
if
dataImage
.
ndim
>=
4
:
self
.
__tr
=
dataImage
.
pixdim
[
3
]
...
...
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