# hide color bar/color legend calculator1Display.SetScalarBarVisibility(renderView1, False) # Update a scalar bar component title. UpdateScalarBarsComponentTitle(ResultLUT, calculator1Display) #### saving camera placements for all active views # current camera placement for renderView1 renderView1.CameraPosition = [0.0, 0.0, 82.35963323102031] renderView1.CameraParallelScale = 21.57466795392812 Render(renderView1) import os import sys try: baselineIndex = sys.argv.index('-B') + 1 baselinePath = sys.argv[baselineIndex] except: print("Could not get baseline directory. Test failed.") baseline_file = os.path.join(baselinePath, "ColorBy.png") from visocyte.vtk.test import Testing from visocyte.vtk.util.misc import vtkGetTempDir Testing.VTK_TEMP_DIR = vtkGetTempDir() Testing.compareImage(renderView1.GetRenderWindow(), baseline_file, threshold=40) Testing.interact()
## ## Test validates the cinema's Azimuth-Elevation-Roll ## camera model export functions. ## #### import the simple module from the visocyte from visocyte.simple import * #### disable automatic camera reset on 'Show' visocyte.simple._DisableFirstRenderCameraReset() from visocyte.vtk.util.misc import vtkGetTempDir testDir = vtkGetTempDir() import os cinemaDBFileName = os.path.join(testDir, "cinema_aer.cdb") # create a new 'Time Source' timeSource1 = TimeSource() # get animation scene animationScene1 = GetAnimationScene() # update animation scene based on data timesteps animationScene1.UpdateAnimationUsingDataTimeSteps() # get active view renderView1 = GetActiveViewOrCreate('RenderView') # uncomment following to set a specific view size renderView1.ViewSize = [300, 300] # show data in view timeSource1Display = Show(timeSource1, renderView1)
def get_header(csvfilename): import csv reader = csv.reader(open(csvfilename, "r"), delimiter=",") for row in reader: return row return [] Sphere() GroupDatasets() UpdatePipeline() Elevation() filename = join(vtkGetTempDir(), "data.csv") v = CreateView("SpreadSheetView") r = Show() ExportView(filename) header = get_header(filename) print(header) assert ("Normals_0" in header and \ "Block Number" in header and \ "Elevation" in header and \ "Point ID" in header and \ "__vtkIsSelected__" not in header) v.HiddenColumnLabels = ["Normals"] Render()
renderView2.Background = [0.32, 0.34, 0.43] layout1.AssignView(2, renderView2) RenderAllViews() a = [0, 0, 0, 0] layout1.GetLayoutExtent(a) size = (a[1] - a[0] + 1, a[3] - a[2] + 1) # Ensure that the current size has odd height assert size[1] % 2 != 0 def SaveAndCheckSize(filename, layout, resolution): SaveScreenshot(filename, layout, SaveAllViews=1, ImageResolution=resolution) from visocyte.vtk.vtkIOImage import vtkPNGReader reader = vtkPNGReader() reader.SetFileName(filename) reader.Update() assert (reader.GetOutput().GetDimensions()[0:2] == resolution) SaveAndCheckSize(join(vtkGetTempDir(), "OutputImageResolution300.png"), layout1, (300, 300)) SaveAndCheckSize(join(vtkGetTempDir(), "OutputImageResolution313.png"), layout1, (300, 313))