def position_canvases(self, x, y): # Updates the position of the canvases # Upper left corner will be at coordinate (x, y) canvases = [] try: canvases.append(self.get_processor("Canvas")) except ProcessorNotFoundError: pass try: canvases.append(self.get_processor("SliceCanvas")) except ProcessorNotFoundError: pass try: canvases.append(self.get_processor("Unit Cell Canvas")) except ProcessorNotFoundError: pass try: canvases.append(self.get_processor("graphCanvas")) except ProcessorNotFoundError: pass print("CANVASES____") print(canvases) for canvas in canvases: canvas.position.value = glm.ivec2(x, y) # x += canvas.inputSize.dimensions.value.x y += canvas.inputSize.dimensions.value.y
def main(save_main_dir, pixel_dim, clip, num_random, plane): #Setup app = inviwopy.app network = app.network cam = network.EntryExitPoints.camera cam.nearPlane = 6.0 cam.farPlane = 1000.0 canvases = inviwopy.app.network.canvases for canvas in canvases: canvas.inputSize.dimensions.value = ivec2(pixel_dim, pixel_dim) inviwo_utils.update() if not os.path.isdir(save_main_dir): pathlib.Path(save_main_dir).mkdir(parents=True, exist_ok=True) #Save a number of random light fields random_lfs = create_random_lf_cameras(num_random, (180, 35), 1, interspatial_distance=0.5, look_up=vec3(0, 1, 0)) for lf in random_lfs: if clip: _, clip_type = random_clip_lf(network, lf) elif plane: random_plane_clip(network, lf) save_lf(lf, save_main_dir) if clip: restore_clip(network, clip_type)
def main(pixel_dim, clip, num_random, plane): #Setup app = inviwopy.app network = app.network cam = network.EntryExitPoints.camera cam.nearPlane = 6.0 cam.farPlane = 1000.0 canvases = inviwopy.app.network.canvases for canvas in canvases: canvas.inputSize.dimensions.value = ivec2(pixel_dim, pixel_dim) inviwo_utils.update() random_lfs = create_random_lf_cameras( num_random, (180, 35), 1, interspatial_distance=0.5, look_up = vec3(0, 1, 0)) time_accumulator = (0.0, 0.0, 0.0) for lf in random_lfs: if clip: _, clip_type = random_clip_lf(network, lf) elif plane: random_plane_clip(network, lf) time_taken = lf.view_array(cam, save=False, should_time=True) time_accumulator = welford.update( time_accumulator, time_taken) if clip: restore_clip(network, clip_type) mean, variance, _ = welford.finalize(time_accumulator) print("Time taken per grid, average {:4f}, std_dev {:4f}".format( mean, math.sqrt(variance)))
def set_canvas_sizes(pixel_size_x, pixel_size_y): """Sets the canvases in the network to pixel size (square image)""" canvases = network.canvases for canvas in canvases: canvas.inputSize.dimensions.value = ivec2(pixel_size_x, pixel_size_y) inviwo_utils.update()
def add_processor(self, id, name, xpos=0, ypos=0): factory = self.app.processorFactory new_processor = factory.create(id, glm.ivec2(xpos, ypos)) new_processor.identifier = name self.network.addProcessor(new_processor) self.processors[name] = new_processor # self.processors.append(new_processor) return new_processor
def restore_clip(network, type): """type is expected to be "X", "Y" or "Z" """ if type is "X": clip = network.CubeProxyGeometry.clipX if type is "Y": clip = network.CubeProxyGeometry.clipY if type is "Z": clip = network.CubeProxyGeometry.clipZ clip.value = ivec2(0, clip.rangeMax)
def restore_volume(network, type): """type is expected to be "X", "Y" or "Z" """ if type is "X": clip = network.VolumeSubset.rangeX if type is "Y": clip = network.VolumeSubset.rangeY if type is "Z": clip = network.VolumeSubset.rangeZ clip.value = ivec2(0, clip.rangeMax)
def reset_canvas_positions(self, start_x=0, start_y=0, max_width=10000): # Position all canvases side by side starting with the upper right corner # in given start coordinate. x_tmp = start_x y_tmp = start_y for subnetwork in self.subnetworks.values(): for canvas in subnetwork.canvases: if not canvas.widget.visibility: continue if x_tmp > start_x+max_width: x_tmp = start_x y_tmp += canvas.widget.dimensions[1] canvas.widget.position = glm.ivec2(x_tmp, y_tmp) x_tmp += canvas.widget.dimensions[0]
def __init__(self, hdf5_path, inviwoApp, inviwo = True): print("Initialising VisMan") self.app = inviwoApp self.network = inviwoApp.network self.subnetworks = {} self.decorations = {} self.inviwo = inviwo self.main_vis_type = None self.available_visualisations = [] self.hdf5_path = hdf5_path # Add hdf5 source processor self.hdf5Source = self.app.processorFactory.create('org.inviwo.hdf5.Source', glm.ivec2(0, 0)) self.hdf5Source.filename.value = hdf5_path self.network.addProcessor(self.hdf5Source) self.hdf5Output = self.hdf5Source.getOutport('outport') # Check what visualisations are possible with this hdf5-file. with h5py.File(hdf5_path, 'r') as file: if ChargeDensity.valid_hdf5(file): self.available_visualisations.append("charge") if ELFVolume.valid_hdf5(file): self.available_visualisations.append("elf") if BandstructureNetworkHandler.valid_hdf5(file): self.available_visualisations.append("band2d") if Bandstructure3DNetworkHandler.valid_hdf5(file): self.available_visualisations.append("band3d") if AtomPositions.valid_hdf5(file): self.available_visualisations.append("atom") if FermiSurface.valid_hdf5(file): self.available_visualisations.append("fermi") if PartialChargeDensity.valid_hdf5(file): self.available_visualisations.append("parchg") if Bandstructure.valid_hdf5(file): self.available_visualisations.append("band") if DensityOfStates.valid_hdf5(file): self.available_visualisations.append("dos") if PCFNetworkHandler.valid_hdf5(file): self.available_visualisations.append("pcf") if ForceVectors.valid_hdf5(file): self.available_visualisations.append("force") if MolecularDynamics.valid_hdf5(file): #MD self.available_visualisations.append("molecular_dynamics") #Det här behöver ändras från Test.valid_hdf5 till force.valid_hdf5 #och animation.valid_hdf5 # if Test.valid_hdf5(file): # self.available_visualisations.append("force") # self.available_visualisations.append("moldyn") if len(set(['charge', 'elf', 'fermi', 'parchg']) & set(self.available_visualisations)) > 0: self.available_visualisations.append('multi')
def random_subset(network, type): """type is expected to be "X", "Y" or "Z" """ if type is "X": clip = network.VolumeSubset.rangeX if type is "Y": clip = network.VolumeSubset.rangeY if type is "Z": clip = network.VolumeSubset.rangeZ max = (clip.rangeMax // 2) - (clip.rangeMax // 10) start = randint(0, max) end = randint(0, max) end = clip.rangeMax - end clip_range = ivec2(start, end) clip.value = clip_range
def random_clip(network, type): """type is expected to be "X", "Y" or "Z" """ if type is "X": clip = network.CubeProxyGeometry.clipX if type is "Y": clip = network.CubeProxyGeometry.clipY if type is "Z": clip = network.CubeProxyGeometry.clipZ max = (clip.rangeMax // 2) - (clip.rangeMax // 10) start = randint(0, max) end = randint(0, max) end = clip.rangeMax - end clip_range = ivec2(start, end) clip.value = clip_range
def add_processor(self, processor_type, name, xpos=0, ypos=0): # Add a processor. If processor with name already added return it. if name in self.processors: return self.processors[name] factory = self.app.processorFactory new_processor = factory.create(processor_type, glm.ivec2(xpos*25, ypos*25)) new_processor.identifier = name self.network.addProcessor(new_processor) self.processors[name] = new_processor if processor_type=="org.inviwo.CanvasGL": self.canvases.append(new_processor) return new_processor
def __init__(self, input_image_width=128, input_image_height=128, channels=3, num_steps=1000): # The input image and the transfer function """ More complex self.observation_space = spaces.Dict( collections.OrderedDict(( ("Image", spaces.Box( low=0, high=255, dtype=np.uint8, shape=(input_image_width, input_image_height, channels) )), ("TF", spaces.Box( low=0, high=255, dtype=np.uint8, shape=(256, 4) )) )) ) """ self.observation_space = spaces.Box(low=0, high=255, dtype=np.uint8, shape=(input_image_width, input_image_height, channels)) self.action_space = spaces.Box(low=0, high=255, dtype=np.uint8, shape=(256 * 4, )) self.num_steps = 1000 # Inviwo init network = inviwopy.app.network canvases = network.canvases for canvas in canvases: canvas.inputSize.dimensions.value = ivec2(input_image_width, input_image_height) self.ivw_tf = network.VolumeRaycaster.isotfComposite.transferFunction self.input_data = self.render_inviwo_frame() self.reset()
def __init__(self, input_image_width=128, input_image_height=128, channels=4, num_steps=1000): # The input image and the transfer function """ More complex self.observation_space = spaces.Dict( collections.OrderedDict(( ("Image", spaces.Box( low=0, high=255, dtype=np.uint8, shape=(input_image_width, input_image_height, channels) )), ("TF", spaces.Box( low=0, high=255, dtype=np.uint8, shape=(256, 4) )) )) ) """ #TODO would need to check ivw image format matches self.observation_space = spaces.Box( low=0, high=255, dtype=np.uint8, shape=(input_image_width, input_image_height, channels)) #self.action_space = spaces.Box( # low=0, high=255, dtype=np.uint8, shape=(256 *4,)) #Does not work in current version of stable baselines. #nvec = np.full(fill_value=256, shape=(256*4)) #self.action_space = spaces.MultiDiscrete(nvec) self.action_space = spaces.Box( low=0, high=1, dtype=np.float32, shape=(256*4,)) self.num_steps=1000 # Inviwo init network = inviwopy.app.network canvases = network.canvases for canvas in canvases: canvas.inputSize.dimensions.value = ivec2( input_image_width, input_image_height) self.reset()
def main(save_dir, image_name, pixel_dim, tf_location): if not os.path.exists(save_dir): os.makedirs(save_dir) save_loc = os.path.join(save_dir, image_name) inviwopy.app.waitForPool() network = inviwopy.app.network canvases = network.canvases for canvas in canvases: canvas.inputSize.dimensions.value = ivec2(pixel_dim, pixel_dim) tf = network.VolumeRaycaster.isotfComposite.transferFunction tf.load(tf_location) # Update the network inviwo_utils.update() canvas.snapshot(save_loc) inviwopy.app.closeInviwoApplication() return 0
def main(pixel_dim): #Setup app = inviwopy.app network = app.network cam = network.EntryExitPoints.camera cam.lookUp = vec3(0, 1, 0) cam.nearPlane = 6.0 cam.farPlane = 1000.0 canvases = inviwopy.app.network.canvases for canvas in canvases: canvas.inputSize.dimensions.value = ivec2(pixel_dim, pixel_dim) inviwo_utils.update() # Create a light field camera at the current camera position lf_camera_here = LightFieldCamera(cam.lookFrom, cam.lookTo, cam.lookUp, interspatial_distance=0.5) #Preview the lf camera array lf_camera_here.view_array(cam, save=False, should_time=True)
import time import ivw.regression import ivw.camera steps = 50 m = ivw.regression.Measurements() network = inviwopy.app.network; canvas = network.CanvasGL; orgsize = canvas.size; with ivw.camera.Camera(network.EntryExitPoints.camera, lookfrom = vec3(0,4,0), lookto = vec3(0,0,0), lookup = vec3(0,0,1)) as c: for size in [256,512,768,1024]: canvas.size=ivec2(size,size) ivw.regression.saveCanvas(canvas, "CanvasGL-"+str(size) + "x" +str(size)) start = time.perf_counter() for step in c.rotate(math.pi/steps, steps, vec3(0,1,0)): inviwoqt.update() end = time.perf_counter() frametime = (end - start) / steps fps = 1.0 / frametime m.addFrequency('FPS-'+str(size)+'x'+str(size), fps) m.save() canvas.size = orgsize;
#Inviwo Python script import inviwopy from inviwopy import qt from inviwopy.glm import ivec2 app = inviwopy.app network = app.network factory = app.processorFactory if app.network.i == None: p = factory.create('org.inviwo.IntSliderTest', ivec2(75, -100)) p.identifier = "i" network.addProcessor(p) if app.network.f == None: p = factory.create('org.inviwo.FloatSliderTest', ivec2(75, -25)) p.identifier = "f" network.addProcessor(p) app.network.i.prop1.minValue = -10 app.network.i.prop1.maxValue = 10 app.network.f.prop1.minValue = -1 app.network.f.prop1.maxValue = 1 app.network.f.prop1.increment = 0.2 s = "" for i in app.network.i.prop1.foreach(-3, 8): s += str(i) + " " qt.update() print(s)
def setup_network(self, filepath): app = self.app network = app.network factory = app.processorFactory # start with a clean network network.clear() #hdf_fermi_source = factory.create('org.inviwo.HDF5FermiSource', glm.ivec2(0,0)) self.hdf_fermi_source = HDF5FermiSource('fermi', 'fermi source') self.hdf_fermi_source.filename.value = filepath network.addProcessor(self.hdf_fermi_source) cube_proxy_geometry = factory.create('org.inviwo.CubeProxyGeometry', glm.ivec2(50, 100)) network.addProcessor(cube_proxy_geometry) network.addConnection(self.hdf_fermi_source.getOutport('outport'), cube_proxy_geometry.getInport('volume')) volume_bounding_box = factory.create('org.inviwo.VolumeBoundingBox', glm.ivec2(250, 100)) network.addProcessor(volume_bounding_box) network.addConnection(self.hdf_fermi_source.getOutport('outport'), volume_bounding_box.getInport('volume')) background = factory.create('org.inviwo.Background', glm.ivec2(450, 100)) network.addProcessor(background) entry_exit_points = factory.create('org.inviwo.EntryExitPoints', glm.ivec2(50, 200)) network.addProcessor(entry_exit_points) network.addConnection(cube_proxy_geometry.getOutport('proxyGeometry'), entry_exit_points.getInport('geometry')) mesh_renderer = factory.create('org.inviwo.GeometryRenderGL', glm.ivec2(250, 200)) network.addProcessor(mesh_renderer) network.addConnection(volume_bounding_box.getOutport('mesh'), mesh_renderer.getInport('geometry')) network.addConnection(background.getOutport('outport'), mesh_renderer.getInport('imageInport')) network.addLink(mesh_renderer.getPropertyByIdentifier('camera'), entry_exit_points.getPropertyByIdentifier('camera')) self.iso_raycaster = factory.create('org.inviwo.ISORaycaster', glm.ivec2(0, 300)) network.addProcessor(self.iso_raycaster) network.addConnection(self.hdf_fermi_source.getOutport('outport'), self.iso_raycaster.getInport('volume')) network.addConnection(entry_exit_points.getOutport('entry'), self.iso_raycaster.getInport('entry')) network.addConnection(entry_exit_points.getOutport('exit'), self.iso_raycaster.getInport('exit')) network.addConnection(mesh_renderer.getOutport('image'), self.iso_raycaster.getInport('bg')) network.addLink( self.hdf_fermi_source.getPropertyByIdentifier('fermi_level'), self.iso_raycaster.raycasting.getPropertyByIdentifier('isoValue')) canvas = factory.create('org.inviwo.CanvasGL', glm.ivec2(0, 400)) network.addProcessor(canvas) network.addConnection(self.iso_raycaster.getOutport('outport'), canvas.getInport('inport')) network.addLink(entry_exit_points.getPropertyByIdentifier('camera'), self.iso_raycaster.getPropertyByIdentifier('camera')) canvas.inputSize.dimensions.value = glm.size2_t(500, 500) canvas.widget.show()
def setup_bandstructure_network(self, h5file): self.factory = self.app.processorFactory #Extractiong network metadata with h5py.File(h5file, 'r') as f: KPoints = f.get('BandStructure').get('KPoints')[()] Symbols = f.get('Highcoordinates') length_iteration = len(KPoints) #number of iterations sym_list = [] kpoint_list = [] iteration_list = [] sym_it_list = [] for x in range(len(Symbols)): symbol = f.get('Highcoordinates').get(str(x)).get('Symbol')[()] koord = f.get('Highcoordinates').get( str(x)).get('Coordinates')[()] sym_list.append(symbol) kpoint_list.append(koord) for i in range(len(KPoints)): if np.array_equal(KPoints[i], kpoint_list[x]): iteration_list.append(i) sym_it_list.append(symbol) for l in range(len(iteration_list) - 1): for j in range(0, len(iteration_list) - l - 1): if iteration_list[j] > iteration_list[j + 1]: iteration_list[j], iteration_list[ j + 1] = iteration_list[j + 1], iteration_list[j] sym_it_list[j], sym_it_list[j + 1] = sym_it_list[ j + 1], sym_it_list[j] #HDF5Source hdf5_source = self.factory.create('org.inviwo.hdf5.Source', glm.ivec2(0, 0)) hdf5_source.identifier = 'hdf5 source' hdf5_source.filename.value = h5file self.network.addProcessor(hdf5_source) #HDF5PathSelection hdf5_path_selection = self.factory.create( 'org.inviwo.hdf5.PathSelection', glm.ivec2(0, 75)) hdf5_path_selection.identifier = 'band' hdf5_path_selection.selection.value = '/Bandstructure/Bands' self.network.addProcessor(hdf5_path_selection) self.network.addConnection(hdf5_source.getOutport('outport'), hdf5_path_selection.getInport('inport')) #HDF5PathSelectionAllChildren hdf5_path_selection_all_children = self.factory.create( 'org.inviwo.HDF5PathSelectionAllChildren', glm.ivec2(0, 150)) hdf5_path_selection_all_children.identifier = 'All' self.network.addProcessor(hdf5_path_selection_all_children) self.network.addConnection( hdf5_path_selection.getOutport('outport'), hdf5_path_selection_all_children.getInport('hdf5HandleInport')) #HDF5ToFunction, denna funkar inte för tillfället hdf5_to_function = self.factory.create('org.inviwo.HDF5ToFunction', glm.ivec2(0, 225)) hdf5_to_function.identifier = 'Convert to function' self.network.addProcessor(hdf5_to_function) self.network.addConnection( hdf5_path_selection_all_children.getOutport( 'hdf5HandleVectorOutport'), hdf5_to_function.getInport('hdf5HandleFlatMultiInport')) #FunctionToDataframe function_to_dataframe = self.factory.create( 'org.inviwo.FunctionToDataFrame', glm.ivec2(0, 300)) function_to_dataframe.identifier = 'Function to dataframe' self.network.addProcessor(function_to_dataframe) self.network.addConnection( hdf5_to_function.getOutport('functionVectorOutport'), function_to_dataframe.getInport('functionFlatMultiInport')) #LinePlot line_plot = self.factory.create('org.inviwo.LinePlotProcessor', glm.ivec2(0, 375)) line_plot.identifier = 'Line Plot' line_plot.getPropertyByIdentifier('allYSelection').value = True line_plot.getPropertyByIdentifier('enable_line').value = True line_plot.getPropertyByIdentifier('show_x_labels').value = False self.network.addProcessor(line_plot) self.network.addConnection( function_to_dataframe.getOutport('dataframeOutport'), line_plot.getInport('dataFrameInport')) #2DMeshRenderer mesh_render = self.factory.create('org.inviwo.Mesh2DRenderProcessorGL', glm.ivec2(0, 450)) mesh_render.identifier = 'Render' self.network.addProcessor(mesh_render) self.network.addConnection(line_plot.getOutport('outport'), mesh_render.getInport('inputMesh')) self.network.addConnection(line_plot.getOutport('labels'), mesh_render.getInport('imageInport')) #Background background = self.factory.create('org.inviwo.Background', glm.ivec2(0, 525)) background.identifier = 'Background' self.network.addProcessor(background) background.bgColor1.value = ivw.glm.vec4(1) background.bgColor2.value = ivw.glm.vec4(1) self.network.addConnection(mesh_render.getOutport('outputImage'), background.getInport('inport')) #TextOverlay text_overlay = self.factory.create('org.inviwo.TextOverlayGL', glm.ivec2(0, 600)) text_overlay.identifier = 'Text overlay GL' self.network.addProcessor(text_overlay) text_overlay.font.fontSize.value = 20 text_overlay.position.value = ivw.glm.vec2(0.43, 0.93) text_overlay.color.value = ivw.glm.vec4(0, 0, 0, 1) text_overlay.text.value = 'Energy [eV]' self.network.addConnection(background.getOutport('outport'), text_overlay.getInport('inport')) #SecondTextOverlay second_text_overlay = self.factory.create('org.inviwo.TextOverlayGL', glm.ivec2(0, 675)) second_text_overlay.identifier = 'Text overlay GL' self.network.addProcessor(second_text_overlay) second_text_overlay.font.fontSize.value = 20 second_text_overlay.position.value = ivw.glm.vec2(0.35, 0.02) second_text_overlay.color.value = ivw.glm.vec4(0, 0, 0, 1) second_text_overlay.text.value = 'Critical points in the brillouin zone' self.network.addConnection(text_overlay.getOutport('outport'), second_text_overlay.getInport('inport')) #DrawSymbols overlay_list = [] mul_iteration = 0.8 / len(KPoints) k = 0 new_iteration_list = [] print(len(sym_it_list)) for q in range(len(sym_it_list)): if k != len(sym_it_list) - 1: k = k + 1 if not np.array_equal(sym_it_list[q], sym_it_list[k]): third_text_overlay = self.factory.create( 'org.inviwo.TextOverlayGL', glm.ivec2(200 * q, 750)) self.network.addProcessor(third_text_overlay) third_text_overlay.font.fontSize.value = 20 x_cor = (mul_iteration * iteration_list[q]) + 0.1 third_text_overlay.position.value = ivw.glm.vec2( x_cor, 0.06) third_text_overlay.color.value = ivw.glm.vec4(0, 0, 0, 1) third_text_overlay.text.value = sym_it_list[q] overlay_list.append(third_text_overlay) new_iteration_list.append(iteration_list[q]) elif k == len(sym_it_list) - 1: if not np.array_equal(sym_it_list[q], sym_it_list[q - 1]): third_text_overlay = self.factory.create( 'org.inviwo.TextOverlayGL', glm.ivec2(200 * q, 750)) self.network.addProcessor(third_text_overlay) third_text_overlay.font.fontSize.value = 20 x_cor = (mul_iteration * iteration_list[q]) + 0.1 third_text_overlay.position.value = ivw.glm.vec2( x_cor, 0.06) third_text_overlay.color.value = ivw.glm.vec4(0, 0, 0, 1) third_text_overlay.text.value = sym_it_list[q] overlay_list.append(third_text_overlay) new_iteration_list.append(iteration_list[q]) self.network.addConnection(second_text_overlay.getOutport('outport'), overlay_list[0].getInport('inport')) for w in range(1, (len(overlay_list)) - 1): self.network.addConnection( overlay_list[w - 1].getOutport('outport'), overlay_list[w].getInport('inport')) self.network.addConnection(overlay_list[w].getOutport('outport'), overlay_list[w + 1].getInport('inport')) #DrawLinesToEverySymbol line_list = [] for r in range(0, len(new_iteration_list)): line_plot = self.factory.create('org.inviwo.LinePlotProcessor', glm.ivec2(200 * r, 375)) line_plot.getPropertyByIdentifier('allYSelection').value = True line_plot.getPropertyByIdentifier('enable_line').value = True line_plot.getPropertyByIdentifier('line_x_coordinate').minValue = 0 line_plot.getPropertyByIdentifier( 'line_x_coordinate').maxValue = length_iteration self.network.addProcessor(line_plot) line_plot.getPropertyByIdentifier( 'line_x_coordinate').value = new_iteration_list[r] line_list.append(line_plot) self.network.addConnection( function_to_dataframe.getOutport('dataframeOutport'), line_list[r].getInport('dataFrameInport')) self.network.addConnection(line_plot.getOutport('outport'), mesh_render.getInport('inputMesh')) #Canvas canvas = self.factory.create('org.inviwo.CanvasGL', glm.ivec2(0, 825)) canvas.identifier = 'Canvas' self.network.addProcessor(canvas) self.network.addConnection(third_text_overlay.getOutport('outport'), canvas.getInport('inport')) canvas.inputSize.dimensions.value = ivw.glm.size2_t(900, 825) canvas.widget.show() hdf5_path_selection.selection.value = '/Bandstructure/Bands'
import inviwopy import inviwopy.glm as glm app = inviwopy.app network = app.network app.network.clear() app.network.lock() bg = app.processorFactory.create("org.inviwo.Background", glm.ivec2(0, -100)) bg.backgroundStyle.selectedDisplayName = "Uniform color" bg.bgColor1.value = glm.vec4(1, 1, 1, 1) canvas = app.processorFactory.create("org.inviwo.CanvasGL", glm.ivec2(0, 0)) canvas.inputSize.dimensions.value = glm.size2_t(256, 600) network.addProcessor(bg) network.addProcessor(canvas) proc = app.processorFactory.create("org.inviwo.TextOverlayGL") fontNames = proc.font.fontFace.displayNames fontIdentifiers = proc.font.fontFace.identifiers prev = bg fontSize = 16 processorSpacing = 50 # vertical spacing of text vertTextSpacing = 1.0 / len(fontNames)
import inviwopy import inviwopy.glm as glm import ivw.utils as inviwo_utils import math app = inviwopy.app network = app.network #help(network.addProcessor) app.network.clear() app.network.lock() bg = app.processorFactory.create("org.inviwo.Background", glm.ivec2(0, -100)) bg.backgroundStyle.selectedDisplayName = "Uniform color" bg.bgColor1.value = glm.vec4(1, 1, 1, 1) canvas = app.processorFactory.create("org.inviwo.CanvasGL", glm.ivec2(0, 0)) canvas.inputSize.dimensions.value = glm.ivec2(256, 600) network.addProcessor(bg) network.addProcessor(canvas) proc = app.processorFactory.create("org.inviwo.TextOverlayGL") fontNames = proc.font.fontFace.displayName fontIdentifiers = proc.font.fontFace.identifiers prev = bg