Пример #1
0
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.')
Пример #2
0
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.')
Пример #3
0
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')
Пример #4
0
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')
Пример #5
0
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')
Пример #6
0
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')