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
6e51658e
Commit
6e51658e
authored
3 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
MNT: Mark ImageWrapper as deprecated
parent
980c89e5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/imagewrapper.py
+27
-0
27 additions, 0 deletions
fsl/data/imagewrapper.py
with
27 additions
and
0 deletions
fsl/data/imagewrapper.py
+
27
−
0
View file @
6e51658e
...
@@ -7,6 +7,9 @@
...
@@ -7,6 +7,9 @@
"""
This module provides the :class:`ImageWrapper` class, which can be used
"""
This module provides the :class:`ImageWrapper` class, which can be used
to manage data access to ``nibabel`` NIFTI images.
to manage data access to ``nibabel`` NIFTI images.
.. note:: This module is deprecated - it is being moved to the FSLeyes project,
and will be removed in a future version of fslpy.
Terminology
Terminology
-----------
-----------
...
@@ -45,6 +48,8 @@ import itertools as it
...
@@ -45,6 +48,8 @@ import itertools as it
import
numpy
as
np
import
numpy
as
np
import
nibabel
as
nib
import
nibabel
as
nib
import
fsl.utils.deprecated
as
deprecated
import
fsl.utils.notifier
as
notifier
import
fsl.utils.notifier
as
notifier
import
fsl.utils.naninfrange
as
nir
import
fsl.utils.naninfrange
as
nir
import
fsl.utils.idle
as
idle
import
fsl.utils.idle
as
idle
...
@@ -148,6 +153,8 @@ class ImageWrapper(notifier.Notifier):
...
@@ -148,6 +153,8 @@ class ImageWrapper(notifier.Notifier):
"""
"""
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The ImageWrapper has been migrated to FSLeyes
'
)
def
__init__
(
self
,
def
__init__
(
self
,
image
,
image
,
name
=
None
,
name
=
None
,
...
@@ -725,6 +732,8 @@ class ImageWrapper(notifier.Notifier):
...
@@ -725,6 +732,8 @@ class ImageWrapper(notifier.Notifier):
self
.
__updateDataRangeOnWrite
(
slices
,
values
)
self
.
__updateDataRangeOnWrite
(
slices
,
values
)
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The imagewrapper module been migrated to FSLeyes
'
)
def
isValidFancySliceObj
(
sliceobj
,
shape
):
def
isValidFancySliceObj
(
sliceobj
,
shape
):
"""
Returns ``True`` if the given ``sliceobj`` is a valid and fancy slice
"""
Returns ``True`` if the given ``sliceobj`` is a valid and fancy slice
object.
object.
...
@@ -745,6 +754,8 @@ def isValidFancySliceObj(sliceobj, shape):
...
@@ -745,6 +754,8 @@ def isValidFancySliceObj(sliceobj, shape):
np
.
prod
(
sliceobj
.
shape
)
==
np
.
prod
(
shape
))
np
.
prod
(
sliceobj
.
shape
)
==
np
.
prod
(
shape
))
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The imagewrapper module been migrated to FSLeyes
'
)
def
canonicalSliceObj
(
sliceobj
,
shape
):
def
canonicalSliceObj
(
sliceobj
,
shape
):
"""
Returns a canonical version of the given ``sliceobj``. See the
"""
Returns a canonical version of the given ``sliceobj``. See the
``nibabel.fileslice.canonical_slicers`` function.
``nibabel.fileslice.canonical_slicers`` function.
...
@@ -766,6 +777,8 @@ def canonicalSliceObj(sliceobj, shape):
...
@@ -766,6 +777,8 @@ def canonicalSliceObj(sliceobj, shape):
return
nib
.
fileslice
.
canonical_slicers
(
sliceobj
,
shape
)
return
nib
.
fileslice
.
canonical_slicers
(
sliceobj
,
shape
)
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The imagewrapper module been migrated to FSLeyes
'
)
def
expectedShape
(
sliceobj
,
shape
):
def
expectedShape
(
sliceobj
,
shape
):
"""
Given a slice object, and the shape of an array to which
"""
Given a slice object, and the shape of an array to which
that slice object is going to be applied, returns the expected
that slice object is going to be applied, returns the expected
...
@@ -821,6 +834,8 @@ def expectedShape(sliceobj, shape):
...
@@ -821,6 +834,8 @@ def expectedShape(sliceobj, shape):
return
len
(
expShape
),
expShape
return
len
(
expShape
),
expShape
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The imagewrapper module been migrated to FSLeyes
'
)
def
sliceObjToSliceTuple
(
sliceobj
,
shape
):
def
sliceObjToSliceTuple
(
sliceobj
,
shape
):
"""
Turns an array slice object into a tuple of (low, high) index
"""
Turns an array slice object into a tuple of (low, high) index
pairs, one pair for each dimension in the given shape
pairs, one pair for each dimension in the given shape
...
@@ -861,6 +876,8 @@ def sliceObjToSliceTuple(sliceobj, shape):
...
@@ -861,6 +876,8 @@ def sliceObjToSliceTuple(sliceobj, shape):
return
tuple
(
indices
)
return
tuple
(
indices
)
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The imagewrapper module been migrated to FSLeyes
'
)
def
sliceTupleToSliceObj
(
slices
):
def
sliceTupleToSliceObj
(
slices
):
"""
Turns a sequence of (low, high) index pairs into a tuple of array
"""
Turns a sequence of (low, high) index pairs into a tuple of array
``slice`` objects.
``slice`` objects.
...
@@ -876,6 +893,8 @@ def sliceTupleToSliceObj(slices):
...
@@ -876,6 +893,8 @@ def sliceTupleToSliceObj(slices):
return
tuple
(
sliceobj
)
return
tuple
(
sliceobj
)
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The imagewrapper module been migrated to FSLeyes
'
)
def
adjustCoverage
(
oldCoverage
,
slices
):
def
adjustCoverage
(
oldCoverage
,
slices
):
"""
Adjusts/expands the given ``oldCoverage`` so that it covers the
"""
Adjusts/expands the given ``oldCoverage`` so that it covers the
given set of ``slices``.
given set of ``slices``.
...
@@ -924,6 +943,8 @@ return code for the :func:`sliceOverlap` function.
...
@@ -924,6 +943,8 @@ return code for the :func:`sliceOverlap` function.
"""
"""
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The imagewrapper module been migrated to FSLeyes
'
)
def
sliceOverlap
(
slices
,
coverage
):
def
sliceOverlap
(
slices
,
coverage
):
"""
Determines whether the given ``slices`` overlap with the given
"""
Determines whether the given ``slices`` overlap with the given
``coverage``.
``coverage``.
...
@@ -991,6 +1012,8 @@ def sliceOverlap(slices, coverage):
...
@@ -991,6 +1012,8 @@ def sliceOverlap(slices, coverage):
elif
np
.
all
(
overlapStates
==
OVERLAP_ALL
):
return
OVERLAP_ALL
elif
np
.
all
(
overlapStates
==
OVERLAP_ALL
):
return
OVERLAP_ALL
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The imagewrapper module been migrated to FSLeyes
'
)
def
sliceCovered
(
slices
,
coverage
):
def
sliceCovered
(
slices
,
coverage
):
"""
Returns ``True`` if the portion of the image data calculated by
"""
Returns ``True`` if the portion of the image data calculated by
the given ``slices` has already been calculated, ``False`` otherwise.
the given ``slices` has already been calculated, ``False`` otherwise.
...
@@ -1023,6 +1046,8 @@ def sliceCovered(slices, coverage):
...
@@ -1023,6 +1046,8 @@ def sliceCovered(slices, coverage):
return
True
return
True
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The imagewrapper module been migrated to FSLeyes
'
)
def
calcExpansion
(
slices
,
coverage
):
def
calcExpansion
(
slices
,
coverage
):
"""
Calculates a series of *expansion* slices, which can be used to expand
"""
Calculates a series of *expansion* slices, which can be used to expand
the given ``coverage`` so that it includes the given ``slices``.
the given ``coverage`` so that it includes the given ``slices``.
...
@@ -1193,6 +1218,8 @@ def calcExpansion(slices, coverage):
...
@@ -1193,6 +1218,8 @@ def calcExpansion(slices, coverage):
return
volumes
,
expansions
return
volumes
,
expansions
@deprecated.deprecated
(
'
3.9.0
'
,
'
4.0.0
'
,
'
The imagewrapper module been migrated to FSLeyes
'
)
def
collapseExpansions
(
expansions
,
numDims
):
def
collapseExpansions
(
expansions
,
numDims
):
"""
Scans through the given list of expansions (each assumed to pertain
"""
Scans through the given list of expansions (each assumed to pertain
to a single 3D image), and combines any which cover the same
to a single 3D image), and combines any which cover the same
...
...
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