<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Actually, as I mention below, vtk7 (main release) is compatible with
Python3<br>
<br>
<a class="moz-txt-link-freetext" href="https://blog.kitware.com/vtk-7-0-0/">https://blog.kitware.com/vtk-7-0-0/</a><br>
<br>
and with this and mayavi 4.4.4, after fixing the viz.py script, I
could plot meg activity onto the cortical surface without any
apparent problems so far, all in python 3. <br>
<br>
Cheers<br>
Tristan<br>
<br>
<div class="moz-cite-prefix">On 2016年05月13日 21:02, Denis-Alexander
Engemann wrote:<br>
</div>
<blockquote
cite="mid:%3CCA+MN3Ot_F4TdFYHc6fdi7iS1eXKbv-bRRE5sxKPa+AJXASugoQ@mail.gmail.com%3E"
type="cite">
<div dir="ltr">Mayavi does not yet work with Python3
unfortunately. Rumors have been existing that there is some
unmerged experimental dev branch of VTK that supports mayavi 3,
but I'm not sure if mayavi can already be used.
<div><br>
</div>
<div>Btw. anyone who wants to help writing an API for plotting
freesurfer outputs using matplotlib without extra dependencies
deserves many beers {insert favourite drink}. Look also here
for the first attempts:</div>
<div><a moz-do-not-send="true"
href="https://github.com/nilearn/nilearn/pull/1016">https://github.com/nilearn/nilearn/pull/1016</a><br>
</div>
<div><br>
</div>
<div>Denis</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Fri, May 13, 2016 at 8:01 AM Nakagawa Tristan
T <<a moz-do-not-send="true"
href="mailto:nakagawa-t@ifrec.osaka-u.ac.jp">nakagawa-t@ifrec.osaka-u.ac.jp</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">I figured it
out, it seems the code is still not compatible with python3.<br>
<br>
adding to viz.py :<br>
<br>
try:<br>
basestring<br>
except NameError:<br>
basestring = str<br>
<br>
fixes this error and makes the plot possible.<br>
<br>
I never worked with python2 (and didn't know basestring was a
type);<br>
do I have to expect silent wrong results using the<br>
python3/mayavi4.4.4/vtk7 combination?<br>
<br>
<br>
---<br>
If anybody is interested (unless this isn't advised), The
install<br>
procedure gave me some trouble but finally worked in this
combination<br>
(with anaconda python):<br>
conda install -c menpo vtk=7.0.0<br>
pip install mayavi<br>
pip install pysurfer<br>
<br>
cheers<br>
Tristan<br>
<br>
<br>
On 2016年05月13日 13:39, Nakagawa Tristan T wrote:<br>
> I was confused, sorry. the actual error is:<br>
><br>
> --> 876 if isinstance(time_label,
basestring):<br>
><br>
> as in:<br>
> In [96]: stc.plot()<br>
> Updating smoothing matrix, be patient..<br>
> Smoothing matrix creation, step 1<br>
> Smoothing matrix creation, step 2<br>
> Smoothing matrix creation, step 3<br>
> Smoothing matrix creation, step 4<br>
> Smoothing matrix creation, step 5<br>
> Smoothing matrix creation, step 6<br>
> Smoothing matrix creation, step 7<br>
> Smoothing matrix creation, step 8<br>
> Smoothing matrix creation, step 9<br>
> Smoothing matrix creation, step 10<br>
>
---------------------------------------------------------------------------<br>
> NameError Traceback (most
recent call last)<br>
> <ipython-input-96-2a3e72fcca14> in <module>()<br>
> ----> 1 stc.plot()<br>
><br>
>
/home/tristan/anaconda3/lib/python3.5/site-packages/mne-0.12.dev0-py3.5.egg/mne/source_estimate.py<br>
> in plot(self, subject, surface, hemi, colormap,
time_label,<br>
> smoothing_steps, transparent, alpha, time_viewer,
config_opts,<br>
> subjects_dir, figure, views, colorbar, clim)<br>
> 1376
subjects_dir=subjects_dir,<br>
> figure=figure,<br>
> 1377
views=views,<br>
> colorbar=colorbar,<br>
> -> 1378
clim=clim)<br>
> 1379 return brain<br>
> 1380<br>
><br>
>
/home/tristan/anaconda3/lib/python3.5/site-packages/mne-0.12.dev0-py3.5.egg/mne/viz/_3d.py<br>
> in plot_source_estimates(stc, subject, surface, hemi,
colormap,<br>
> time_label, smoothing_steps, transparent, alpha,
time_viewer,<br>
> config_opts, subjects_dir, figure, views, colorbar, clim)<br>
> 747
smoothing_steps=smoothing_steps,<br>
> time=time,<br>
> 748 time_label=time_label,
alpha=alpha,<br>
> hemi=hemi,<br>
> --> 749 colorbar=colorbar)<br>
> 750<br>
> 751 # scale colormap and set time (index) to
display<br>
><br>
>
/home/tristan/anaconda3/lib/python3.5/site-packages/surfer/viz.py
in<br>
> add_data(self, array, min, max, thresh, colormap, alpha,
vertices,<br>
> smoothing_steps, time, time_label, colorbar, hemi,
remove_existing,<br>
> time_label_size)<br>
> 874 raise ValueError('time is not the
same length as '<br>
> 875
'array.shape[1]')<br>
> --> 876 if isinstance(time_label,
basestring):<br>
> 877 time_label_fmt = time_label<br>
> 878 time_label = lambda x:
time_label_fmt % x<br>
><br>
> NameError: name 'basestring' is not defined<br>
><br>
> In [97]: stc.time_label<br>
>
---------------------------------------------------------------------------<br>
> AttributeError Traceback (most
recent call last)<br>
> <ipython-input-97-3f447cdfe95d> in <module>()<br>
> ----> 1 stc.time_label<br>
><br>
> AttributeError: 'SourceEstimate' object has no attribute
'time_label'<br>
><br>
><br>
><br>
><br>
><br>
> On 2016年05月13日 11:54, Nakagawa Tristan T wrote:<br>
>> Hi,<br>
>><br>
>> I get this error when trying to plot my source
estimates:<br>
>> stc.plot() Error: raise ValueError('time is not the
same length as<br>
>> array.shape[1]')<br>
>><br>
>> however,<br>
>> stc: <SourceEstimate | 10629 vertices, subject :
S23, tmin : -1100.0<br>
>> (ms), tmax : 1000.0 (ms), tstep : 1.0 (ms), data size
: 10629 x 2101><br>
>><br>
>> In [93]: stc.times.shape<br>
>> Out[93]: (2101,)<br>
>><br>
>> In [94]: stc.shape<br>
>> Out[94]: (10629, 2101)<br>
>><br>
>> Here is one of the hemispheres stc:<br>
>> <a moz-do-not-send="true"
href="https://www.dropbox.com/s/d3vvmy79gddvuev/grad_CS-lh.stc?dl=0"
rel="noreferrer" target="_blank">https://www.dropbox.com/s/d3vvmy79gddvuev/grad_CS-lh.stc?dl=0</a><br>
>><br>
>> Any ideas?<br>
>> I just installed mayavi 4.4.4 with vtk 7.0 on
python3, not sure if that<br>
>> might cause problems, but the error doesn't look like
it.<br>
>><br>
>> Thanks,<br>
>> Tristan<br>
>><br>
<br>
--<br>
Tristan T. Nakagawa, Ph.D.<br>
Laboratory for Brain-Immune Interaction,<br>
iFReC, Osaka University<br>
3-1 Yamadaoka, Suita, Osaka, Japan<br>
Tel: 0668789710<br>
Office: CiNet R 2B6-2<br>
<a moz-do-not-send="true" href="http://seymourlab.com"
rel="noreferrer" target="_blank">http://seymourlab.com</a><br>
<br>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a moz-do-not-send="true"
href="mailto:Mne_analysis@nmr.mgh.harvard.edu"
target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a moz-do-not-send="true"
href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis"
rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
<br>
<br>
The information in this e-mail is intended only for the person
to whom it is<br>
addressed. If you believe this e-mail was sent to you in error
and the e-mail<br>
contains patient information, please contact the Partners
Compliance HelpLine at<br>
<a moz-do-not-send="true"
href="http://www.partners.org/complianceline"
rel="noreferrer" target="_blank">http://www.partners.org/complianceline</a>
. If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the
sender and properly<br>
dispose of the e-mail.<br>
</blockquote>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Tristan T. Nakagawa, Ph.D.
Laboratory for Brain-Immune Interaction,
iFReC, Osaka University
3-1 Yamadaoka, Suita, Osaka, Japan
Tel: 0668789710
Office: CiNet R 2B6-2
<a class="moz-txt-link-freetext" href="http://seymourlab.com">http://seymourlab.com</a></pre>
</body>
</html>