예제 #1
0
    def showSimpleCylinders(self):
        """
        Slightly more complex plotting - plot each
        section as a cylinders.
        """

        import sys
        sys.path.append('/usr/share/pyshared/')

        from morphforge.morphology.mesh import MeshBuilderRings
        # MonkeyPatchMayaVi()

        from mayavi import mlab

        assert len(self.morphs) == 1
        mesh = MeshBuilderRings().build(self.morphs[0])

        @mlab.show
        def _showSimpleCylinders():
            mlab.triangular_mesh(mesh.vertices[:, 0],
                                 mesh.vertices[:, 1],
                                 mesh.vertices[:, 2],
                                 mesh.triangles,
                                 colormap=self.colormap)

        _showSimpleCylinders()
예제 #2
0
    def make_video(self):
        """
        Slightly more complex plotting - plot each
        section as a cylinders.
        """

        import sys
        sys.path.append('/usr/share/pyshared/')

        from morphforge.morphology.mesh import MeshBuilderRings
        # MonkeyPatchMayaVi()

        from mayavi import mlab

        assert len(self.morphs) == 1
        mesh = MeshBuilderRings().build(self.morphs[0])

        @mlab.show
        @mlab.animate(delay=100)  #, ui=False) #(delay=500, ui=False)
        def _showSimpleCylinders():

            fig = mlab.figure(bgcolor=None,
                              fgcolor=None,
                              engine=None,
                              size=(1024, 768))
            mlab.triangular_mesh(mesh.vertices[:, 0],
                                 mesh.vertices[:, 1],
                                 mesh.vertices[:, 2],
                                 mesh.triangles,
                                 colormap=self.colormap)

            for i in itertools.count():
                print i
                fig.scene.camera.azimuth(0.1)
                mlab.savefig('/home/michael/Desktop/out/O%04d.png' % i)
                fig.scene.render()
                if i > 3600:
                    break
                yield None

        _showSimpleCylinders()