<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 &lt;<a moz-do-not-send="true"
            href="mailto:nakagawa-t@ifrec.osaka-u.ac.jp">nakagawa-t@ifrec.osaka-u.ac.jp</a>&gt;
          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>
          &gt; I was confused, sorry. the actual error is:<br>
          &gt;<br>
          &gt; --&gt; 876             if isinstance(time_label,
          basestring):<br>
          &gt;<br>
          &gt; as in:<br>
          &gt; In [96]: stc.plot()<br>
          &gt; Updating smoothing matrix, be patient..<br>
          &gt; Smoothing matrix creation, step 1<br>
          &gt; Smoothing matrix creation, step 2<br>
          &gt; Smoothing matrix creation, step 3<br>
          &gt; Smoothing matrix creation, step 4<br>
          &gt; Smoothing matrix creation, step 5<br>
          &gt; Smoothing matrix creation, step 6<br>
          &gt; Smoothing matrix creation, step 7<br>
          &gt; Smoothing matrix creation, step 8<br>
          &gt; Smoothing matrix creation, step 9<br>
          &gt; Smoothing matrix creation, step 10<br>
          &gt;
---------------------------------------------------------------------------<br>
          &gt; NameError                                 Traceback (most
          recent call last)<br>
          &gt; &lt;ipython-input-96-2a3e72fcca14&gt; in &lt;module&gt;()<br>
          &gt; ----&gt; 1 stc.plot()<br>
          &gt;<br>
          &gt;
/home/tristan/anaconda3/lib/python3.5/site-packages/mne-0.12.dev0-py3.5.egg/mne/source_estimate.py<br>
          &gt; in plot(self, subject, surface, hemi, colormap,
          time_label,<br>
          &gt; smoothing_steps, transparent, alpha, time_viewer,
          config_opts,<br>
          &gt; subjects_dir, figure, views, colorbar, clim)<br>
          &gt;    1376                                     
           subjects_dir=subjects_dir,<br>
          &gt; figure=figure,<br>
          &gt;    1377                                     
           views=views,<br>
          &gt; colorbar=colorbar,<br>
          &gt; -&gt; 1378                                     
           clim=clim)<br>
          &gt;    1379         return brain<br>
          &gt;    1380<br>
          &gt;<br>
          &gt;
/home/tristan/anaconda3/lib/python3.5/site-packages/mne-0.12.dev0-py3.5.egg/mne/viz/_3d.py<br>
          &gt; in plot_source_estimates(stc, subject, surface, hemi,
          colormap,<br>
          &gt; time_label, smoothing_steps, transparent, alpha,
          time_viewer,<br>
          &gt; config_opts, subjects_dir, figure, views, colorbar, clim)<br>
          &gt;     747                           
          smoothing_steps=smoothing_steps,<br>
          &gt; time=time,<br>
          &gt;     748                            time_label=time_label,
          alpha=alpha,<br>
          &gt; hemi=hemi,<br>
          &gt; --&gt; 749                            colorbar=colorbar)<br>
          &gt;     750<br>
          &gt;     751         # scale colormap and set time (index) to
          display<br>
          &gt;<br>
          &gt;
          /home/tristan/anaconda3/lib/python3.5/site-packages/surfer/viz.py
          in<br>
          &gt; add_data(self, array, min, max, thresh, colormap, alpha,
          vertices,<br>
          &gt; smoothing_steps, time, time_label, colorbar, hemi,
          remove_existing,<br>
          &gt; time_label_size)<br>
          &gt;     874                 raise ValueError('time is not the
          same length as '<br>
          &gt;     875                                 
          'array.shape[1]')<br>
          &gt; --&gt; 876             if isinstance(time_label,
          basestring):<br>
          &gt;     877                 time_label_fmt = time_label<br>
          &gt;     878                 time_label = lambda x:
          time_label_fmt % x<br>
          &gt;<br>
          &gt; NameError: name 'basestring' is not defined<br>
          &gt;<br>
          &gt; In [97]: stc.time_label<br>
          &gt;
---------------------------------------------------------------------------<br>
          &gt; AttributeError                            Traceback (most
          recent call last)<br>
          &gt; &lt;ipython-input-97-3f447cdfe95d&gt; in &lt;module&gt;()<br>
          &gt; ----&gt; 1 stc.time_label<br>
          &gt;<br>
          &gt; AttributeError: 'SourceEstimate' object has no attribute
          'time_label'<br>
          &gt;<br>
          &gt;<br>
          &gt;<br>
          &gt;<br>
          &gt;<br>
          &gt; On 2016年05月13日 11:54, Nakagawa Tristan T wrote:<br>
          &gt;&gt; Hi,<br>
          &gt;&gt;<br>
          &gt;&gt; I get this error when trying to plot my source
          estimates:<br>
          &gt;&gt; stc.plot()  Error: raise ValueError('time is not the
          same length as<br>
          &gt;&gt; array.shape[1]')<br>
          &gt;&gt;<br>
          &gt;&gt; however,<br>
          &gt;&gt; stc: &lt;SourceEstimate  |  10629 vertices, subject :
          S23, tmin : -1100.0<br>
          &gt;&gt; (ms), tmax : 1000.0 (ms), tstep : 1.0 (ms), data size
          : 10629 x 2101&gt;<br>
          &gt;&gt;<br>
          &gt;&gt; In [93]:   stc.times.shape<br>
          &gt;&gt; Out[93]: (2101,)<br>
          &gt;&gt;<br>
          &gt;&gt; In [94]:   stc.shape<br>
          &gt;&gt; Out[94]: (10629, 2101)<br>
          &gt;&gt;<br>
          &gt;&gt; Here is one of the hemispheres stc:<br>
          &gt;&gt; <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>
          &gt;&gt;<br>
          &gt;&gt; Any ideas?<br>
          &gt;&gt; I just installed mayavi 4.4.4 with vtk 7.0 on
          python3, not sure if that<br>
          &gt;&gt; might cause problems, but the error doesn't look like
          it.<br>
          &gt;&gt;<br>
          &gt;&gt; Thanks,<br>
          &gt;&gt; Tristan<br>
          &gt;&gt;<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>