Example #1
0
    def play(self):
        """Play the internal list of events and save a video."""

        from vedo import Video
        self.events = sorted(self.events, key=lambda x: x[0])
        self.bookingMode = False

        for a in self.actors:
            a.alpha(0)

        #if self.showProgressBar:
        #    pb = ProgressBar(0, len(self.events), c='g')

        if self.totalDuration is None:
            self.totalDuration = self.events[-1][0] - self.events[0][0]
        vd = Video(self.videoFileName,
                   fps=self.videoFPS,
                   duration=self.totalDuration)

        ttlast = 0
        for e in self.events:

            tt, action, self._performers, self._inputvalues = e
            action(0, 0)

            dt = tt - ttlast
            if dt > self.eps:
                self.show(interactive=False, resetcam=self.resetcam)
                vd.addFrame()

                if dt > self.timeResolution + self.eps:
                    vd.pause(dt)

            ttlast = tt

            #if self.showProgressBar:
            #    pb.print('t='+str(int(tt*100)/100)+'s,  '+action.__name__)

        self.show(interactive=False, resetcam=self.resetcam)
        vd.addFrame()

        vd.close()
        self.show(interactive=True, resetcam=self.resetcam)
        self.bookingMode = True
Example #2
0
                                    N=1).cmap('rainbow_r',
                                              vmin=MINLAT,
                                              vmax=MAXLAT).addScalarBar()

    # dEPoints = Points(np.array(dE), r=5).c('black')

    vplt0 = Plotter(N=1,
                    bg='black',
                    resetcam=True,
                    sharecam=False,
                    offscreen=True)
    vplt0.show(coloredMesh,
               verPoints,
               title='Patient{}, Front View'.format(patient),
               camera=cam0)
    video0.addFrame()

    vplt1 = Plotter(N=1,
                    bg='black',
                    resetcam=True,
                    sharecam=False,
                    offscreen=True)
    vplt1.show(coloredMesh,
               verPoints,
               title='Patient{}, Back View'.format(patient),
               camera=cam1)
    video1.addFrame()

    vplt2 = Plotter(offscreen=True)
    errplt = plot(x,
                  y,