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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Evan Edmond
fslpy
Commits
6975b224
Commit
6975b224
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Atlas constructors pass kwargs through to Image.__init__
parent
04f29154
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/atlases.py
+18
-10
18 additions, 10 deletions
fsl/data/atlases.py
with
18 additions
and
10 deletions
fsl/data/atlases.py
+
18
−
10
View file @
6975b224
...
@@ -167,7 +167,7 @@ class AtlasRegistry(notifier.Notifier):
...
@@ -167,7 +167,7 @@ class AtlasRegistry(notifier.Notifier):
raise
KeyError
(
'
Unknown atlas ID: {}
'
.
format
(
atlasID
))
raise
KeyError
(
'
Unknown atlas ID: {}
'
.
format
(
atlasID
))
def
loadAtlas
(
self
,
atlasID
,
loadSummary
=
False
,
resolution
=
None
):
def
loadAtlas
(
self
,
atlasID
,
loadSummary
=
False
,
resolution
=
None
,
**
kwargs
):
"""
Loads and returns an :class:`Atlas` instance for the atlas
"""
Loads and returns an :class:`Atlas` instance for the atlas
with the given ``atlasID``.
with the given ``atlasID``.
...
@@ -189,10 +189,10 @@ class AtlasRegistry(notifier.Notifier):
...
@@ -189,10 +189,10 @@ class AtlasRegistry(notifier.Notifier):
if
atlasDesc
.
atlasType
==
'
label
'
:
if
atlasDesc
.
atlasType
==
'
label
'
:
loadSummary
=
True
loadSummary
=
True
if
loadSummary
:
at
las
=
LabelAtlas
(
atlasDesc
,
resolution
)
if
loadSummary
:
at
ype
=
LabelAtlas
else
:
at
las
=
ProbabilisticAtlas
(
atlasDesc
,
resolution
)
else
:
at
ype
=
ProbabilisticAtlas
return
at
las
return
at
ype
(
atlasDesc
,
resolution
,
**
kwargs
)
def
addAtlas
(
self
,
filename
,
atlasID
=
None
,
save
=
True
):
def
addAtlas
(
self
,
filename
,
atlasID
=
None
,
save
=
True
):
...
@@ -619,7 +619,11 @@ class Atlas(fslimage.Image):
...
@@ -619,7 +619,11 @@ class Atlas(fslimage.Image):
"""
"""
def
__init__
(
self
,
atlasDesc
,
resolution
=
None
,
isLabel
=
False
):
def
__init__
(
self
,
atlasDesc
,
resolution
=
None
,
isLabel
=
False
,
**
kwargs
):
"""
Initialise an ``Atlas``.
"""
Initialise an ``Atlas``.
:arg atlasDesc: The :class:`AtlasDescription` instance which
:arg atlasDesc: The :class:`AtlasDescription` instance which
...
@@ -629,6 +633,8 @@ class Atlas(fslimage.Image):
...
@@ -629,6 +633,8 @@ class Atlas(fslimage.Image):
:arg isLabel: Pass in ``True`` for label atlases, ``False`` for
:arg isLabel: Pass in ``True`` for label atlases, ``False`` for
probabilistic atlases.
probabilistic atlases.
All other arguments are passed to :meth:`.Image.__init__`.
"""
"""
# Get the index of the atlas with the
# Get the index of the atlas with the
...
@@ -651,7 +657,7 @@ class Atlas(fslimage.Image):
...
@@ -651,7 +657,7 @@ class Atlas(fslimage.Image):
if
isLabel
:
imageFile
=
atlasDesc
.
summaryImages
[
imageIdx
]
if
isLabel
:
imageFile
=
atlasDesc
.
summaryImages
[
imageIdx
]
else
:
imageFile
=
atlasDesc
.
images
[
imageIdx
]
else
:
imageFile
=
atlasDesc
.
images
[
imageIdx
]
fslimage
.
Image
.
__init__
(
self
,
imageFile
)
fslimage
.
Image
.
__init__
(
self
,
imageFile
,
**
kwargs
)
# Even though all the FSL atlases
# Even though all the FSL atlases
# are in MNI152 space, not all of
# are in MNI152 space, not all of
...
@@ -684,7 +690,7 @@ class LabelAtlas(Atlas):
...
@@ -684,7 +690,7 @@ class LabelAtlas(Atlas):
makes looking up the label at a location easy.
makes looking up the label at a location easy.
"""
"""
def
__init__
(
self
,
atlasDesc
,
resolution
=
None
):
def
__init__
(
self
,
atlasDesc
,
resolution
=
None
,
**
kwargs
):
"""
Create a ``LabelAtlas`` instance.
"""
Create a ``LabelAtlas`` instance.
:arg atlasDesc: The :class:`AtlasDescription` instance describing
:arg atlasDesc: The :class:`AtlasDescription` instance describing
...
@@ -692,7 +698,7 @@ class LabelAtlas(Atlas):
...
@@ -692,7 +698,7 @@ class LabelAtlas(Atlas):
:arg resolution: Desired isotropic resolution in millimetres.
:arg resolution: Desired isotropic resolution in millimetres.
"""
"""
Atlas
.
__init__
(
self
,
atlasDesc
,
resolution
,
True
)
Atlas
.
__init__
(
self
,
atlasDesc
,
resolution
,
True
,
**
kwargs
)
def
label
(
self
,
location
,
*
args
,
**
kwargs
):
def
label
(
self
,
location
,
*
args
,
**
kwargs
):
...
@@ -785,6 +791,8 @@ class LabelAtlas(Atlas):
...
@@ -785,6 +791,8 @@ class LabelAtlas(Atlas):
if
not
fslimage
.
Image
(
mask
,
xform
=
xform
).
sameSpace
(
self
):
if
not
fslimage
.
Image
(
mask
,
xform
=
xform
).
sameSpace
(
self
):
raise
MaskError
(
'
Mask is not in the same space as atlas
'
)
raise
MaskError
(
'
Mask is not in the same space as atlas
'
)
# TODO allow non-aligned mask - as long as it overlaps
# in world coordinates, it should be allowed
# Extract the values that are in
# Extract the values that are in
...
@@ -826,7 +834,7 @@ class ProbabilisticAtlas(Atlas):
...
@@ -826,7 +834,7 @@ class ProbabilisticAtlas(Atlas):
which makes looking up region probabilities easy.
which makes looking up region probabilities easy.
"""
"""
def
__init__
(
self
,
atlasDesc
,
resolution
=
None
):
def
__init__
(
self
,
atlasDesc
,
resolution
=
None
,
**
kwargs
):
"""
Create a ``ProbabilisticAtlas`` instance.
"""
Create a ``ProbabilisticAtlas`` instance.
:arg atlasDesc: The :class:`AtlasDescription` instance describing
:arg atlasDesc: The :class:`AtlasDescription` instance describing
...
@@ -834,7 +842,7 @@ class ProbabilisticAtlas(Atlas):
...
@@ -834,7 +842,7 @@ class ProbabilisticAtlas(Atlas):
:arg resolution: Desired isotropic resolution in millimetres.
:arg resolution: Desired isotropic resolution in millimetres.
"""
"""
Atlas
.
__init__
(
self
,
atlasDesc
,
resolution
,
False
)
Atlas
.
__init__
(
self
,
atlasDesc
,
resolution
,
False
,
**
kwargs
)
def
proportions
(
self
,
location
,
*
args
,
**
kwargs
):
def
proportions
(
self
,
location
,
*
args
,
**
kwargs
):
...
...
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