def export_volume_exploration_images(destinationPath, camera): view = simple.GetRenderView() pvw = get_volume_piecewise(view) maxOpacity = 0.5 nbSteps = 10 step = 250.0 / float(nbSteps) span = step * 0.4 values = [float(v + 1) * step for v in range(0, nbSteps)] if pvw: idb = ImageDataSetBuilder(destinationPath, 'image/jpg', camera) idb.getDataHandler().registerArgument(priority=1, name='volume', values=values, ui='slider', loop='reverse') idb.start(view) for volume in idb.getDataHandler().volume: pvw.RemoveAllPoints() pvw.AddPoint(float(volume) - span, 0) pvw.AddPoint(float(volume), maxOpacity) pvw.AddPoint(float(volume) + span, 0) pvw.AddPoint(255, 0) idb.writeImages() idb.stop() else: print('No Volume module available')
def export_contour_exploration_images(destinationPath, camera, **kwargs): values = [int(v) for v in kwargs['multiValue'].split(',')] # View size imageWidth = kwargs['imageWidth'] imageHeight = kwargs['imageHeight'] # Configure View view = simple.GetRenderView() view.ViewSize = [imageWidth, imageHeight] contour = get_contour() if contour: originalValues = [v for v in contour.Value] idb = ImageDataSetBuilder(destinationPath, 'image/jpg', camera) idb.getDataHandler().registerArgument(priority=1, name='contour', values=values, ui='slider', loop='reverse') idb.start(view) for contourValue in idb.getDataHandler().contour: contour.Value = [contourValue] idb.writeImages() idb.stop() # Reset to original value contour.Value = originalValues else: print('Can not export Contour exploration without a Contour.')
def export_contour_exploration_images(destinationPath, camera, **kwargs): values = [int(v) for v in kwargs['multiValue'].split(',')] # View size imageWidth = kwargs['imageWidth'] imageHeight = kwargs['imageHeight'] # Configure View view = simple.GetRenderView() view.ViewSize = [imageWidth, imageHeight] contour = get_contour() if contour: originalValues = [v for v in contour.Value] idb = ImageDataSetBuilder(destinationPath, 'image/jpg', camera) idb.getDataHandler().registerArgument(priority=1, name='contour', values=values, ui='slider', loop='reverse') idb.start(view) for contourValue in idb.getDataHandler().contour: contour.Value = [contourValue] idb.writeImages() idb.stop() # Reset to original value contour.Value = originalValues else: print('Can not export Contour exploration without a Contour.')
def export_images(destinationPath, camera, **kwargs): # View size imageWidth = kwargs['imageWidth'] imageHeight = kwargs['imageHeight'] # Configure View view = simple.GetRenderView() view.ViewSize = [imageWidth, imageHeight] idb = ImageDataSetBuilder(destinationPath, 'image/jpg', camera) idb.start(view) idb.writeImages() idb.stop()
def export_images(destinationPath, camera, **kwargs): # View size imageWidth = kwargs['imageWidth'] imageHeight = kwargs['imageHeight'] # Configure View view = simple.GetRenderView() view.ViewSize = [imageWidth, imageHeight] idb = ImageDataSetBuilder(destinationPath, 'image/jpg', camera) idb.start(view) idb.writeImages() idb.stop()
def export_volume_exploration_images(destinationPath, camera, **kwargs): values = [int(v) for v in kwargs['multiValue'].split(',')] maxOpacity = float(kwargs['maxOpacity']) / 100.0 span = float(kwargs['tentWidth']) * 0.5 # View size imageWidth = kwargs['imageWidth'] imageHeight = kwargs['imageHeight'] # Configure View view = simple.GetRenderView() view.ViewSize = [imageWidth, imageHeight] pvw = get_volume_piecewise(view) if pvw: savedNodes = [] currentPoints = [0, 0, 0, 0] for i in range(pvw.GetSize()): pvw.GetNodeValue(i, currentPoints) savedNodes.append([v for v in currentPoints]) idb = ImageDataSetBuilder(destinationPath, 'image/jpg', camera) idb.getDataHandler().registerArgument(priority=1, name='volume', values=values, ui='slider', loop='reverse') idb.start(view) for volume in idb.getDataHandler().volume: pvw.RemoveAllPoints() pvw.AddPoint(float(volume) - span, 0) pvw.AddPoint(float(volume), maxOpacity) pvw.AddPoint(float(volume) + span, 0) pvw.AddPoint(255, 0) idb.writeImages() idb.stop() # Reset to original piecewise funtion pvw.RemoveAllPoints() for node in savedNodes: pvw.AddPoint(node[0], node[1], node[2], node[3]) else: print('Can not export Volume exploration without a Volume')
def export_contour_exploration_images(destinationPath, camera): view = simple.GetRenderView() contour = get_contour() nbSteps = 10 step = 250.0 / float(nbSteps) values = [float(v + 1) * step for v in range(0, nbSteps)] if contour: idb = ImageDataSetBuilder(destinationPath, 'image/jpg', camera) idb.getDataHandler().registerArgument(priority=1, name='contour', values=values, ui='slider', loop='reverse') idb.start(view) for contourValue in idb.getDataHandler().contour: contour.Value = [contourValue] idb.writeImages() idb.stop() else: print('No contour module available')
def export_volume_exploration_images(destinationPath, camera, **kwargs): values = [int(v) for v in kwargs['multiValue'].split(',')] maxOpacity = float(kwargs['maxOpacity']) / 100.0 span = float(kwargs['tentWidth']) * 0.5 # View size imageWidth = kwargs['imageWidth'] imageHeight = kwargs['imageHeight'] # Configure View view = simple.GetRenderView() view.ViewSize = [imageWidth, imageHeight] pvw = get_volume_piecewise(view) if pvw: savedNodes = [] currentPoints = [0, 0, 0, 0] for i in range(pvw.GetSize()): pvw.GetNodeValue(i, currentPoints) savedNodes.append([v for v in currentPoints]) idb = ImageDataSetBuilder(destinationPath, 'image/jpg', camera) idb.getDataHandler().registerArgument(priority=1, name='volume', values=values, ui='slider', loop='reverse') idb.start(view) for volume in idb.getDataHandler().volume: pvw.RemoveAllPoints() pvw.AddPoint(float(volume) - span, 0) pvw.AddPoint(float(volume), maxOpacity) pvw.AddPoint(float(volume) + span, 0) pvw.AddPoint(255, 0) idb.writeImages() idb.stop() # Reset to original piecewise funtion pvw.RemoveAllPoints() for node in savedNodes: pvw.AddPoint(node[0], node[1], node[2], node[3]) else: print('Can not export Volume exploration without a Volume')
os.path.join(ROOT_OUTPUT_DIRECTORY, '%s%s' % (sceneName, FILENAME_EXTENSION))): counter += 1 sceneName = '%s (%d)' % (fileName, counter) return sceneName # ----------------------------------------------------------------------------- # Generate Export # ----------------------------------------------------------------------------- dsb = ImageDataSetBuilder(outputDir, 'image/jpg', camera, METADATA) dsb.start(view) dsb.writeImages() dsb.stop() # ----------------------------------------------------------------------------- # Now zip up the results and get rid of the temp directory # ----------------------------------------------------------------------------- try: sceneName except NameError: sceneName = generateSceneName() sceneFileName = os.path.join(ROOT_OUTPUT_DIRECTORY, '%s%s' % (sceneName, FILENAME_EXTENSION)) try: import zlib
def export_images(destinationPath, camera): view = simple.GetRenderView() idb = ImageDataSetBuilder(destinationPath, 'image/jpg', camera) idb.start(view) idb.writeImages() idb.stop()
counter = 0 while os.path.isfile(os.path.join(ROOT_OUTPUT_DIRECTORY, '%s%s' % (sceneName, FILENAME_EXTENSION))): counter += 1 sceneName = '%s (%d)' % (fileName, counter) return sceneName # ----------------------------------------------------------------------------- # Generate Export # ----------------------------------------------------------------------------- dsb = ImageDataSetBuilder(outputDir, 'image/jpg', camera, METADATA) dsb.start(view) dsb.writeImages() dsb.stop() # ----------------------------------------------------------------------------- # Now zip up the results and get rid of the temp directory # ----------------------------------------------------------------------------- try: sceneName except NameError: sceneName = generateSceneName() sceneFileName = os.path.join(ROOT_OUTPUT_DIRECTORY, '%s%s' % (sceneName, FILENAME_EXTENSION)) try: import zlib compression = zipfile.ZIP_DEFLATED