Exemplo n.º 1
0

defaultMoveNodeColor = color.RGBColor(1.0, 0.5, 0.5)
defaultMoveNodeSize = 3


def _setDefaultMoveNodeParams(menuitem, color, size):
    global defaultMoveNodeSize
    global defaultMoveNodeColor
    defaultMoveNodeColor = color
    defaultMoveNodeSize = size


movenodeparams = [
    color.ColorParameter('color',
                         defaultMoveNodeColor,
                         tip="Color for the to-be-moved node."),
    parameter.IntRangeParameter('size', (0, 10),
                                defaultMoveNodeSize,
                                tip="Node size.")
]

mainmenu.gfxdefaultsmenu.Skeletons.addItem(
    oofmenu.OOFMenuItem(
        'Moving_Nodes',
        callback=_setDefaultMoveNodeParams,
        params=movenodeparams,
        ordering=7,
        help="Set default parameters for the Move Node toolbox displays.",
        discussion="""<para>
Exemplo n.º 2
0
                self.lock.release()

    defaultLineWidth = 0
    widthRange = (0, 10)

    registeredclass.Registration(
        'Contour Line',
        display.DisplayMethod,
        PlainContourDisplay,
        ordering=3.0,
        layerordering=display.Linear(1),
        whoclasses=('Mesh', ),
        params=contourparams + [
            IntRangeParameter(
                'width', widthRange, defaultLineWidth, tip="line width"),
            color.ColorParameter('color', color.black, tip="line color")
        ],
        tip="Draw contour lines for the given output data.",
        discussion=xmlmenudump.loadFile(
            'DISCUSSIONS/engine/reg/plaincontour.xml'))

#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#=*=#


class FilledContourDisplay(ContourDisplay):
    def __init__(self,
                 when,
                 what,
                 where,
                 min=automatic.automatic,
                 max=automatic.automatic,
Exemplo n.º 3
0

defaultPinNodeColor = color.RGBColor(0.93, 0.93, 0.0)
defaultPinNodeSize = 2


def _setPinNodeParams(menuitem, color, size):
    global defaultPinNodeColor
    global defaultPinNodeSize
    defaultPinNodeColor = color
    defaultPinNodeSize = size


pinnodeparams = [
    color.ColorParameter('color',
                         defaultPinNodeColor,
                         tip="Color for the pinned nodes."),
    parameter.IntRangeParameter('size', (0, 10),
                                defaultPinNodeSize,
                                tip="Node size.")
]

mainmenu.gfxdefaultsmenu.Skeletons.addItem(
    oofmenu.OOFMenuItem(
        'Pinned_Nodes',
        callback=_setPinNodeParams,
        params=pinnodeparams,
        ordering=6,
        help="Set default parameters for displaying pinned skeleton nodes.",
        discussion="""<para>
Exemplo n.º 4
0

defaultSegSelColor = color.RGBColor(0.13, 0.93, 0.25)
defaultSegSelWidth = 2


def _setSegSelParams(menuitme, color, line_width):
    global defaultSegSelColor
    global defaultSegSelWidth
    defaultSegSelColor = color
    defaultSegSelWidth = line_width


segselparams = [
    color.ColorParameter('color',
                         defaultSegSelColor,
                         tip="Color for the selected segments."),
    parameter.IntRangeParameter('line_width', (0, 10),
                                defaultSegSelWidth,
                                tip="Line width.")
]

mainmenu.gfxdefaultsmenu.Skeletons.addItem(
    oofmenu.OOFMenuItem(
        'Selected_Segments',
        callback=_setSegSelParams,
        ordering=3,
        params=segselparams,
        help=
        "Set default parameters for displaying selected skeleton segments.",
        discussion="""<para>
Exemplo n.º 5
0
    widthRange = (0, 10)
# In vtk, line widths of 0 cause errors
elif config.dimension() == 3:
    widthRange = (1, 10)


def _setMeshCSDefaults(menuitem, color, linewidth):
    global defaultMeshCSColor
    global defaultMeshCSLineWidth
    defaultMeshCSColor = color
    defaultMeshCSLineWidth = linewidth


meshcsdispparams = [
    color.ColorParameter('color',
                         value=defaultMeshCSColor,
                         tip="In which color?"),
    parameter.IntRangeParameter('linewidth',
                                widthRange,
                                defaultMeshCSLineWidth,
                                tip="Thickness of the line.")
]

mainmenu.gfxdefaultsmenu.Meshes.addItem(
    oofmenu.OOFMenuItem(
        "Cross_Section",
        callback=_setMeshCSDefaults,
        params=meshcsdispparams,
        ordering=3,
        help="Set default parameters for Mesh Cross Section displays.",
        discussion="""<para>
Exemplo n.º 6
0
if config.dimension() == 2:
    widthRange = (0, 10)
# In vtk, line widths of 0 cause errors
elif config.dimension() == 3:
    widthRange = (1, 10)

skeletonBoundaryDisplay = registeredclass.Registration(
    'Boundaries',
    display.DisplayMethod,
    SkeletonBoundaryDisplay,
    params=[
        SkeletonBoundaryListParameter('boundaries', [],
                                      tip="Boundaries to display."),
        color.ColorParameter('color',
                             value=color.gray50,
                             tip="Color for the displayed boundaries."),
        parameter.IntRangeParameter('linewidth',
                                    widthRange,
                                    4,
                                    tip="Line width for edge boundaries."),
        parameter.IntRangeParameter('dotsize',
                                    widthRange,
                                    4,
                                    tip="Dot radius for point boundaries."),
        parameter.IntRangeParameter('arrowsize', (0, 20),
                                    10,
                                    tip="Arrow size for edge boundaries.")
    ],
    ordering=1.0,
    layerordering=display.SemiLinear(2),
Exemplo n.º 7
0
# method gives it a timestamp.

defaultSelectedElementColor = color.RGBColor(0.88, 0.14, 0.07)
defaultSelectedElementOpacity = 0.6


def _setSelectedElementParams(menuitem, color, opacity):
    global defaultSelectedElementColor
    global defaultSelectedElementOpacity
    defaultSelectedElementColor = color
    defaultSelectedElementOpacity = opacity


selectedElementParams = [
    color.ColorParameter('color',
                         defaultSelectedElementColor,
                         tip="Color for the selected elements."),
    parameter.FloatRangeParameter('opacity', (0., 1., 0.01),
                                  defaultSelectedElementOpacity,
                                  tip="Opacity of the selected elements.")
]

mainmenu.gfxdefaultsmenu.Skeletons.addItem(
    oofmenu.OOFMenuItem(
        'Selected_Elements',
        callback=_setSelectedElementParams,
        ordering=1,
        params=selectedElementParams,
        help=
        "Set default parameters for displaying selected skeleton elements.",
        discussion="""<para>
Exemplo n.º 8
0
        if device.has_alpha():
            if config.dimension() == 2:
                device.draw_alpha_image(bitmap, coord.Coord(0, 0),
                                        bitmap.size())
            elif config.dimension() == 3:
                bitmap.setVoxelAlpha(self.voxelOpacity)
                device.draw_alpha_image(bitmap, coord.Coord(0, 0, 0),
                                        bitmap.size())

    def getTimeStamp(self, gfxwindow):
        return self.timestamp


if config.dimension() == 2:
    bitoverlayparams = [
        color.ColorParameter('color', tip="Bitmap color."),
        parameter.FloatRangeParameter('tintOpacity', (0., 1., 0.01),
                                      0.6,
                                      tip="Opacity of the overlay.")
    ]
elif config.dimension() == 3:
    bitoverlayparams = [
        color.ColorParameter('color', tip="Bitmap color."),
        parameter.FloatRangeParameter('tintOpacity', (0., 1., 0.01),
                                      0.0,
                                      tip="Opacity of the tint."),
        parameter.FloatRangeParameter('voxelOpacity', (0., 1., 0.01),
                                      0.2,
                                      tip="Opacity of the given region.")
    ]
Exemplo n.º 9
0
                       element_width, segment_width):
    global defaultSkelInfoQueryColor
    global defaultSkelInfoPeekColor
    global defaultSkelInfoNodeSize
    global defaultSkelInfoElemWidth
    global defaultSkelInfoSgmtWidth
    defaultSkelInfoQueryColor = query_color
    defaultSkelInfoPeekColor = peek_color
    defaultSkelInfoNodeSize = node_size
    defaultSkelInfoElemWidth = element_width
    defaultSkelInfoSgmtWidth = segment_width


skelinfoparams = [
    color.ColorParameter('query_color',
                         defaultSkelInfoQueryColor,
                         tip="Color for the queried objects."),
    color.ColorParameter('peek_color',
                         defaultSkelInfoPeekColor,
                         tip="Color for the peeked objects."),
    parameter.IntRangeParameter('node_size',
                                widthRange,
                                defaultSkelInfoNodeSize,
                                tip="Node size."),
    parameter.IntRangeParameter('element_width',
                                widthRange,
                                defaultSkelInfoElemWidth,
                                tip="Line width for elements."),
    parameter.IntRangeParameter('segment_width',
                                widthRange,
                                defaultSkelInfoSgmtWidth,
Exemplo n.º 10
0
            ms = context.getObject(self.gfxwindow)
            if ms:
                mnames = [m.name() for m in material.getMaterials(ms)]
                if materialname in mnames:
                    self.whoChanged()


registeredclass.Registration(
    'Material',
    display.DisplayMethod,
    MicrostructureMaterialDisplay,
    ordering=0,
    layerordering=display.Planar(0.4),
    params=[
        color.ColorParameter(
            'no_material',
            color.black,
            tip="Color to use if no material has been assigned to a pixel"),
        color.ColorParameter(
            'no_color',
            color.blue,
            tip="Color to use if the assigned material has no assigned color"),
        parameter.FloatRangeParameter("opacity",
                                      bitmapdisplay.opacityRange,
                                      bitmapdisplay.defaultImageOpacity,
                                      tip="Opacity of material colors."),
        parameter.RegisteredParameter("filter",
                                      voxelfilter.VoxelFilterPtr,
                                      voxelfilter.AllVoxels(),
                                      tip="Voxels to include in the display.")
    ],
    whoclasses=('Microstructure', ),
Exemplo n.º 11
0
    def setParams(self):
        self.canvaslayer.set_color(self.color)
        self.canvaslayer.set_opacity(self.opacity)


def _setSelectedElementParams(menuitem, color, opacity):
    global defaultSelectedElementColor
    global defaultSelectedElementOpacity
    defaultSelectedElementColor = color
    defaultSelectedElementOpacity = opacity


selectedElementParams = [
    color.ColorParameter('color',
                         defaultSelectedElementColor,
                         tip="Color for the selected elements."),
    parameter.FloatRangeParameter('opacity', (0., 1., 0.01),
                                  defaultSelectedElementOpacity,
                                  tip="Opacity of the selected elements.")
]

mainmenu.gfxdefaultsmenu.Skeletons.addItem(
    oofmenu.OOFMenuItem(
        'Selected_Elements',
        callback=_setSelectedElementParams,
        ordering=1,
        params=selectedElementParams,
        help=
        "Set default parameters for displaying selected skeleton elements.",
        discussion="""<para>
    defaultClipPlaneClickAndDragArrowLength = arrow_length
    global defaultClipPlaneClickAndDragColor
    defaultClipPlaneClickAndDragColor = plane_color
    global defaultClipPlaneClickAndDragOpacity
    defaultClipPlaneClickAndDragOpacity = plane_opacity
    global defaultHideInactive
    defaultHideInactive = hide_inactive
    global defaultDimInactive
    defaultDimInactive = dim_inactive


# Sizing and coloring options for the plane-arrow pair, which can be
# set in the graphics defaults menu.
clipplaneclickanddragparams = [
    color.ColorParameter(
        'arrow_color',
        defaultClipPlaneClickAndDragArrowColor,
        tip="Color of the arrow representing the normal vector."),
    parameter.FloatRangeParameter('arrow_tip_radius',
                                  radiusRange,
                                  defaultClipPlaneClickAndDragArrowTipRadius,
                                  tip="Radius of the arrow tip."),
    parameter.FloatRangeParameter(
        'arrow_length',
        lengthRange,
        defaultClipPlaneClickAndDragArrowLength,
        tip="Length of the arrow relative to the plane"),
    color.ColorParameter('plane_color',
                         defaultClipPlaneClickAndDragColor,
                         tip="Color of the plane."),
    parameter.FloatRangeParameter('plane_opacity',
                                  opacityRange,
Exemplo n.º 13
0
            ms.drawVoxelSetBoundary(self.canvaslayer, self.category)

    def whoChanged(self):
        return True  # call setParams


if debug.debug:
    registeredclass.Registration(
        "VoxelSetBdy",
        display.DisplayMethod,
        VoxelSetBdyDisplay,
        ordering=1000,
        layerordering=display.Linear,
        params=[
            parameter.IntParameter("category", 0),
            color.ColorParameter('color', color.RGBColor(0, 0.7, 0.3)),
            parameter.IntRangeParameter('line_width', (1, 10), 4)
        ],
        whoclasses=('Microstructure', ),
        tip="Display boundary loops of voxel categories")

# class Normal(enum.EnumClass("Positive", "Negative", "Any")):
#     pass

# class Direction(enum.EnumClass("X", "Y", "Z", "All")):
#     pass

# dirDict = {Direction("X") : 0,
#            Direction("Y") : 1,
#            Direction("Z") : 2,
#            Direction("All") : -1}
Exemplo n.º 14
0
                   self.who().resolve(gfxwindow).nodeselection.timestamp)

defaultNodeSelColor = color.RGBColor(0.07, 0.09, 0.96)
defaultNodeSelSize = 2


def _setNodeSelParams(menuitem, color, size):
    global defaultNodeSelColor
    global defaultNodeSelSize
    defaultNodeSelColor = color
    defaultNodeSelSize = size


nodeselparams = [
    color.ColorParameter('color',
                         defaultNodeSelColor,
                         tip="Color for the selected nodes."),
    parameter.IntRangeParameter('size', (0, 10),
                                defaultNodeSelSize,
                                tip="Node size.")
]

mainmenu.gfxdefaultsmenu.Skeletons.addItem(
    oofmenu.OOFMenuItem(
        'Selected_Nodes',
        callback=_setNodeSelParams,
        ordering=2,
        params=nodeselparams,
        help="Set default parameters for displaying selected skeleton nodes.",
        discussion="""<para>
Exemplo n.º 15
0

def _setDefaultPixelParams(menuitem, color, line_width):  #, opacity):
    global defaultPixelInfoColor
    defaultPixelInfoColor = color
    global defaultLineWidth
    defaultLineWidth = line_width


##     global defaultOpacity
##     defaultOpacity = opacity

## if config.dimension() == 2:
pixelinfoparams = [
    color.ColorParameter('color',
                         defaultPixelInfoColor,
                         tip="Color for the queried pixel."),
    parameter.IntRangeParameter('line_width',
                                widthRange,
                                defaultLineWidth,
                                tip="Line width.")
]
## elif config.dimension() == 3:
##     pixelinfoparams = [color.ColorParameter('color', defaultPixelInfoColor,
##                                             tip="Color for the queried pixel."),
##                        parameter.FloatRangeParameter('opacity', (0., 1., 0.01),
##                                                    defaultOpacity,
##                                                    tip="Tint Opacity.")]

mainmenu.gfxdefaultsmenu.Pixels.addItem(
    oofmenu.OOFMenuItem(
Exemplo n.º 16
0
# Sizing and coloring options for the box and arrow. These can be
# set in the graphics defaults menu.
voxelregionselectionparams = [
    parameter.FloatRangeParameter(
        'point_size', 
        pointSizeRange,
        defaultVoxelRegionSelectionPointSize,
        tip="Size of the points on the corners of the box."),
    parameter.FloatRangeParameter(
        'line_width', 
        lineWidthRange,
        defaultVoxelRegionSelectionLineWidth,
        tip="Width of the lines on the edges of the box."),
    color.ColorParameter(
        'line_color', 
        defaultVoxelRegionSelectionLineColor,
        tip="Color for the edges of the box."), 
    color.ColorParameter(
        'face_color', 
        defaultVoxelRegionSelectionFaceColor,
        tip="Color of the faces of the box."),                   
    parameter.FloatRangeParameter(
        'face_opacity', 
        opacityRange,                                                 
        defaultVoxelRegionSelectionFaceOpacity,
        tip="Opacity of the faces of the box.  Probably best left at 1.0."),
    parameter.FloatRangeParameter(
        'other_opacity',
        opacityRange,
        defaultVoxelRegionSelectionOtherOpacity,
        tip="Opacity of other objects while editing the box."),
Exemplo n.º 17
0
#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=#

# Default parameters for boundary displays

defaultSkelBdyColor = color.orange
defaultSkelBdyLineWidth = 4

if config.dimension() == 2:
    widthRange = (0,10)
else:
    # In vtk, line widths of 0 cause errors
    widthRange = (1,10)

skelbdyparams = [
    color.ColorParameter('color', value=defaultSkelBdyColor,
                         tip="Color for the selected boundary."),
    parameter.IntRangeParameter('linewidth', widthRange,
                                defaultSkelBdyLineWidth,
                                tip="Line width for edge boundaries.")]

if config.dimension() == 2:
    defaultSkelBdyGlyphSize = 10
    skelbdyparams.append(
         parameter.IntRangeParameter('glyphsize', (0, 20),
                                     defaultSkelBdyGlyphSize,
                                     tip="Arrow size for edge boundaries."))

elif config.dimension() == 3:
    defaultSkelBdyGlyphSize = automatic.automatic
    defaultSkelBdyGlyphResolution = 20
    skelbdyparams.extend(
Exemplo n.º 18
0
def _setMeshInfoParams(menuitem, query_color, peek_color, node_size,
                       line_width):
    global defaultQueryColor
    global defaultPeekColor
    global defaultNodeSize
    global defaultLineWidth
    defaultQueryColor = query_color
    defaultPeekColor = peek_color
    defaultNodeSize = node_size
    defaultLineWidth = line_width


meshinfoparams = [
    color.ColorParameter('query_color',
                         defaultQueryColor,
                         tip="Color for the queried object."),
    color.ColorParameter('peek_color',
                         defaultPeekColor,
                         tip="Color for the peeked object."),
    parameter.IntRangeParameter('node_size',
                                widthRange,
                                defaultNodeSize,
                                tip="Node size."),
    parameter.IntRangeParameter('line_width',
                                widthRange,
                                defaultLineWidth,
                                tip="Line thickness for element edge.")
]

mainmenu.gfxdefaultsmenu.Meshes.addItem(
Exemplo n.º 19
0
###################

defaultPixelSelectionColor = color.RGBColor(1.0, 0.22, 0.09)
defaultTintOpacity = 0.9


def _setDefaultPixelSelectionParams(menuitem, color, tintOpacity):
    global defaultPixelSelectionColor
    global defaultTintOpacity
    defaultPixelSelectionColor = color
    defaultTintOpacity = tintopacity


colorparams = [
    color.ColorParameter('color',
                         defaultPixelSelectionColor,
                         tip='Color of selected pixels.'),
    parameter.FloatRangeParameter('tintOpacity', (0., 1., 0.01),
                                  defaultTintOpacity,
                                  tip='Opacity of tint of selected pixels.'
                                  '  0 is transparent, 1 is opaque.')
]

mainmenu.gfxdefaultsmenu.Pixels.addItem(
    oofmenu.OOFMenuItem(
        'Pixel_Selection',
        callback=_setDefaultPixelSelectionParams,
        params=colorparams,
        help="Set default parameters for displaying selected pixels.",
        discussion="""<para>
Exemplo n.º 20
0
def _setDefaultSkeletonEdgeParams(menuitem, color, width):
    global defaultSkeletonColor
    defaultSkeletonColor = color
    global defaultSkeletonWidth
    defaultSkeletonWidth = width


mainmenu.gfxdefaultsmenu.Skeletons.addItem(
    oofmenu.OOFMenuItem(
        'Skeleton_Edges',
        callback=_setDefaultSkeletonEdgeParams,
        ordering=0,
        params=[
            color.ColorParameter('color',
                                 defaultSkeletonColor,
                                 tip=parameter.emptyTipString),
            IntRangeParameter('width',
                              widthRange,
                              defaultSkeletonWidth,
                              tip="Line thickness, in pixels.")
        ],
        help="Set the default parameters for Skeleton edge displays.",
        discussion="""<para>

    Set the default parameters for
    <link linkend="RegisteredClass-SkeletonEdgeDisplay"><classname>SkeletonEdgeDisplays</classname></link>.
    See <xref linkend="RegisteredClass-SkeletonEdgeDisplay"/> for the details.      This command may be placed in the &oof2rc; file
    to set a default value for all &oof2; sessions.

    </para>"""))
Exemplo n.º 21
0
if config.dimension() == 2:
    defaultSkeletonWidth = 0
    defaultMeshWidth = 0
    widthRange = (0, 10)
# In vtk, line widths of 0 cause errors
elif config.dimension() == 3:
    defaultSkeletonWidth = 1
    defaultMeshWidth = 1
    widthRange = (1, 10)
defaultSkeletonColor = color.black
defaultMeshColor = color.black
defaultSkeletonFilter = skeletonfilter.NullFilter()
defaultMeshFilter = skeletonfilter.MaterialFilter('<Any>')

skelColorParam = color.ColorParameter('color',
                                      defaultSkeletonColor,
                                      tip=parameter.emptyTipString)
skelWidthParam = IntRangeParameter('width',
                                   widthRange,
                                   defaultSkeletonWidth,
                                   tip="Line thickness, in pixels.")

meshColorParam = color.ColorParameter('color',
                                      defaultMeshColor,
                                      tip=parameter.emptyTipString)
meshWidthParam = IntRangeParameter('width',
                                   widthRange,
                                   defaultMeshWidth,
                                   tip="Line thickness, in pixels.")

# Use the same filter parameter for all Mesh displays ...