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
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, 'o', title='Patient{}, \DeltaE(m)'.format(patient), xtitle='m', ytitle=r'\DeltaE', xlim=[0, m + 1], ylim=[0, ymax], axes={'xyPlaneColor': 'white'}) vplt2.show(errplt) video2.addFrame() if m != stop - 1: vplt0.close() vplt1.close() vplt2.close() video0.close() video1.close() video2.close()
TstIdx = sorted(np.take(latIdx, tst_i)) # get vertex coordinates TrCoord = [vertices[i] for i in TrIdx] TstCoord = [vertices[i] for i in TstIdx] # get mapLAT signal values TrVal = [mapLAT[i] for i in TrIdx] TstVal = [mapLAT[i] for i in TstIdx] """ MAGIC-LAT estimate """ latEst = magicLAT(vertices, faces, TrIdx, TrCoord, TrVal, EDGE_THRESHOLD) magicDE = metrics.deltaE(TstVal, latEst[TstIdx], MINLAT, MAXLAT) verPoints = Points(TrCoord, r=5).cmap('gist_rainbow', TrVal, vmin=MINLAT, vmax=MAXLAT).addScalarBar() estPoints = Points(vertices, r=5).cmap('gist_rainbow', latEst, vmin=MINLAT, vmax=MAXLAT).addScalarBar() coloredMesh = Mesh([vertices, faces]) coloredMesh.interpolateDataFrom(estPoints, N=1).cmap('gist_rainbow', vmin=MINLAT, vmax=MAXLAT).addScalarBar() 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.action(cam1=cam0, cam2=cam1) video0.action(azimuth_range=(0, 359)) video0.close() vplt0.close()