-
Notifications
You must be signed in to change notification settings - Fork 100
ENH Brain.add_label(): use the label.hemi and label.color attributes #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1052,7 +1052,7 @@ def add_label(self, label, color="crimson", alpha=1, scalar_thresh=None, | |||
else: | |||
# try to extract parameters from label instance | |||
try: | |||
lhemi = label.hemi | |||
hemi = label.hemi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can hemi
be None coming from mne-python? I can't remember...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, mne.read_label()
contains
if basename.endswith('lh.label') or basename.startswith('lh.'):
hemi = 'lh'
elif basename.endswith('rh.label') or basename.startswith('rh.'):
hemi = 'rh'
else:
raise ValueError('Cannot find which hemisphere it is. File should end'
' with lh.label or rh.label')
and Label.__init__()
if not isinstance(hemi, string_types):
raise ValueError('hemi must be a string, not %s' % type(hemi))
(wouldn't it make more sense to check it's in ('lh', 'rh')
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. I think the current check (lh.label
end or lh.
start) was designed to follow a standard naming mechanism, likely because it's what freesurfer
expects / can handle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant "(wouldn't it make more sense to check it's in ('lh', 'rh')
?)" applying to Label.__init__()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure where you mean... Label.__init__()
in mne-python?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, Label.__init__()
in mne-python has the lines
if not isinstance(hemi, string_types):
raise ValueError('hemi must be a string, not %s' % type(hemi))
And I was wondering why not checking that it's "lh" or "rh"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, maybe because we support adding the attribute later manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then wouldn't we allow None instead of a random string?
On Jan 30, 2014, at 8:09 PM, Eric89GXL notifications@github.com wrote:
In surfer/viz.py:
@@ -1052,7 +1052,7 @@ def add_label(self, label, color="crimson", alpha=1, scalar_thresh=None,
else:
# try to extract parameters from label instance
try:
lhemi = label.hemi
Not sure, maybe because we support adding the attribute later manually?hemi = label.hemi
—
Reply to this email directly or view it on GitHub.
I took the opportunity to also use the new mne-python |
an object with attributes "hemi", "vertices", "name", | ||
and (if scalar_thresh is not None) "values". | ||
an object with attributes "hemi", "vertices", "name", and | ||
optionally "color" and "values" (if scalar_thresh is not None). | ||
color : matplotlib-style color |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matplotlib-style color | None
besides my nitpick LGTM |
Updated the DOC as suggested by @agramfort |
ENH Brain.add_label(): use the label.hemi and label.color attributes
thx |
When plotting Label instance, use the
label.hemi
attribute