[Neuroimaging] (1) How to set bilateral min values for colorbar in pysurfer? and (2) How to ignore nans when plotting a brain with add_data or add_overaly?
Rolando Masis-Obando
rolandomasisobando at gmail.com
Fri Jul 17 18:57:18 EDT 2020
Hi everyone!
I hope everything is going well for everyone.
I have two questions, the first is:
I’ve been trying to figure out how to set up a threshold value in pysurfer
using either add_overlay (with min) or add_date (with threshold) for both
hemispheres. It turns out, I can’t seem to set a universal threshold that
works with both hemispheres.
For example, let’s play with this example. I have a left and right
hemispheres in fs6 space under a 40962 array. The first thing I do is find
the minimum and maximum values of each hemisphere and in order to keep the
colorbars consistent across both hemispheres, I want to set a constant
minimum value and a constant maximum value.
let’s say that:
left_min = -.2065
right_min = -.1381
left_max = .1664
right_max = .1422
My question is, how can I use pysurfer to use the same colorbar min and max
values?
When I try to do this, by picking left_min and left_max for both
hemispheres like so:
brain.add_overlay(brain_data, min=left_min, max=left_max, hemi='lh')
brain.add_overlay(brain_data, min=left_min, max=left_max, hemi='rh')
OR with add_date like so (with *threshold* either set to None or to
left_min):
brain.add_data(brain_data[:,np.newaxis],time_label =
None,hemi='lh',min=left_min, max=left_max, thresh=thresh)
brain.add_data(brain_data[:,np.newaxis],time_label =
None,hemi='rh',min=left_min, max=left_max, thresh=thresh)
I get the following error:
TraitError: The 'lower_threshold' trait of a Threshold instance must
be -0.1381019441953028 <= a number <= 0.14220765405834088, but a value
of -0.20656023097769433 <class 'numpy.float64'> was specified.
I used to be able to do this with no problem in an older version of
pysurfer, but it seems I get this error with the new one.
Any creative alternative solutions to this obstacle?
My second question:
Is there an easy way to set the transparency (alpha) of nan values easily
in pysurfer, in other words, ignore nans? Sometimes when I plot a brain,
the medial wall gets colored with a default dark red color, rather than
showing the medial wall empty. I usually have the medial wall set to
np.nan, and in an older version of pysurfer this was always ignored (I
think). But, in this new version, it sometimes gets colored, hence why I
have to use the minimum or threshold to avoid that problem. But, as can be
seen from question 1, there are limits to this.
Thanks in advance!
Best,
Rolando
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/neuroimaging/attachments/20200717/8e1f67f8/attachment.html>
More information about the Neuroimaging
mailing list