Commit 5fd4a873 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

ENH: scaffolding for new subsample option

parent 19a0ee63
......@@ -343,6 +343,7 @@ def _initPropertyList_VolumeRGBOpts(threedee):
def _initPropertyList_TractogramOpts(threedee):
return ['lineWidth',
'resolution',
'subsample',
'custom_colourMode',
'clipMode',
'custom_cmap',
......@@ -958,6 +959,7 @@ def _initWidgetSpec_TractogramOpts(displayCtx, threedee):
'suppressMode' : props.Widget('suppressMode', **orientOpts),
'lineWidth' : props.Widget('lineWidth', **sliderOpts),
'resolution' : props.Widget('resolution', **sliderOpts),
'subsample' : props.Widget('subsample', **sliderOpts),
# We override the ColourMapOpts definitions
# for custom enabledWhen behaviour.
......
......@@ -65,10 +65,21 @@ class TractogramOpts(fsldisplay.DisplayOpts,
"""
def __init__(self, *args, **kwargs):
subsample = props.Percentage(default=100)
"""Draw a random sub-sample of all streamlines. This is useful when drawing
very large tractograms.
"""
def __init__(self, overlay, *args, **kwargs):
"""Create a ``TractogramOpts`` instance. """
fsldisplay.DisplayOpts .__init__(self, *args, **kwargs)
# Default to drawing a random sub-sample
# of streamlines for large tractograms
if overlay.nstreamlines > 150000:
self.subsample = 15000000 / overlay.nstreamlines
fsldisplay.DisplayOpts .__init__(self, overlay, *args, **kwargs)
cmapopts .ColourMapOpts.__init__(self)
vectoropts.VectorOpts .__init__(self)
......
......@@ -618,6 +618,7 @@ OPTIONS = td.TypeDict({
'clipBy',
'lineWidth',
'resolution',
'subsample',
'linkLowRanges',
'linkHighRanges',
'useNegativeCmap',
......@@ -962,6 +963,7 @@ ARGUMENTS = td.TypeDict({
'TractogramOpts.clipBy' : ('cl', 'clipBy', True),
'TractogramOpts.lineWidth' : ('lw', 'lineWidth', True),
'TractogramOpts.resolution' : ('r', 'resolution', True),
'TractogramOpts.subsample' : ('s', 'subsample', True),
})
"""This dictionary defines the short and long command line flags to be used
for every option. Each value has the form::
......@@ -1319,9 +1321,11 @@ HELP = td.TypeDict({
'for clipping, or name of a a per-vertex/streamline data set contained '
'within the tractogram file.',
'TractogramOpts.lineWidth' :
'Streamline width (pixels)',
'Streamline width/diameter',
'TractogramOpts.resolution' :
'Streamline resolution',
'Streamline resolution/quality',
'TractogramOpts.subsample' :
'Draw a randomly selected subsample of streamlines.',
})
"""This dictionary defines the help text for all command line options."""
......
......@@ -1282,6 +1282,7 @@ properties = TypeDict({
'TractogramOpts.colourMode' : 'Colour by',
'TractogramOpts.lineWidth' : 'Width',
'TractogramOpts.resolution' : 'Resolution',
'TractogramOpts.subsample' : 'Sub-sample',
})
......
......@@ -442,6 +442,9 @@ properties = TypeDict({
'TractogramOpts.resolution' :
'Controls the quality when drawing streamline tubes (in 3D) or vertex '
'points (in 2D).',
'TractogramOpts.subsample' :
'Draw a randomly selected subset of streamlines. This setting is useful '
'when viewing very large tractograms.',
# MIPOpts
'MIPOpts.window' :
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment