Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Michiel Cottaar
fslpy
Commits
559e5188
Commit
559e5188
authored
7 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
Fixes and tweaks to volumelabels and fixlabels modules
parent
b82b4c40
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/fixlabels.py
+1
-1
1 addition, 1 deletion
fsl/data/fixlabels.py
fsl/data/volumelabels.py
+12
-5
12 additions, 5 deletions
fsl/data/volumelabels.py
with
13 additions
and
6 deletions
fsl/data/fixlabels.py
+
1
−
1
View file @
559e5188
...
@@ -252,7 +252,7 @@ def saveLabelFile(allLabels,
...
@@ -252,7 +252,7 @@ def saveLabelFile(allLabels,
# The first line - the melodic directory name
# The first line - the melodic directory name
if
dirname
is
not
None
:
if
dirname
is
not
None
:
lines
.
append
(
op
.
abspath
(
dirname
)
)
lines
.
append
(
dirname
)
# A line for each component
# A line for each component
for
i
,
labels
in
enumerate
(
allLabels
):
for
i
,
labels
in
enumerate
(
allLabels
):
...
...
This diff is collapsed.
Click to expand it.
fsl/data/volumelabels.py
+
12
−
5
View file @
559e5188
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
manage labels associated with the volumes of an :class:`.Image`. This class
manage labels associated with the volumes of an :class:`.Image`. This class
is primarily used for managing component classifications of a
is primarily used for managing component classifications of a
:class:`.MelodicImage`.
:class:`.MelodicImage`.
See also the :func:`.fixlabels` module for loading/saving melodic label files.
"""
"""
...
@@ -22,7 +24,8 @@ log = logging.getLogger(__name__)
...
@@ -22,7 +24,8 @@ log = logging.getLogger(__name__)
class
VolumeLabels
(
notifier
.
Notifier
):
class
VolumeLabels
(
notifier
.
Notifier
):
"""
The ``VolumeLabels`` class is a convenience class for managing a
"""
The ``VolumeLabels`` class is a convenience class for managing a
collection of classification labels fgor the volumes of an :class:`.Image`.
collection of classification labels for the volumes of an :class:`.Image`.
The ``VolumeLabels`` class refers to *volumes* as *components*, because
The ``VolumeLabels`` class refers to *volumes* as *components*, because
it was originally written to manage classification labels associated wirh
it was originally written to manage classification labels associated wirh
the components of a Melodic analysis.
the components of a Melodic analysis.
...
@@ -230,8 +233,12 @@ class VolumeLabels(notifier.Notifier):
...
@@ -230,8 +233,12 @@ class VolumeLabels(notifier.Notifier):
labels
.
remove
(
label
)
labels
.
remove
(
label
)
comps
.
remove
(
component
)
comps
.
remove
(
component
)
self
.
__components
[
label
]
=
comps
if
len
(
comps
)
==
0
:
self
.
__labels
[
component
]
=
labels
self
.
__components
.
pop
(
label
,
None
)
else
:
self
.
__components
[
label
]
=
comps
self
.
__labels
[
component
]
=
labels
log
.
debug
(
'
Label removed from component: {} <-> {}
'
.
format
(
component
,
log
.
debug
(
'
Label removed from component: {} <-> {}
'
.
format
(
component
,
label
))
label
))
...
@@ -273,12 +280,12 @@ class VolumeLabels(notifier.Notifier):
...
@@ -273,12 +280,12 @@ class VolumeLabels(notifier.Notifier):
def
addComponent
(
self
,
label
,
component
):
def
addComponent
(
self
,
label
,
component
):
"""
Adds the given label to the given component.
"""
"""
Adds the given label to the given component.
"""
self
.
addLabel
(
component
,
label
)
return
self
.
addLabel
(
component
,
label
)
def
removeComponent
(
self
,
label
,
component
,
notify
=
True
):
def
removeComponent
(
self
,
label
,
component
,
notify
=
True
):
"""
Removes the given label from the given component.
"""
"""
Removes the given label from the given component.
"""
self
.
removeLabel
(
component
,
label
,
notify
)
return
self
.
removeLabel
(
component
,
label
,
notify
)
def
clearComponents
(
self
,
label
):
def
clearComponents
(
self
,
label
):
...
...
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