-
Notifications
You must be signed in to change notification settings - Fork 66
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
Text of sources not shown #90
Comments
I encountered the same issue in the past and it was coming from the TextVisual object of vispy. Can you try this example and see if it works? |
Can you try the following code : import numpy as np
from visbrain.objects import SourceObj
xyz = np.random.rand(100, 3)
text = [f"s{k}" for k in range(100)]
s_obj = SourceObj('test', xyz, text=text, text_size=20, text_translate=(0., .2, 0.))
s_obj.preview() |
Ok, so I guess it comes from the font size. By default, the font size in the example is really small ( |
Sadly, still the same, no text. |
Ok, final test, can you try to increase it drastically to |
And font size do is one of the problems, for if I set it to 100, s_object.preview() still no text. Does it have sth to do with the operating system? Mine is win10 |
OK, font size is the key problem. It seems that the Brain needs much bigger size. I set it to 10000, it shows a little text. |
By the way, how do we calculate the connectivity of electrodes? I used mne, are there any other packages? |
I don't think it comes from your system, because I've the same issue. I guess vispy changed the way the TextVisual is handle, in particular the proportion with the displayed scene. In general, I would say that the GUI of visbrain are not as stable as the object level. If you want to "reproduce" the figure, you can try the following code : import numpy as np
from visbrain.gui import Brain
from visbrain.objects import SourceObj, BrainObj, SceneObj
from visbrain.io import download_file
kwargs = {}
mat = np.load(download_file('xyz_sample.npz', astype='example_data'))
xyz, subjects = mat['xyz'], mat['subjects']
"""The "subjects" list is composed of 6 diffrents subjects and here we set one
unique color (u_color) per subject.
"""
u_color = ["#9b59b6", "#3498db", "white", "#e74c3c", "#34495e", "#2ecc71"]
kwargs['color'] = [u_color[int(k[1])] for k in subjects]
kwargs['alpha'] = 0.7
"""
Now we attach data to each source.
"""
kwargs['data'] = np.arange(len(subjects))
"""The source's radius is proportional to the data attached. But this
proportion can be controlled using a minimum and maximum radius
(s_radiusmin, s_radiusmax)
"""
kwargs['radius_min'] = 2 # Minimum radius
kwargs['radius_max'] = 15 # Maximum radius
kwargs['edge_color'] = (1, 1, 1, 0.5) # Color of the edges
kwargs['edge_width'] = .5 # Width of the edges
kwargs['symbol'] = 'square' # Source's symbol
"""
Next, we mask source's data that are comprised between [-20, 20] and color
each source to orange
"""
mask = np.logical_and(xyz[:, 0] >= -20., xyz[:, 0] <= 20)
kwargs['mask'] = mask
kwargs['mask_color'] = 'orange'
"""It's also possible to add text to each source. Here, we show the name of the
subject in yellow.
To avoid a superposition between the text and sources sphere, we introduce an
offset to the text using the s_textshift input
"""
kwargs['text'] = subjects # Name of the subject
kwargs['text_color'] = "#f39c12" # Set to yellow the text color
kwargs['text_size'] = 200000 # Size of the text
kwargs['text_translate'] = (1.5, 1.5, 0)
kwargs['text_bold'] = True
"""Create the source object. If you want to previsualize the result without
opening Brain, use s_obj.preview()
"""
s_obj = SourceObj('SourceExample', xyz, **kwargs)
"""Color sources according to the data
"""
# s_obj.color_sources(data=kwargs['data'], cmap='viridis')
"""Colorbar properties
"""
cb_kw = dict(cblabel="Project source activity", cbtxtsz=3., border=False, )
"""Define a brain object with the B3 template and project source's activity
onto the surface
"""
b_obj = BrainObj('B3', **cb_kw)
b_obj.project_sources(s_obj, cmap='viridis', vmin=50., under='orange',
vmax=550., over='darkred')
sc = SceneObj()
sc.add_to_subplot(s_obj)
sc.add_to_subplot(b_obj, use_this_cam=True)
sc.preview() |
Thanks a lot |
Hi, I noticed that the repo of Brainets, and I found seegpy. I am doing some analysis based on sEEG, so I am interested in this package. I found that the data format in this package is TRC? What kind of data format is this? And if I've got .edf data, how do I used this package. Some modules, like contacts, may be useful regardless of the format. |
If you want to talk about seegpy, or in general sEEG data analysis, I propose to move to emails |
Excellent! And I just found your e-mail. |
Hi, is there a way that I can set the default size of brains? |
The brain included in visbrain are usually in the MNI system. That being said, if you have your own template, you can provide the vertices and faces to the |
And did you get my e-mail which is a Gmail address? I am afraid I didn't send it successfully for I did encounter this situation. |
Ah ok, try with Yes I received your email and I answered four hours ago, you didn't get my reply? |
Oh, I get it! My phone didn't remind me of that. I shouldn't have believed it, reminding me of Junk emails always, not important ones. |
I ran the code in http://visbrain.org/auto_examples/gui_brain/03_sources.html#sphx-glr-auto-examples-gui-brain-03-sources-py, and no text shown.
When I used SourceObj and set the parameter
text
, also no text.The text was updated successfully, but these errors were encountered: