fsleyes.parseargs
This module encapsulates the logic for parsing command line arguments which
specify a scene to be displayed in FSLeyes. This logic is shared between
the fsleyes and render tools. This module make use of the
command line generation features of the props package. Broadly
speaking, this module can be used to do three things:
_Parse_ command line arguments, generating an
argparse.Namespaceobject which contains the parsed options._Apply_ the options contained in an
argparse.Namespaceoption to the objects which describe a scene - aSceneOptsinstance, aDisplayContextinstance, and theDisplayandDisplayOptsinstances for each overlay._Generate_ command line arguments that can be used to describe an existing scene.
There are a lot of command line arguments made available to the user, broadly split into the following groups:
Main arguments control the overall scene display, such as the display type (e.g. orthographic or lightbox), the displayed location, and whether to show a colour bar. These arguemnts generally correspond to properties of the
SceneOpts,OrthoOpts,LightBoxOptsandDisplayContextclasses.Display arguments control the display for a single overlay file (e.g. a NIFTI image), such as interpolation, colour map, etc. These arguments correspond to properties of the
Displayclass, and sub-classes ofDisplayOpts.
This module provides the following functions:
Parses the given command line arguments, returning an |
|
Applies top-level arguments that are not specific to the scene or any overlays. |
|
Configures the scene displayed by the given |
|
Loads and configures any overlays which were specified on the command line. |
|
Generates command line arguments which describe the current state of the provided |
|
Generates command line arguments which describe the display of the current overlay. |
Usage
Call the parseArgs() function to parse all command line arguments. Then
create a DisplayContext and OverlayList, and pass them,
along with the argparse.Namespace object, to the applyMainArgs(),
applySceneArgs() and applyOverlayArgs()
functions. applyMainArgs() should be called first, but the order of the
latter two does not matter.
argparse modifications
The argparse module is quite frustrating to work with for the command
line interface that I want to provide. Therefore, this module modifies
the behaviour of argparse.ArgumentParser instances (by monkey-patching
instances - not the class itself) such that:
Prefix matching (a.k.a. abbreviation) is disabled
An error is raised when invalid arguments are passed, rather than the program exiting.
Command line parsing procedure
- FSLeyes command line arguments are processed using the following procedure
(implemented in the
parseArgs()function):All overlay paths are identified.
Main arguments are separated out from the display arguments for every overlay.
Main arguments are parsed.
The display arguments for each overlay are parsed, using a parser that is only configured to identify the overlay type.
The display arguments for each overlay are parsed again, using a parser that is configured to handle arguments specific to the overlay type.
Adding new command line options
Many classes in FSLeyes derive from the HasProperties class of the
props package. Therefore, with only a couple of exceptions, the
processing of nearly all FSLeyes command line arguments is completely
automatic.
Therefore, adding a new command line option is fairly easy. For example,
let’s say you have added a new property on the MeshOpts class,
called rotation:
class MeshOpts(fsldisplay.DisplayOpts):
# .
# .
# .
rotation = props.Int(minval=0, maxval=360, clamped=True)
# .
# .
# .
To make this new propery settable via the command line, you need to:
Add an entry to the
OPTIONSdictionary:OPTIONS = td.TypeDict({ # . # . # . 'MeshOpts' : ['colour', 'outline', 'outlineWidth', 'refImage', 'rotation'], # . # . # . })Specify the command line flags to use, in the
ARGUMENTSdictionary:ARGUMENTS = td.TypeDict({ # . # . # . 'MeshOpts.rotation' : ('mr', 'meshRotation', True), # . # . # . })Add a description in the
HELPdictionary:HELP = td.TypeDict({ # . # . # . 'MeshOpts.rotation' : 'Rotate the mesh by this much', # . # . # . })
Adding special (non-property) options
If you need to add an option which does not directly map to a
SceneOpts or DisplayOpts property, or if you need to perform
some custom/extra processing for a property, you need to do some extra
work. For example, let’s say we wish to add a custom option clipAndDisplay
to modify both the clippingRange and displayRange properties of the
VolumeOpts class.
Following steps 1-3 above, we add
'clipAndDisplay'to theOPTIONS['VolumeOpts']list, and add a'VolumeOpts.clipAndDisplay'entries to theARGUMENTSandHELPdictionaries.Add a function which configures the argument parser for your option. The function must have the following signature:
def _configSpecial_[target]_[option]( target, # The class with which the option is associated parser, # The ArgumentParser to be configured shortArg, # String to use as the short form argument longArg, # String to use as the longform argument helpText # Help text )
where
targetis the name of theDisplayOptsclass you are adding an option for (e.g.'VolumeOpts'), andoptionis the option name. In our example, we would add a function:def _configSpecial_VolumeOpts_clipAndDisplay(...):
This function simply needs to add the option to the
ArgumentParserinstance.Add a function which applies parsed command line arguments for your option. The function must have the following signature:
def _applySpecial_[target]_[option]( args, # argparse.Namespace object containing parsed arguments overlayList, # The OverlayList instance displayCtx, # The DisplayContext instance target # The target instance (e.g. a VolumeOpts instance) )
Apply functions should typically return
NoneorFalse, which indicates that the argument has been fully processed. However, if you have a property for which you need to perform some pre-processing, but you also want to be handled byfsleyes_props.applyArguments(), you can have your apply function returnTrue, which indicates that the arguemnt should be passed through toapplyArguments, in addition to being handled by your apply function.Add a function which, given a
targetinstance, will generate command line arguments that can reproduce thetargetstate. This function must have the following signature:def _generateSpecial_[target]_[option]( overlayList, # The OverlayList instance displayCtx, # The DisplayContext instance source, # The source instance longArg # String to use as the long form argument )
In a similar vein to the apply function, described above, a generate function may return a value of
False, indicating that the argument should be passed through to thefsleyes_props.generateArguments()function.
- fsleyes.parseargs.CMAP_CYCLE = ['greyscale', 'red-yellow', 'blue-lightblue', 'green', 'yellow', 'hot', 'cool', 'copper', 'pink', 'red', 'blue', 'yellow']
Default colour map cycle applied to
volumeoverlays when the--cmapCycleoption is used.
- fsleyes.parseargs._get_option_tuples(self, option_string)[source]
By default, the
argparsemodule uses a prefix matching strategy, which allows the user to (unambiguously) specify only part of an argument.While this may be a good idea for simple programs with a small number of arguments, it is very disruptive to the way that I have designed this module.
To disable this prefix matching functionality, this function is monkey-patched into all ArgumentParser instances created in this module.
This functionality can be disabled by setting the
allow_abbrevoption to theArgumentParsertoFalse, but use ofallow_abbrev=Falsebreaks support for concatenating single-prefix arguments with their values, e.g. (-sorthofor--scene ortho). So we use this work-around instead.See http://stackoverflow.com/questions/33900846/ disable-unique-prefix-matches-for-argparse-and-optparse
- exception fsleyes.parseargs.ArgumentError[source]
Bases:
ExceptionCustom
Exceptionclass raised byArgumentParserinstances created and used in this module.- __module__ = 'fsleyes.parseargs'
- __weakref__
list of weak references to the object
- fsleyes.parseargs.ArgumentParser(*args, **kwargs)[source]
Wrapper around the
argparse.ArgumentParser` constructor which creates, monkey-patches, and returns an ``ArgumentParserinstance.
- class fsleyes.parseargs.FSLeyesHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)[source]
Bases:
RawDescriptionHelpFormatterA custom
argparse.HelpFormatterclass which customises a few annoying things about defaultargparsebehaviour.- __module__ = 'fsleyes.parseargs'
- fsleyes.parseargs.OPTIONS = {'Main': ['help', 'fullhelp', 'verbose', 'version', 'skipfslcheck', 'updatecheck', 'noisy', 'glversion', 'scene', 'voxelLoc', 'worldLoc', 'selectedOverlay', 'ungroupOverlays', 'autoDisplay', 'displaySpace', 'neuroOrientation', 'hideOrientationWarnings', 'standard', 'standard_brain', 'standard1mm', 'standard1mm_brain', 'initialDisplayRange', 'robustRange', 'cmapCycle', 'bigmem', 'fontSize', 'notebook', 'notebookFile', 'notebookPort', 'noBrowser', 'annotations', 'no3DInterp', 'showAllPlugins', 'autoName'], 'Extras': ['nolink', 'bumMode'], 'SceneOpts': ['showCursor', 'cursorWidth', 'bgColour', 'fgColour', 'cursorColour', 'showColourBar', 'colourBarLocation', 'colourBarLabelSide', 'colourBarSize', 'labelSize', 'performance', 'movieSyncRefresh'], 'OrthoOpts': ['xzoom', 'yzoom', 'zzoom', 'cursorGap', 'showLabels', 'showLocation', 'layout', 'showXCanvas', 'showYCanvas', 'showZCanvas', 'xcentre', 'ycentre', 'zcentre', 'invertXVertical', 'invertXHorizontal', 'invertYVertical', 'invertYHorizontal', 'invertZVertical', 'invertZHorizontal'], 'LightBoxOpts': ['zax', 'asVoxels', 'zrange', 'sliceSpacing', 'sampleSlices', 'numSlices', 'ncols', 'nrows', 'showGridLines', 'highlightSlice', 'sliceLocation', 'labelSpace', 'reverseSlices', 'sliceOverlap', 'reverseOverlap'], 'Scene3DOpts': ['zoom', 'showLegend', 'light', 'lightPos', 'lightDistance', 'offset', 'cameraRotation'], 'Display': ['name', 'enabled', 'overlayType', 'alpha', 'brightness', 'contrast'], 'NiftiOpts': ['volume', 'index'], 'VolumeOpts': ['linkLowRanges', 'linkHighRanges', 'overrideDataRange', 'clipImage', 'modulateImage', 'cmap', 'negativeCmap', 'useNegativeCmap', 'displayRange', 'clippingRange', 'modulateRange', 'gamma', 'logScale', 'channel', 'invertClipping', 'cmapResolution', 'interpolation', 'interpolateCmaps', 'invert', 'modulateAlpha', 'invertModulateAlpha'], 'Volume3DOpts': ['numSteps', 'blendFactor', 'blendByIntensity', 'smoothing', 'resolution', 'numInnerSteps', 'clipMode', 'clipPlane'], 'MaskOpts': ['colour', 'invert', 'threshold', 'outline', 'outlineWidth', 'interpolation'], 'VectorOpts': ['xColour', 'yColour', 'zColour', 'suppressX', 'suppressY', 'suppressZ', 'suppressMode', 'normaliseColour'], 'NiftiVectorOpts': ['cmap', 'colourImage', 'colourRange', 'modulateImage', 'modulateRange', 'modulateMode', 'clipImage', 'clippingRange'], 'LineVectorOpts': ['orientFlip', 'lineWidth', 'directed', 'unitLength', 'lengthScale'], 'RGBVectorOpts': ['interpolation', 'unitLength'], 'MeshOpts': ['vertexData', 'vertexDataIndex', 'vertexSet', 'modulateData', 'colour', 'outline', 'outlineWidth', 'refImage', 'coordSpace', 'useLut', 'lut', 'linkLowRanges', 'linkHighRanges', 'useNegativeCmap', 'displayRange', 'clippingRange', 'modulateRange', 'gamma', 'discardClipped', 'invertClipping', 'cmap', 'negativeCmap', 'cmapResolution', 'flatShading', 'interpolation', 'interpolateCmaps', 'invert', 'modulateAlpha', 'invertModulateAlpha', 'wireframe'], 'GiftiOpts': [], 'FreesurferOpts': [], 'TensorOpts': ['lighting', 'orientFlip', 'tensorResolution', 'tensorScale'], 'LabelOpts': ['lut', 'outline', 'outlineWidth'], 'SHOpts': ['orientFlip', 'shResolution', 'shOrder', 'size', 'normalise', 'lighting', 'radiusThreshold', 'colourMode'], 'MIPOpts': ['linkLowRanges', 'linkHighRanges', 'displayRange', 'clippingRange', 'gamma', 'invertClipping', 'cmap', 'cmapResolution', 'interpolation', 'interpolateCmaps', 'invert', 'window', 'minimum', 'absolute'], 'VolumeRGBOpts': ['interpolation', 'rColour', 'gColour', 'bColour', 'suppressR', 'suppressG', 'suppressB', 'suppressA', 'suppressMode'], 'ComplexOpts': ['component'], 'TractogramOpts': ['refImage', 'coordSpace', 'colourBy', 'clipBy', 'lineWidth', 'sliceWidth', 'resolution', 'subsample', 'pseudo3D', 'xclipdir', 'yclipdir', 'zclipdir', 'linkLowRanges', 'linkHighRanges', 'useNegativeCmap', 'displayRange', 'clippingRange', 'modulateRange', 'gamma', 'logScale', 'invertClipping', 'cmap', 'negativeCmap', 'cmapResolution', 'interpolateCmaps', 'invert', 'modulateAlpha', 'invertModulateAlpha']}
This dictionary defines all of the options which are exposed on the command line.
With the exception of
Main, every key is the name of aHasPropertiesclass, and the list of values are the names of properties on that class.
- fsleyes.parseargs.GROUPNAMES = {'Main': 'Main options', 'Extras': 'Hidden options', 'SceneOpts': 'Scene options', 'OrthoOpts': 'Ortho display options', 'LightBoxOpts': 'LightBox display options', 'Scene3DOpts': '3D display options', 'Display': 'Display options', 'VolumeOpts': 'Volume options', 'VolumeRGBOpts': 'RGB(A) volume options', 'ComplexOpts': 'Complex volume options', 'MaskOpts': 'Mask options', 'LineVectorOpts': 'Line vector options', 'RGBVectorOpts': 'RGB vector options', 'MeshOpts': 'Mesh options', 'GiftiOpts': 'GIFTI surface options', 'FreesurferOpts': 'Freesurfer surface options', 'LabelOpts': 'Label options', 'TensorOpts': 'Tensor options', 'SHOpts': 'SH options', 'MIPOpts': 'MIP options', 'TractogramOpts': 'Tractogram options'}
Command line arguments are grouped according to the class to which they are applied (see the
ARGUMENTSdictionary). This dictionary defines descriptions for each command line group.
- fsleyes.parseargs.GROUPDESCS = {'SceneOpts': 'These settings are applied to every orthographic, lightbox, and 3D view.', 'OrthoOpts': 'These settings are applied to every ortho view.', 'LightBoxOpts': 'These settings are applied to every lightbox view.', 'Scene3DOpts': 'These settings are applied to every 3D view.', 'Display': "Each display option will be applied to the overlay which is listed before that option. Passing any display option for an overlay will override the '--autoDisplay' setting for that overlay.", 'VolumeOpts': "These options are applied to 'volume' overlays.", 'VolumeRGBOpts': "These options are applied to 'rgb' overlays.", 'ComplexOpts': "These options are applied to 'complex' overlays.", 'MaskOpts': "These options are applied to 'mask' overlays.", 'LabelOpts': "These options are applied to 'label' overlays.", 'LineVectorOpts': "These options are applied to 'linevector' overlays.", 'RGBVectorOpts': "These options are applied to 'rgbvector' overlays.", 'MeshOpts': "These options are applied to 'mesh' overlays.", 'TensorOpts': "These options are applied to 'tensor' overlays.", 'SHOpts': "These options are applied to 'sh' overlays.", 'MIPOpts': "These options are applied to 'mip' overlays.", 'TractogramOpts': "These options are applied to 'tractogram' overlays."}
This dictionary contains descriptions for each argument group.
- fsleyes.parseargs.GROUPEPILOGS = {'Display': 'Available overlay types: {}', 'LabelOpts': 'Available lookup tables: {}. You can also specify a lookup table file.', 'VolumeOpts': 'Available colour maps: {}. You can also specify any matplotlib colour map, or a colour map file. ', 'SHOpts': 'Available colour maps: {}. You can also specify any matplotlib colour map, or a colour map file. '}
This dictionary contains epilogs for some types - information to be shown after the help for that type. Use the
groupEpilog()function to access this dictionary.
- fsleyes.parseargs.groupEpilog(target)[source]
Return a formatted value from the
GROUPEPILOGSdictionary. Thetargetmust be a type.
- fsleyes.parseargs.ARGUMENTS = {('Main', 'help'): ('h', 'help', False), ('Main', 'fullhelp'): ('fh', 'fullhelp', False), ('Main', 'verbose'): ('v', 'verbose', False), ('Main', 'version'): ('V', 'version', False), ('Main', 'skipfslcheck'): ('S', 'skipfslcheck', False), ('Main', 'updatecheck'): ('U', 'updatecheck', False), ('Main', 'noisy'): ('n', 'noisy', False), ('Main', 'glversion'): ('gl', 'glversion', True), ('Main', 'scene'): ('s', 'scene', True), ('Main', 'voxelLoc'): ('vl', 'voxelLoc', True), ('Main', 'worldLoc'): ('wl', 'worldLoc', True), ('Main', 'selectedOverlay'): ('o', 'selectedOverlay', True), ('Main', 'ungroupOverlays'): ('u', 'ungroupOverlays', False), ('Main', 'autoDisplay'): ('ad', 'autoDisplay', False), ('Main', 'displaySpace'): ('ds', 'displaySpace', True), ('Main', 'neuroOrientation'): ('no', 'neuroOrientation', False), ('Main', 'hideOrientationWarnings'): ('how', 'hideOrientationWarnings', False), ('Main', 'standard'): ('std', 'standard', False), ('Main', 'standard_brain'): ('stdb', 'standard_brain', False), ('Main', 'standard1mm'): ('std1mm', 'standard1mm', False), ('Main', 'standard1mm_brain'): ('std1mmb', 'standard1mm_brain', False), ('Main', 'initialDisplayRange'): ('idr', 'initialDisplayRange', True), ('Main', 'robustRange'): ('rr', 'robustRange', False), ('Main', 'cmapCycle'): ('cy', 'cmapCycle', False), ('Main', 'bigmem'): ('b', 'bigmem', False), ('Main', 'fontSize'): ('fs', 'fontSize', True), ('Main', 'notebook'): ('nb', 'notebook', False), ('Main', 'notebookFile'): ('nbf', 'notebookFile', True), ('Main', 'notebookPort'): ('nbp', 'notebookPort', True), ('Main', 'noBrowser'): ('nbb', 'noBrowser', False), ('Main', 'annotations'): ('a', 'annotations', True), ('Main', 'no3DInterp'): ('ni', 'no3DInterp', False), ('Main', 'showAllPlugins'): ('ap', 'showAllPlugins', False), ('Main', 'autoName'): ('an', 'autoName', False), ('Extras', 'nolink'): ('nl', 'nolink', False), ('Extras', 'bumMode'): ('bums', 'bumMode', False), ('SceneOpts', 'showColourBar'): ('cb', 'showColourBar', False), ('SceneOpts', 'bgColour'): ('bg', 'bgColour', True), ('SceneOpts', 'fgColour'): ('fg', 'fgColour', True), ('SceneOpts', 'cursorColour'): ('cc', 'cursorColour', True), ('SceneOpts', 'colourBarLocation'): ('cbl', 'colourBarLocation', True), ('SceneOpts', 'colourBarLabelSide'): ('cbs', 'colourBarLabelSide', True), ('SceneOpts', 'colourBarSize'): ('cbi', 'colourBarSize', True), ('SceneOpts', 'showCursor'): ('hc', 'hideCursor', False), ('SceneOpts', 'cursorWidth'): ('cw', 'cursorWidth', True), ('SceneOpts', 'performance'): ('p', 'performance', True), ('SceneOpts', 'movieSyncRefresh'): ('ms', 'movieSync', False), ('SceneOpts', 'labelSize'): ('ls', 'labelSize', True), ('OrthoOpts', 'xzoom'): ('xz', 'xzoom', True), ('OrthoOpts', 'yzoom'): ('yz', 'yzoom', True), ('OrthoOpts', 'zzoom'): ('zz', 'zzoom', True), ('OrthoOpts', 'cursorGap'): ('cg', 'cursorGap', False), ('OrthoOpts', 'layout'): ('lo', 'layout', True), ('OrthoOpts', 'showXCanvas'): ('xh', 'hidex', False), ('OrthoOpts', 'showYCanvas'): ('yh', 'hidey', False), ('OrthoOpts', 'showZCanvas'): ('zh', 'hidez', False), ('OrthoOpts', 'showLabels'): ('hl', 'hideLabels', False), ('OrthoOpts', 'showLocation'): ('sl', 'showLocation', True), ('OrthoOpts', 'xcentre'): ('xc', 'xcentre', True), ('OrthoOpts', 'ycentre'): ('yc', 'ycentre', True), ('OrthoOpts', 'zcentre'): ('zc', 'zcentre', True), ('OrthoOpts', 'invertXHorizontal'): ('ixh', 'invertXHorizontal', False), ('OrthoOpts', 'invertXVertical'): ('ixv', 'invertXVertical', False), ('OrthoOpts', 'invertYHorizontal'): ('iyh', 'invertYHorizontal', False), ('OrthoOpts', 'invertYVertical'): ('iyv', 'invertYVertical', False), ('OrthoOpts', 'invertZHorizontal'): ('izh', 'invertZHorizontal', False), ('OrthoOpts', 'invertZVertical'): ('izv', 'invertZVertical', False), ('LightBoxOpts', 'sliceSpacing'): ('ss', 'sliceSpacing', True), ('LightBoxOpts', 'numSlices'): ('ns', 'numSlices', True), ('LightBoxOpts', 'ncols'): ('nc', 'ncols', True), ('LightBoxOpts', 'nrows'): ('nr', 'nrows', True), ('LightBoxOpts', 'zrange'): ('zr', 'zrange', True), ('LightBoxOpts', 'sampleSlices'): ('sa', 'sampleSlices', True), ('LightBoxOpts', 'showGridLines'): ('sg', 'showGridLines', False), ('LightBoxOpts', 'highlightSlice'): ('hs', 'highlightSlice', False), ('LightBoxOpts', 'sliceLocation'): ('ll', 'sliceLocation', False), ('LightBoxOpts', 'labelSpace'): ('sp', 'labelSpace', True), ('LightBoxOpts', 'reverseSlices'): ('rs', 'reverseSlices', False), ('LightBoxOpts', 'sliceOverlap'): ('so', 'sliceOverlap', True), ('LightBoxOpts', 'reverseOverlap'): ('ro', 'reverseOverlap', False), ('LightBoxOpts', 'zax'): ('zx', 'zaxis', True), ('LightBoxOpts', 'asVoxels'): ('av', 'asVoxels', False), ('Scene3DOpts', 'zoom'): ('z', 'zoom', True), ('Scene3DOpts', 'showLegend'): ('he', 'hideLegend', False), ('Scene3DOpts', 'light'): ('dl', 'disableLight', False), ('Scene3DOpts', 'lightPos'): ('lp', 'lightPos', True), ('Scene3DOpts', 'lightDistance'): ('ld', 'lightDistance', True), ('Scene3DOpts', 'offset'): ('off', 'offset', True), ('Scene3DOpts', 'cameraRotation'): ('rot', 'cameraRotation', True), ('Display', 'name'): ('n', 'name', True), ('Display', 'enabled'): ('d', 'disabled', False), ('Display', 'overlayType'): ('ot', 'overlayType', True), ('Display', 'alpha'): ('a', 'alpha', True), ('Display', 'brightness'): ('b', 'brightness', True), ('Display', 'contrast'): ('c', 'contrast', True), ('NiftiOpts', 'volume'): ('v', 'volume', True), ('NiftiOpts', 'index'): ('x', 'index', True), ('ColourMapOpts', 'displayRange'): ('dr', 'displayRange', True), ('ColourMapOpts', 'clippingRange'): ('cr', 'clippingRange', True), ('ColourMapOpts', 'modulateRange'): ('mr', 'modulateRange', True), ('ColourMapOpts', 'invertClipping'): ('ic', 'invertClipping', False), ('ColourMapOpts', 'cmap'): ('cm', 'cmap', True), ('ColourMapOpts', 'negativeCmap'): ('nc', 'negativeCmap', True), ('ColourMapOpts', 'useNegativeCmap'): ('un', 'useNegativeCmap', False), ('ColourMapOpts', 'cmapResolution'): ('cmr', 'cmapResolution', True), ('ColourMapOpts', 'interpolateCmaps'): ('inc', 'interpolateCmaps', False), ('ColourMapOpts', 'invert'): ('i', 'invert', False), ('ColourMapOpts', 'gamma'): ('g', 'gamma', True), ('ColourMapOpts', 'logScale'): ('ls', 'logScale', False), ('ColourMapOpts', 'linkLowRanges'): ('ll', 'unlinkLowRanges', False), ('ColourMapOpts', 'linkHighRanges'): ('lh', 'linkHighRanges', False), ('ColourMapOpts', 'modulateAlpha'): ('ma', 'modulateAlpha', False), ('ColourMapOpts', 'invertModulateAlpha'): ('ima', 'invertModulateAlpha', False), ('VolumeOpts', 'channel'): ('ch', 'channel', True), ('VolumeOpts', 'overrideDataRange'): ('or', 'overrideDataRange', True), ('VolumeOpts', 'clipImage'): ('cl', 'clipImage', True), ('VolumeOpts', 'modulateImage'): ('mi', 'modulateImage', True), ('VolumeOpts', 'interpolation'): ('in', 'interpolation', True), ('Volume3DOpts', 'numSteps'): ('ns', 'numSteps', True), ('Volume3DOpts', 'blendFactor'): ('bf', 'blendFactor', True), ('Volume3DOpts', 'blendByIntensity'): ('bi', 'noBlendByIntensity', False), ('Volume3DOpts', 'smoothing'): ('s', 'smoothing', True), ('Volume3DOpts', 'resolution'): ('r', 'resolution', True), ('Volume3DOpts', 'numInnerSteps'): ('nis', 'numInnerSteps', True), ('Volume3DOpts', 'clipPlane'): ('cp', 'clipPlane', True), ('Volume3DOpts', 'clipMode'): ('m', 'clipMode', True), ('MaskOpts', 'colour'): ('mc', 'maskColour', False), ('MaskOpts', 'invert'): ('i', 'maskInvert', False), ('MaskOpts', 'threshold'): ('t', 'threshold', True), ('MaskOpts', 'outline'): ('o', 'outline', False), ('MaskOpts', 'outlineWidth'): ('w', 'outlineWidth', True), ('MaskOpts', 'interpolation'): ('in', 'interpolation', True), ('VectorOpts', 'xColour'): ('xc', 'xColour', True), ('VectorOpts', 'yColour'): ('yc', 'yColour', True), ('VectorOpts', 'zColour'): ('zc', 'zColour', True), ('VectorOpts', 'suppressX'): ('xs', 'suppressX', False), ('VectorOpts', 'suppressY'): ('ys', 'suppressY', False), ('VectorOpts', 'suppressZ'): ('zs', 'suppressZ', False), ('VectorOpts', 'suppressMode'): ('sm', 'suppressMode', True), ('VectorOpts', 'cmap'): ('cm', 'cmap', True), ('VectorOpts', 'colourImage'): ('co', 'colourImage', True), ('VectorOpts', 'colourRange'): ('or', 'colourRange', True), ('VectorOpts', 'modulateImage'): ('mo', 'modulateImage', True), ('VectorOpts', 'modulateRange'): ('mr', 'modulateRange', True), ('VectorOpts', 'modulateMode'): ('mm', 'modulateMode', True), ('VectorOpts', 'clipImage'): ('cl', 'clipImage', True), ('VectorOpts', 'clippingRange'): ('cr', 'clippingRange', True), ('VectorOpts', 'orientFlip'): ('of', 'orientFlip', False), ('VectorOpts', 'normaliseColour'): ('nr', 'normaliseColour', False), ('LineVectorOpts', 'lineWidth'): ('lw', 'lineWidth', True), ('LineVectorOpts', 'directed'): ('ld', 'directed', False), ('LineVectorOpts', 'unitLength'): ('nu', 'notunit', False), ('LineVectorOpts', 'lengthScale'): ('ls', 'lengthScale', True), ('RGBVectorOpts', 'interpolation'): ('in', 'interpolation', True), ('RGBVectorOpts', 'unitLength'): ('u', 'unitLengh', False), ('TensorOpts', 'lighting'): ('dl', 'disableLighting', False), ('TensorOpts', 'tensorResolution'): ('tr', 'tensorResolution', True), ('TensorOpts', 'tensorScale'): ('s', 'scale', True), ('MeshOpts', 'colour'): ('mc', 'colour', True), ('MeshOpts', 'outline'): ('o', 'outline', False), ('MeshOpts', 'outlineWidth'): ('w', 'outlineWidth', True), ('MeshOpts', 'refImage'): ('r', 'refImage', True), ('MeshOpts', 'coordSpace'): ('s', 'coordSpace', True), ('MeshOpts', 'vertexData'): ('vd', 'vertexData', True), ('MeshOpts', 'vertexDataIndex'): ('vdi', 'vertexDataIndex', True), ('MeshOpts', 'vertexSet'): ('vs', 'vertexSet', True), ('MeshOpts', 'modulateData'): ('md', 'modulateData', True), ('MeshOpts', 'useLut'): ('ul', 'useLut', False), ('MeshOpts', 'lut'): ('l', 'lut', True), ('MeshOpts', 'discardClipped'): ('dc', 'discardClipped', False), ('MeshOpts', 'wireframe'): ('wf', 'wireframe', False), ('MeshOpts', 'interpolation'): ('in', 'interpolation', True), ('MeshOpts', 'flatShading'): ('f', 'flatShading', False), ('LabelOpts', 'lut'): ('l', 'lut', True), ('LabelOpts', 'outline'): ('o', 'outline', False), ('LabelOpts', 'outlineWidth'): ('w', 'outlineWidth', True), ('SHOpts', 'shResolution'): ('sr', 'shResolution', True), ('SHOpts', 'shOrder'): ('so', 'shOrder', True), ('SHOpts', 'size'): ('s', 'size', True), ('SHOpts', 'lighting'): ('l', 'lighting', False), ('SHOpts', 'normalise'): ('no', 'normalise', False), ('SHOpts', 'orientFlip'): ('of', 'orientFlip', False), ('SHOpts', 'radiusThreshold'): ('t', 'radiusThreshold', True), ('SHOpts', 'colourMode'): ('m', 'colourMode', True), ('SHOpts', 'colourMap'): ('cm', 'colourMap', True), ('SHOpts', 'xColour'): ('xc', 'xColour', True), ('SHOpts', 'yColour'): ('yc', 'yColour', True), ('SHOpts', 'zColour'): ('zc', 'zColour', True), ('MIPOpts', 'window'): ('w', 'window', False), ('MIPOpts', 'minimum'): ('m', 'minimum', False), ('MIPOpts', 'absolute'): ('ab', 'absolute', False), ('MIPOpts', 'interpolation'): ('in', 'interpolation', True), ('VolumeRGBOpts', 'interpolation'): ('in', 'interpolation', True), ('VolumeRGBOpts', 'rColour'): ('rc', 'rColour', True), ('VolumeRGBOpts', 'gColour'): ('gc', 'gColour', True), ('VolumeRGBOpts', 'bColour'): ('bc', 'bColour', True), ('VolumeRGBOpts', 'suppressR'): ('rs', 'suppressR', False), ('VolumeRGBOpts', 'suppressG'): ('gs', 'suppressG', False), ('VolumeRGBOpts', 'suppressB'): ('bs', 'suppressB', False), ('VolumeRGBOpts', 'suppressA'): ('as', 'suppressA', False), ('VolumeRGBOpts', 'suppressMode'): ('sm', 'suppressMode', True), ('ComplexOpts', 'component'): ('co', 'component', True), ('TractogramOpts', 'refImage'): ('ri', 'refImage', True), ('TractogramOpts', 'coordSpace'): ('cs', 'coordSpace', True), ('TractogramOpts', 'colourBy'): ('co', 'colourBy', True), ('TractogramOpts', 'clipBy'): ('cl', 'clipBy', True), ('TractogramOpts', 'lineWidth'): ('lw', 'lineWidth', True), ('TractogramOpts', 'sliceWidth'): ('sw', 'sliceWidth', True), ('TractogramOpts', 'resolution'): ('r', 'resolution', True), ('TractogramOpts', 'subsample'): ('s', 'subsample', True), ('TractogramOpts', 'pseudo3D'): ('p', 'pseudo3D', False), ('TractogramOpts', 'xclipdir'): ('xcl', 'xclipdir', True), ('TractogramOpts', 'yclipdir'): ('ycl', 'yclipdir', True), ('TractogramOpts', 'zclipdir'): ('zcl', 'zclipdir', True)}
This dictionary defines the short and long command line flags to be used for every option. Each value has the form:
(shortForm, longForm, expectsArguments)
where
expectsArgumentsisTrueif the flag is to be followed by one or more arguments,Falseotherwise.Note
There cannot be any collisions between the main options, the
SceneOptsoptions, theOrthOptsoptions, theLightBoxOptsoptions, and theScene3DOptsoptions.There cannot be any collisions between the
Displayoptions and any one set ofDisplayOptsoptions.There can be collisions between these two groups, and between the options for different
DisplayOptstypes.
- fsleyes.parseargs.HELP = {('Main', 'help'): 'Display basic FSLeyes options and exit', ('Main', 'fullhelp'): 'Display all FSLeyes options and exit', ('Main', 'verbose'): 'Verbose output (can be used up to 3 times)', ('Main', 'version'): 'Print the current version and exit', ('Main', 'skipfslcheck'): 'Skip $FSLDIR check/warning', ('Main', 'updatecheck'): 'Check for FSLeyes updates on startup', ('Main', 'noisy'): 'Make the specified module noisy', ('Main', 'glversion'): 'Desired (major, minor) OpenGL compatibility version', ('Main', 'scene'): 'Scene to show', ('Main', 'voxelLoc'): 'Location to show (voxel coordinates of first overlay)', ('Main', 'worldLoc'): 'Location to show (world coordinates, takes precedence over --voxelLoc)', ('Main', 'selectedOverlay'): 'Selected overlay (index, starting from 0)', ('Main', 'ungroupOverlays'): 'Do not group overlays via the chainlink button', ('Main', 'autoDisplay'): 'Automatically configure overlay display settings (unless any display settings are specified)', ('Main', 'displaySpace'): 'Space in which all overlays are displayed - can be "world", "scaledVoxels", "fslview", or a NIFTI image.', ('Main', 'hideOrientationWarnings'): 'Hides location panel warnings when displaying images of different FOVs or orientations.', ('Main', 'neuroOrientation'): 'Display images in neurological orientation (default: radiological)', ('Main', 'standard'): 'Add the MNI152 2mm standard image as an underlay (only if $FSLDIR is set).', ('Main', 'standard_brain'): 'Add the MNI152 brain-extracted 2mm standard image as an underlay (only if $FSLDIR is set).', ('Main', 'standard1mm'): 'Add the MNI152 1mm standard image as an underlay (only if $FSLDIR is set).', ('Main', 'standard1mm_brain'): 'Add the MNI152 brain-extracted 1mm standard image as an underlay (only if $FSLDIR is set).', ('Main', 'initialDisplayRange'): 'Initial display range to use for volume overlays, expressed as (low, high) intensity values. The values can be expresseed as percentiles by appending a "%%" to the high value.', ('Main', 'robustRange'): 'Set the initial display range for volume overlays to the "robust range" as calculated by fslstats. Ignored if --initialDisplayRange is also specified. For 4D images, the robust range is calculated on the first volume. If fslstats is not available, the image data range is used.', ('Main', 'cmapCycle'): 'Automatically assign a different colour map to each volume overlay (unless one is explicitly specified).', ('Main', 'bigmem'): 'Load all images into memory, regardless of size.', ('Main', 'fontSize'): 'Application font size', ('Main', 'annotations'): 'Load annotations from file (only applied to ortho views)', ('Main', 'no3DInterp'): 'Do not automatically enable interpolation for volume overlays when opening a 3D view', ('Main', 'showAllPlugins'): 'Expose plugins from third party packages', ('Main', 'autoName'): 'Automatically give each overlay a unique name based on its file path', ('Main', 'notebook'): 'Start the Jupyter notebook server', ('Main', 'notebookFile'): 'Start the Jupyter notebook server and open the specified notebook file.', ('Main', 'notebookPort'): 'Jupyter notebook server port', ('Main', 'noBrowser'): 'Start the jupyter notebook server, but do not open the Jupyter notebook home page in a web browser.', ('Extras', 'nolink'): '==SUPPRESS==', ('Extras', 'bumMode'): '==SUPPRESS==', ('SceneOpts', 'showCursor'): 'Do not display the green cursor highlighting the current location', ('SceneOpts', 'cursorWidth'): 'Location cursor thickness', ('SceneOpts', 'bgColour'): 'Canvas background colour (0-1)', ('SceneOpts', 'fgColour'): 'Canvas foreground colour (0-1)', ('SceneOpts', 'cursorColour'): 'Cursor location colour (0-1)', ('SceneOpts', 'showColourBar'): 'Show colour bar', ('SceneOpts', 'colourBarLocation'): 'Colour bar location', ('SceneOpts', 'colourBarLabelSide'): 'Colour bar label orientation', ('SceneOpts', 'colourBarSize'): 'Colour bar size (%%)', ('SceneOpts', 'performance'): 'Rendering performance (1=fastest, 2=faster, 3=best looking)', ('SceneOpts', 'movieSyncRefresh'): 'Toggle the canvas refresh strategy in movie mode.', ('SceneOpts', 'labelSize'): 'Orientation/colour bar label font size (4-96, default: 12)', ('OrthoOpts', 'xzoom'): 'X canvas zoom (100-5000, default: 100)', ('OrthoOpts', 'yzoom'): 'Y canvas zoom (100-5000, default: 100)', ('OrthoOpts', 'zzoom'): 'Z canvas zoom (100-5000, default: 100)', ('OrthoOpts', 'cursorGap'): 'Show a gap at the cursor centre', ('OrthoOpts', 'layout'): 'Canvas layout', ('OrthoOpts', 'showXCanvas'): 'Hide the X canvas', ('OrthoOpts', 'showYCanvas'): 'Hide the Y canvas', ('OrthoOpts', 'showZCanvas'): 'Hide the Z canvas', ('OrthoOpts', 'showLabels'): 'Hide orientation labels', ('OrthoOpts', 'showLocation'): 'Show cursor location coordinates', ('OrthoOpts', 'invertXHorizontal'): 'Invert the X canvas along the horizontal axis', ('OrthoOpts', 'invertXVertical'): 'Invert the X canvas along the vertical axis', ('OrthoOpts', 'invertYHorizontal'): 'Invert the Y canvas along the horizontal axis', ('OrthoOpts', 'invertYVertical'): 'Invert the Y canvas along the vertical axis', ('OrthoOpts', 'invertZHorizontal'): 'Invert the Z canvas along the horizontal axis', ('OrthoOpts', 'invertZVertical'): 'Invert the Z canvas along the vertical axis', ('OrthoOpts', 'xcentre'): 'X canvas centre ([-1, 1])', ('OrthoOpts', 'ycentre'): 'Y canvas centre ([-1, 1])', ('OrthoOpts', 'zcentre'): 'Z canvas centre ([-1, 1])', ('LightBoxOpts', 'sliceSpacing'): 'Slice spacing, specified as a proportion between 0 and 1, or as voxel coordinates if --asVoxels is provided.', ('LightBoxOpts', 'numSlices'): 'Number of slices. Ignored if --sliceSpacing is specified.', ('LightBoxOpts', 'ncols'): 'Number of columns. Only used for off-screen rendering.', ('LightBoxOpts', 'nrows'): 'Number of rows. Only used for off-screen rendering. If both --ncols and --nrows are specified, nrows may be adjusted to honour the --zrange and --sliceSpacing settings.', ('LightBoxOpts', 'zrange'): 'Slice range, specified as proportions between 0 and 1, or as voxel coordinates if --asVoxels is provided.', ('LightBoxOpts', 'sampleSlices'): 'Control how slices are sampled (either "centre" or "start").', ('LightBoxOpts', 'showGridLines'): 'Show grid lines', ('LightBoxOpts', 'highlightSlice'): 'Highlight current slice', ('LightBoxOpts', 'sliceLocation'): 'Show location in world coordinates on each slice. Ignored if --labelSpace is specified', ('LightBoxOpts', 'labelSpace'): 'Show slice locations in this coordinate system.', ('LightBoxOpts', 'reverseSlices'): 'Display slices from high to low Z value, instead of low to high.', ('LightBoxOpts', 'sliceOverlap'): 'Overlap adjacent slices by this much, specified as a percentage.', ('LightBoxOpts', 'reverseOverlap'): 'Draw lower slices on top of higher slices instead of higher on top of lower.', ('LightBoxOpts', 'zax'): 'Z axis', ('LightBoxOpts', 'asVoxels'): 'Causes the --zrange and --sliceSpacing settings to be interpreted as voxel coordinates. Has no effect if --zrange is not provided.', ('Scene3DOpts', 'zoom'): 'Zoom (1-5000, default: 100)', ('Scene3DOpts', 'showLegend'): 'Hide the orientation legend', ('Scene3DOpts', 'light'): 'Disable light effect', ('Scene3DOpts', 'lightPos'): 'Light position, as XYZ rotations in degrees (-180 - 180)', ('Scene3DOpts', 'lightDistance'): 'Distance of light source from centre of display bounding box (0.5 - 10)', ('Scene3DOpts', 'offset'): 'Offset from centre ([-1, 1])', ('Scene3DOpts', 'cameraRotation'): 'Rotation (degrees), specified as yaw (rotation about the vertical axis), pitch (rotation about the horizontal axis) and roll (rotation about the depth axis).', ('Display', 'name'): 'Overlay name', ('Display', 'enabled'): 'Disable (hide) overlay', ('Display', 'overlayType'): 'Overlay type', ('Display', 'alpha'): 'Opacity (0-100, default: 100)', ('Display', 'brightness'): 'Brightness (0-100, default: 50)', ('Display', 'contrast'): 'Contrast (0-100, default: 50)', ('NiftiOpts', 'volume'): 'Volume (index, starting from 0).', ('NiftiOpts', 'index'): 'Index into each dimension, for images with more than four dimensions, Specify as a comma-separated list of indices (starting from 0), where the first value is the index into the fourth dimension.', ('ColourMapOpts', 'displayRange'): 'Display range. Setting this will override brightnes/contrast settings. For volume overlays only: append a "%%" to the high value to set range by percentile.', ('ColourMapOpts', 'clippingRange'): 'Clipping range. Setting this will override the low display range (unless low ranges are unlinked). For volume overlays only: append a "%%" to the high value to clip by percentile.', ('ColourMapOpts', 'modulateRange'): 'Modulate range. Sets the range by which opacity should be modulated by. For volume overlays only: append a "%%" to the high value to modulate by percentile.', ('ColourMapOpts', 'invertClipping'): 'Invert clipping', ('ColourMapOpts', 'cmap'): 'Colour map', ('ColourMapOpts', 'negativeCmap'): 'Colour map for negative values', ('ColourMapOpts', 'cmapResolution'): 'Colour map resolution', ('ColourMapOpts', 'useNegativeCmap'): 'Use negative colour map (automatically enabled if --negativeCmap is specified)', ('ColourMapOpts', 'interpolateCmaps'): 'Interpolate between colours in colour maps', ('ColourMapOpts', 'invert'): 'Invert colour map', ('ColourMapOpts', 'gamma'): 'Gamma correction [-1-+1, default: 0]', ('ColourMapOpts', 'logScale'): 'Logarithmic scaling', ('ColourMapOpts', 'linkLowRanges'): 'Unlink low display/clipping ranges', ('ColourMapOpts', 'linkHighRanges'): 'Link high display/clipping ranges', ('ColourMapOpts', 'modulateAlpha'): 'Modulate alpha by intensity', ('VolumeOpts', 'channel'): 'Channel to display, for RGB(A) images', ('VolumeOpts', 'overrideDataRange'): 'Override data range. Setting this effectively causes FSLeyes to ignore the actual image data range, and use this range instead. This is useful for images with a large data range that is driven by outliers.', ('VolumeOpts', 'clipImage'): 'Image containing clipping values (defaults to the image itself)', ('VolumeOpts', 'modulateImage'): 'Image containing modulation values (defaults to the image itself)', ('VolumeOpts', 'interpolation'): 'Interpolation', ('Volume3DOpts', 'numSteps'): '3D only. Maximum number of samples per pixel', ('Volume3DOpts', 'blendFactor'): '3D only Sample blending factor [0.001-1, default: 0.1]', ('Volume3DOpts', 'blendByIntensity'): '3D only. Disable modulation of sample colours by voxel intensity when blending.', ('Volume3DOpts', 'smoothing'): '3D only. Smoothing radius [0-10, default: 0]', ('Volume3DOpts', 'resolution'): '3D only. Resolution/quality [1-100, default: 100]', ('Volume3DOpts', 'numInnerSteps'): '3D/GL14 only. Number of samples to run on GPU', ('Volume3DOpts', 'clipPlane'): '3D only. Add a clipping plane. Requires three values: position [0-100], azimuth [-180, 180], inclination [-180, 180]. Can be used up to 10 times.', ('Volume3DOpts', 'clipMode'): '3D only. How to apply the clipping plane(s).', ('MaskOpts', 'colour'): 'Colour (0-1)', ('MaskOpts', 'invert'): 'Invert', ('MaskOpts', 'threshold'): 'Threshold', ('MaskOpts', 'outline'): 'Show mask outline', ('MaskOpts', 'outlineWidth'): 'Mask outline width (1-10, default: 2)', ('MaskOpts', 'interpolation'): 'Interpolation', ('VectorOpts', 'xColour'): 'X colour (0-1)', ('VectorOpts', 'yColour'): 'Y colour (0-1)', ('VectorOpts', 'zColour'): 'Z colour (0-1)', ('VectorOpts', 'suppressX'): 'Suppress X magnitude', ('VectorOpts', 'suppressY'): 'Suppress Y magnitude', ('VectorOpts', 'suppressZ'): 'Suppress Z magnitude', ('VectorOpts', 'suppressMode'): "Replace suppressed colours with 'white' (default), 'black', or 'transparent'.", ('VectorOpts', 'cmap'): 'Colour map (only used if a colour image is provided)', ('VectorOpts', 'colourImage'): 'Image to colour vectors with', ('VectorOpts', 'colourRange'): 'Colour-by range (only used if a colour image is provided)', ('VectorOpts', 'modulateImage'): 'Image to modulate vector brightness/alpha with', ('VectorOpts', 'modulateRange'): 'Modulation range (only used if a modulation image is provided)', ('VectorOpts', 'modulateMode'): "Modulate vector 'brightness' (default) or 'alpha'", ('VectorOpts', 'clipImage'): 'Image to clip vectors with', ('VectorOpts', 'clippingRange'): 'Clipping range (only used if a clipping image is provided)', ('VectorOpts', 'orientFlip'): 'Flip L/R orientation within each voxel. Default: true for images with neurological storage order, false for images with radiological storage order. Passing this flag will invert the default behaviour.', ('VectorOpts', 'normaliseColour'): 'Normalise RGB values to uniform brigntness.', ('LineVectorOpts', 'lineWidth'): 'Line width (1-10, default: 1)', ('LineVectorOpts', 'directed'): 'Interpret vectors as directed', ('LineVectorOpts', 'unitLength'): 'Do not scale lines to unit length', ('LineVectorOpts', 'lengthScale'): 'Scale line length by this percentage (10-500, default: 100)', ('LineVectorOpts', 'modulateMode'): "Modulate vector 'brightness' (default), 'alpha', 'lineLength', or 'lineWidth'.", ('RGBVectorOpts', 'interpolation'): 'Interpolation', ('RGBVectorOpts', 'unitLength'): 'Alias for --normaliseColour.', ('RefImageOpts', 'refImage'): 'Reference image for overlay', ('RefImageOpts', 'coordSpace'): 'Overlay vertex coordinate space (relative to reference image)', ('MeshOpts', 'colour'): 'Mesh colour (0-1)', ('MeshOpts', 'outline'): 'Show mesh outline', ('MeshOpts', 'outlineWidth'): 'Mesh outline width (0-20, default: 2)', ('MeshOpts', 'vertexData'): 'A file (e.g. Freesurfer .curv file, GIFTI functional, shape, label, or time series file, or a plain text file) containing one or more values for each vertex in the mesh.', ('MeshOpts', 'vertexDataIndex'): 'If the vertex data (-vd/--vertexData) file contains more than one value per vertex, specify the the index of the data to display.', ('MeshOpts', 'vertexSet'): 'A file containing an additional (compatible) mesh definition.', ('MeshOpts', 'modulateData'): 'Vertex data file by which to modulate transparency by.', ('MeshOpts', 'useLut'): 'Use a lookup table instead of colour map(s) when colouring the mesh with vertex data.', ('MeshOpts', 'lut'): 'Lookup table to use (see -ul/--useLut).', ('MeshOpts', 'discardClipped'): 'Discard clipped regions, rather than colouring them with the flat colour', ('MeshOpts', 'wireframe'): '3D only. Draw as wireframe', ('MeshOpts', 'flatShading'): 'Deprecated - use the --interpolation option instead.', ('MeshOpts', 'interpolation'): 'Interpolation method, when colouring a mesh with vertex data.', ('TensorOpts', 'lighting'): 'Disable lighting effect', ('TensorOpts', 'tensorResolution'): 'Tensor resolution/quality (4-20, default: 10)', ('TensorOpts', 'tensorScale'): 'Tensor size (percentage of voxel size; 50-600, default: 100)', ('LabelOpts', 'lut'): 'Label image LUT', ('LabelOpts', 'outline'): 'Show label outlines', ('LabelOpts', 'outlineWidth'): 'Label outline width (proportion of one voxel; 0-1, default: 0.25)', ('SHOpts', 'shResolution'): 'FOD resolution/quality (3-10, default: 5)', ('SHOpts', 'shOrder'): 'Maximum SH function order (0-maximum determined from image [up to 16], default: maximum)', ('SHOpts', 'size'): 'FOD size (10-500, default: 100)', ('SHOpts', 'normalise'): 'Normalise FOD sizes', ('SHOpts', 'lighting'): 'Enable dodgy lighting effect', ('SHOpts', 'radiusThreshold'): 'Hide FODs with radius less than this (min: 0, max: 1, default: 0.05)', ('SHOpts', 'colourMode'): "Colour by 'direction' or 'radius' (default: direction)", ('SHOpts', 'colourMap'): "Colour map, if colouring by 'radius'", ('SHOpts', 'xColour'): "X colour, if colouring by 'direction'", ('SHOpts', 'yColour'): "Y colour, if colouring by 'direction'", ('SHOpts', 'zColour'): "Z colour, if colouring by 'direction'", ('MIPOpts', 'window'): 'Length of the window along which the MIP is calculated. Specified as a proportion of the image length. The window is centred at the current display location.', ('MIPOpts', 'minimum'): 'Use the minimum intensity, rather than the maximum intensity, in the projection.', ('MIPOpts', 'absolute'): 'Use the absolute intensity, rather than the maximum intensity, in the projection. This overrides the minimum intensity setting.', ('MIPOpts', 'interpolation'): 'Interpolation', ('VolumeRGBOpts', 'interpolation'): 'Interpolation', ('VolumeRGBOpts', 'rColour'): 'R colour (0-1)', ('VolumeRGBOpts', 'gColour'): 'G colour (0-1)', ('VolumeRGBOpts', 'bColour'): 'B colour (0-1)', ('VolumeRGBOpts', 'suppressR'): 'Suppress R channel', ('VolumeRGBOpts', 'suppressG'): 'Suppress G channel', ('VolumeRGBOpts', 'suppressB'): 'Suppress B channel', ('VolumeRGBOpts', 'suppressA'): 'Suppress A channel', ('VolumeRGBOpts', 'suppressMode'): "Replace suppressed channels with 'white' (default), 'black', or 'transparent'.", ('ComplexOpts', 'component'): 'Component to display - real (default), imaginary, magnitude, or phase.', ('TractogramOpts', 'colourBy'): 'NIFTI image, or file containing per-vertex/streamline scalar values for colouring, or name of a a per-vertex/streamline data set contained within the tractogram file.', ('TractogramOpts', 'clipBy'): 'NIFTI image, or file containing per-vertex/streamline scalar values for clipping, or name of a a per-vertex/streamline data set contained within the tractogram file.', ('TractogramOpts', 'lineWidth'): 'Streamline width/diameter', ('TractogramOpts', 'sliceWidth'): '2D only. Slice width when drawing 2D slices.', ('TractogramOpts', 'resolution'): 'Streamline resolution/quality', ('TractogramOpts', 'subsample'): 'Draw a randomly selected subsample of streamlines.', ('TractogramOpts', 'pseudo3D'): '2D only. Draw the full 3D tractogram, overlaid on the 2D scene. The default behaviour is to draw a cross-section of the tractogram at the current depth.', ('TractogramOpts', 'xclipdir'): '2D only. Direction in which to clip (hide) areas below/above the current X location.', ('TractogramOpts', 'yclipdir'): '2D only. Direction in which to clip (hide) areas below/above the current Y location.', ('TractogramOpts', 'zclipdir'): '2D only. Direction in which to clip (hide) areas below/above the current Z location.'}
This dictionary defines the help text for all command line options.
- fsleyes.parseargs.SHORT_HELP = {('ColourMapOpts', 'displayRange'): 'Display range', ('ColourMapOpts', 'clippingRange'): 'Clipping range. Setting this will override the display range.'}
This dictionary defines the help text for some properties, used when the user requests a short (abbreviated) version of the command line help.
- fsleyes.parseargs.getExtra(target, propName, default=None)[source]
This function returns defines any extra settings to be passed through to the
props.addParserArguments()function for the given type and property.
- fsleyes.parseargs.TRANSFORMS = {('SceneOpts', 'showCursor'): <function _boolTrans>, ('OrthoOpts', 'showXCanvas'): <function _boolTrans>, ('OrthoOpts', 'showYCanvas'): <function _boolTrans>, ('OrthoOpts', 'showZCanvas'): <function _boolTrans>, ('OrthoOpts', 'showLabels'): <function _boolTrans>, ('Scene3DOpts', 'showLegend'): <function _boolTrans>, ('Scene3DOpts', 'light'): <function _boolTrans>, ('Display', 'enabled'): <function _boolTrans>, ('ColourMapOpts', 'linkLowRanges'): <function _boolTrans>, ('LineVectorOpts', 'unitLength'): <function _boolTrans>, ('TensorOpts', 'lighting'): <function _boolTrans>, ('Volume3DOpts', 'blendByIntensity'): <function _boolTrans>, ('SceneOpts', 'bgColour'): <function _colourTrans>, ('SceneOpts', 'fgColour'): <function _colourTrans>, ('SceneOpts', 'cursorColour'): <function _colourTrans>, ('MeshOpts', 'colour'): <function _colourTrans>, ('MaskOpts', 'colour'): <function _colourTrans>, ('VectorOpts', 'xColour'): <function _colourTrans>, ('VectorOpts', 'yColour'): <function _colourTrans>, ('VectorOpts', 'zColour'): <function _colourTrans>}
This dictionary defines any transformations for command line options where the value passed on the command line cannot be directly converted into the corresponding property value. See the
props.applyArguments()andprops.generateArguments()functions.
- fsleyes.parseargs._setupMainParser(mainParser, exclude)[source]
Sets up an argument parser which handles options related to the scene. This function configures the following argument groups:
Main: Top level options
Extras: Miscellaneous options
SceneOpts: Common scene options
OrthoOpts: Options related to setting up a orthographic display
LightBoxOpts: Options related to setting up a lightbox display
Scene3DOpts: Options related to setting up a 3D display
- fsleyes.parseargs._configParser(target, parser, exclude=None, propNames=None, shortHelp=False)[source]
Configures the given parser so it will parse arguments for the given target.
- fsleyes.parseargs._configMainParser(mainParser, exclude=None)[source]
Adds options to the given parser which allow the user to specify main FSLeyes options.
- fsleyes.parseargs._configExtraOptions(parser, exclude=None)[source]
Adds
Extrasoptions to the arguemnt parser.
- fsleyes.parseargs._setupOverlayParsers(forHelp=False, shortHelp=False)[source]
Creates a set of parsers which handle command line options for
Displayinstances, and for allDisplayOptsinstances.- Parameters:
forHelp – If
False(the default), each of the parsers created to handle options for theDisplayOptssub-classes will be configured so that the can also handle options forDisplayproperties. Otherwise, theDisplayOptsparsers will be configured to only handleDisplayOptsproperties. This option is available to make it easier to separate the help sections when printing help.shortHelp – If
False(the default), help text will be taken from theHELPdictionary. Otherwise, help text will be taken from theSHORT_HELPdictionary.
- Returns:
A tuple containing:
An
ArgumentParserwhich parses arguments specifying theDisplayproperties. This parser is not actually used to parse arguments - it is only used to generate help text.An
ArgumentParserwhich just parses arguments specifying theDisplay.overlayTypeproperty.An
ArgumentParserwhich parses arguments specifyingDisplayandDisplayOptsproperties.
- fsleyes.parseargs.parseArgs(mainParser, argv, name, prolog=None, desc=None, usageProlog=None, argOpts=None, shortHelpExtra=None, exclude=None)[source]
Parses the given command line arguments, returning an
argparse.Namespaceobject containing all the arguments.The display options for individual overlays are parsed separately. The
Namespaceobjects for each overlay are returned in a list, stored as an attribute, calledoverlays, of the returned top-levelNamespaceinstance. Each of the overlayNamespaceinstances also has an attribute, calledoverlay, which contains the full path of the overlay file that was speciied.A
SystemExitexception is raised if invalid arguments have been passed in or, for example, the user simply requested command line help.- Parameters:
mainParser – A
argparse.ArgumentParserwhich should be used as the top level parser.argv – The arguments as passed in on the command line.
name – The name of the tool - this function might be called by either
main, ormain.prolog – A string to print before any usage text is printed.
desc – A description of the tool.
usageProlog – A string describing the tool-specific options (those options which are handled by the tool, not by this module).
argOpts – If the
mainParserhas already been configured to parse arguments which accept one or more parameters, you must provide a list of their short and long forms here. Otherwise, the parameters may be incorrectly identified as a path to an overlay.shortHelpExtra – If the caller of this function has already added arguments to the
mainParser, the long forms of those arguemnts may be passed here as a list to have them included in the short help text.exclude – Dictionary containing arguments that should not be added to the argument parser. Should be of the form
{identifier : [arguments]}, whereidentifieris one ofMain,Extras,SceneOpts,OrthoOpts,LightBoxOpts, orScene3DOpts.
- fsleyes.parseargs._printVersion(name)[source]
Prints the current FSLeyes version.
- Parameters:
name – Name of the tool (probably either
fsleyesorrender).
- fsleyes.parseargs._printShortHelp(mainParser, extra=None)[source]
Prints out help for a selection of arguments.
- Parameters:
mainParser – The top level
ArgumentParser.extra – List containing long forms of any extra main arguments to be included in the short help text.
- fsleyes.parseargs._printFullHelp(mainParser)[source]
Prints out help for all arguments.
- Parameters:
mainParser – The top level
ArgumentParser.
- fsleyes.parseargs._applyArgs(args, overlayList, displayCtx, target, propNames=None, **kwargs)[source]
Applies the given command line arguments to the given target object. The target object is added as a keyword argument to pass through to any transform functions.
- fsleyes.parseargs._generateArgs(overlayList, displayCtx, source, propNames=None)[source]
Does the opposite of
_applyArgs()- generates command line arguments which can be used to configure anothersourceinstance in the same way as the provided one.
- fsleyes.parseargs.applyMainArgs(args, overlayList, displayCtx)[source]
Applies top-level arguments that are not specific to the scene or any overlays. This should be called before either
applySceneArgs()orapplyOverlayArgs().- Parameters:
args –
argparse.Namespaceobject containing the parsed command line arguments.overlayList – A
OverlayListinstance.displayCtx – A
DisplayContextinstance.
- fsleyes.parseargs.applySceneArgs(args, overlayList, displayCtx, sceneOpts)[source]
Configures the scene displayed by the given
DisplayContextinstance according to the arguments that were passed in on the command line.Note
The scene arguments are applied asynchronously using
idle.idle(). This is done because theapplyOverlayArgs()function also applies its arguments asynchrnously, and we want the order of application to match the order in which these functions were called.- Parameters:
args –
argparse.Namespaceobject containing the parsed command line arguments.overlayList – A
OverlayListinstance.displayCtx – A
DisplayContextinstance.sceneOpts – A
SceneOptsinstance.
- fsleyes.parseargs.generateSceneArgs(overlayList, displayCtx, sceneOpts, exclude=None)[source]
Generates command line arguments which describe the current state of the provided
displayCtxandsceneOptsinstances.- Parameters:
overlayList – A
OverlayListinstance.displayCtx – A
DisplayContextinstance.sceneOpts – A
SceneOptsinstance.exclude – A list of property names to exclude.
- fsleyes.parseargs.generateOverlayArgs(overlay, overlayList, displayCtx)[source]
Generates command line arguments which describe the display of the current overlay.
- Parameters:
overlay – An overlay object.
overlayList – The
OverlayListdisplayCtx – A
DisplayContextinstance.
- fsleyes.parseargs.applyOverlayArgs(args, overlayList, displayCtx, loadOverlays=True, **kwargs)[source]
Loads and configures any overlays which were specified on the command line.
Warning
This function uses the
loadoverlay.loadOverlays()function which in turn usesidle.idle()to load the overlays. This means that the overlays are loaded and configured asynchronously, meaning that they may not be loaded by the time that this function returns. See theloadoverlay.loadOverlays()documentation for more details.- Parameters:
args – A
Namespaceinstance, as returned by theparseArgs()function.overlayList – An
OverlayListinstance, to which the overlays should be added.displayCtx – A
DisplayContextinstance, which manages the scene and overlay display.loadOverlays – Defaults to
True. IfFalse, it is assumed that the overlays are already loaded - in this case, the arguments are applied synchronously.
All other keyword arguments are passed through to the
loadoverlay.loadOverlays()function (unlessloadOverlays``is ``False).
- fsleyes.parseargs.wasSpecified(namespace, obj, propName)[source]
Returns
Trueif the givenpropNameon the given object was specified on the command line,Falseotherwise.
- fsleyes.parseargs._findOrLoad(overlayList, overlayFile, overlayType, relatedTo=None)[source]
Used in a few places to handle arguments which expect to be passed a file name to be loaded as an overlay (e.g.
VolumeOpts.clipImage).Searches for the given
overlayFilein theoverlayList. If not present, it is created using the givenoverlayTypeconstructor, and inserted into theoverlayList.The new overlay is inserted into the
overlayListbefore therelatedTooverlay if provided, otherwise appended to the end of the list.
- fsleyes.parseargs.fsleyesUrlToArgs(url)[source]
Parses a
fsleyes://url and returns a list of equivalent command line arguments.
- fsleyes.parseargs._configSpecialOption(target, parser, optName, shortArg, longArg, helpText)[source]
Called by the
_configParserfunction for any options which do not map directly to aSceneOptsorDisplayOptsproperty. Calls the_configSpecialfunction for the option.- Parameters:
target – The
Optsclass with which the option is associatedparser – the
ArgumentParserto be configuredoptNmae – Name of the option
shortArg – Short form argument for the option
longArg – Long form argument for the option
helpText – Help text
- fsleyes.parseargs._applySpecialOption(args, overlayList, displayCtx, target, optName, longArg)[source]
Called by the
_applyArgsfunction for any options which do not map directly to aSceneOptsorDisplayOptsproperty. Calls the_applySpecialfunction for the option.- Parameters:
args – The
argparse.Namespacecontaining parsed argumentsoverlayList – The
OverlayListdisplayCtx – The
DisplayContextinstancetarget – The
Optsinstance with which the option is associatedoptNmae – Name of the option
longArg – Name of the corresponding command line argument
- fsleyes.parseargs._generateSpecialOption(overlayList, displayCtx, source, optName, longArg)[source]
Called by the
_generateArgs()function for any options which do not map directly to aSceneOpts,DisplayorDisplayOptsinstance. Calls the_generateSpecialfunction for the option.- Parameters:
overlayList – The
OverlayListdisplayCtx – The
DisplayContextinstancesource – The
Optsinstance with which the option is associatedoptNmae – Name of the option
longArg – String to use as the long form argument
- fsleyes.parseargs._isSpecialConfigOption(target, optName)[source]
Returns
Trueif the given option has a special configuration function,Falseotherwise.
- fsleyes.parseargs._isSpecialApplyOption(target, optName)[source]
Returns
Trueif the given option has a special apply function,Falseotherwise.
- fsleyes.parseargs._isSpecialGenerateOption(target, optName)[source]
Returns
Trueif the given option has a special generation function,Falseotherwise.
- fsleyes.parseargs._getSpecialFunction(target, optName, prefix)[source]
Searches for a function in this module with the name
_prefix_target_option, searching the class hierarchy fortarget.
- fsleyes.parseargs._configSpecial_FileOption(target, parser, shortArg, longArg, helpText)[source]
Used by various
_configSpecialfunctions to configure arguments which expect to be passed an overlay file (e.g.VolumeOpts.clipImage).
- fsleyes.parseargs._applySpecial_FileOption(value, overlayList, displayCtx, target, propName, warn=True)[source]
Used by various
_applySpecialfunctions to configure arguments which expect to be passed an overlay file (e.g.VolumeOpts.clipImage).This function returns
Trueif an image was successfully loaded,Falseotherwise.
- fsleyes.parseargs._generateSpecial_FileOption(overlayList, displayCtx, source, longArg, propName)[source]
Used by various
_generateSpecialfunctions to configure arguments which expect to be passed an overlay file (e.g.VolumeOpts.clipImage).
- fsleyes.parseargs._configSpecial_OrthoOpts_xcentre(target, parser, shortArg, longArg, helpText)[source]
Configures the
xcentreoption for theOrthoOptsclass.
- fsleyes.parseargs._configSpecial_OrthoOpts_ycentre(target, parser, shortArg, longArg, helpText)[source]
Configures the
ycentreoption for theOrthoOptsclass.
- fsleyes.parseargs._configSpecial_OrthoOpts_zcentre(target, parser, shortArg, longArg, helpText)[source]
Configures the
zcentreoption for theOrthoOptsclass.
- fsleyes.parseargs._applySpecial_OrthoOpts_xcentre(args, overlayList, displayCtx, target)[source]
Applies the
OrthoOpts.xcentreoption.
- fsleyes.parseargs._applySpecial_OrthoOpts_ycentre(args, overlayList, displayCtx, target)[source]
Applies the
OrthoOpts.ycentreoption.
- fsleyes.parseargs._applySpecial_OrthoOpts_zcentre(args, overlayList, displayCtx, target)[source]
Applies the
OrthoOpts.zcentreoption.
- fsleyes.parseargs._applySpecialOrthoOptsCentre(centre, displayCtx, xax, yax, canvas)[source]
Shared by the
xcentre,ycentre, andzcentrefunctions.
- fsleyes.parseargs._generateSpecial_OrthoOpts_xcentre(overlayList, displayCtx, source, longArg)[source]
Generates CLI arguments for the
OrthoOpts.xcentreoption.
- fsleyes.parseargs._generateSpecial_OrthoOpts_ycentre(overlayList, displayCtx, source, longArg)[source]
Generates CLI arguments for the
OrthoOpts.ycentreoption.
- fsleyes.parseargs._generateSpecial_OrthoOpts_zcentre(overlayList, displayCtx, source, longArg)[source]
Generates CLI arguments for the
OrthoOpts.zcentreoption.
- fsleyes.parseargs._generateSpecialOrthoOptsCentre(displayCtx, xax, yax, canvas)[source]
Used by the generation functions for the
xcentre,ycentre, andzcentreoptions.
- fsleyes.parseargs._applyDefault_LightBoxOpts_zrange(args, overlayList, displayCtx, target)[source]
Calculates a default value for the
LightBoxOpts.zrangeproperty when it is not specified on the command line.
- fsleyes.parseargs._configSpecial_LightBoxOpts_numSlices(target, parser, shortArg, longArg, helpText)[source]
Configures the
numSlicesoption for theLightBoxOptsclass.
- fsleyes.parseargs._applySpecial_LightBoxOpts_numSlices(args, overlayList, displayCtx, target)[source]
Applies the
LightBoxOpts.numSlicesoption.
- fsleyes.parseargs._generateSpecial_LightBoxOpts_numSlices(overlayList, displayCtx, source, longArg)[source]
Suppress the
--numSlicesoption. It is an (inverted) alias forLightBoxOpts.sliceSpacing.
- fsleyes.parseargs._configSpecial_LightBoxOpts_sliceLocation(target, parser, shortArg, longArg, helpText)[source]
Configures the
--sliceLocationoption for theLightBoxOptsclass. This is a simplified alias for theLightBoxOpts.labelSpace`property.
- fsleyes.parseargs._applySpecial_LightBoxOpts_sliceLocation(args, overlayList, displayCtx, target)[source]
Applies the
--sliceLocationoption to theLightBoxOpts.labelSpaceproperty.
- fsleyes.parseargs._generateSpecial_LightBoxOpts_sliceLocation(overlayList, displayCtx, source, longArg)[source]
Suppress the
--sliceLocationoption. It is a simplified alias forLightBoxOpts.labelSpace.
- fsleyes.parseargs._generateSpecial_LightBoxOpts_nrows(overlayList, displayCtx, source, longArg)[source]
Suppress the
--nrowsoption. This option is only applicable to off-screen rendering.
- fsleyes.parseargs._generateSpecial_LightBoxOpts_ncols(overlayList, displayCtx, source, longArg)[source]
Suppress the
--ncolsoption. This option is only applicable to off-screen rendering.
- fsleyes.parseargs._configSpecial_LightBoxOpts_asVoxels(target, parser, shortArg, longArg, helpText)[source]
Adds an argument for the
--asVoxelsoption.
- fsleyes.parseargs._applySpecial_LightBoxOpts_asVoxels(args, overlayList, displayCtx, target)[source]
Handler for the
--asVoxelsoption. Interprets--zrangeand--sliceSpacingas voxel coordinates, and pass them toLightBoxOpts.setSlicesFromVoxels().
- fsleyes.parseargs._LightBoxOptsAsVoxelsReference(overlayList, displayCtx, opts)[source]
Used by the following functions, which handle generating light box slice options in terms of voxel coordinates.
If
LightBoxOpts.sampleSlicesis set to'start', it is assumed that the user has configured thezrangeandsliceSpacingproperties in terms of voxel coordinates with respect to the currently selected image.If this is the case, a reference to the currently selected image is returned. Otherwise,
Noneis returned.
- fsleyes.parseargs._generateSpecial_LightBoxOpts_asVoxels(overlayList, displayCtx, source, longArg)[source]
Conditionally adds
--asVoxels, and command-line flags forLightBoxOpts.zrangeandLightBoxOpts.sliceSpacing, if it looks like the user has specified them in terms of voxel coordinates.
- fsleyes.parseargs._generateSpecial_LightBoxOpts_zrange(overlayList, displayCtx, source, longArg)[source]
Conditionally enables or suppresses default generation of command-line options for the
LightBoxOpts.zrangeproperty, depending on whether--asVoxelsis active (see above).
- fsleyes.parseargs._generateSpecial_LightBoxOpts_sliceSpacing(overlayList, displayCtx, source, longArg)[source]
Conditionally enables or suppresses default generation of command-line options for the
LightBoxOpts.sliceSpacingproperty, depending on whether--asVoxelsis active (see above).
- fsleyes.parseargs._applySpecial_LightBoxOpts_zrange(args, overlayList, displayCtx, target)[source]
Handler for the
--zrangeoption. If--asVoxelsis active, normal (fsleyes_props-based) argument handling is inhibited.
- fsleyes.parseargs._applySpecial_LightBoxOpts_sliceSpacing(args, overlayList, displayCtx, target)[source]
Handler for the
--sliceSpacingoption. If--asVoxelsis active, normal (fsleyes_props-based) argument handling is inhibited.
- fsleyes.parseargs._applySpecial_SceneOpts_movieSyncRefresh(args, overlayList, displayCtx, target)[source]
Applies the
SceneOpts.movieSyncRefreshoption.
- fsleyes.parseargs._configSpecial_NiftiOpts_index(target, parser, shortArg, longArg, helpText)[source]
Configures the
indexoption for theNiftiOptsclass. This option allows the index for each >3rd dimension to be specified, for images with four or dimensions. For images with four dimensions, the –volume option can also be used.
- fsleyes.parseargs._applySpecial_NiftiOpts_index(args, overlayList, displayCtx, target)[source]
Applies the
NiftiOpts.indexoption.
- fsleyes.parseargs._generateSpecial_NiftiOpts_index(overlayList, displayCtx, source, longArg)[source]
Generates arguemnts for the
NiftiOpts.indexoption.
- fsleyes.parseargs._applySpecialNegativeCmap(args, overlayList, displayCtx, target)[source]
Used by the functions below.
- fsleyes.parseargs._applySpecial_VolumeOpts_negativeCmap(*args, **kwargs)[source]
Applies the
VolumeOpts.negativeCmapoption. Automatically enables theVolumeOpts.useNegativeCmapoption.
- fsleyes.parseargs._applySpecial_MeshOpts_negativeCmap(*args, **kwargs)[source]
Applies the
MeshOpts.negativeCmapoption. Automatically enables theMeshOpts.useNegativeCmapoption.
- fsleyes.parseargs._applySpecial_TractogramOpts_negativeCmap(*args, **kwargs)[source]
Applies the
TractogramOpts.negativeCmapoption. Automatically enables theTractogramOpts.useNegativeCmapoption.
- fsleyes.parseargs._configSpecial_Volume3DOpts_clipPlane(target, parser, shortArg, longArg, helpText)[source]
Configures the
clipPlaneoption for theVolumeOptsclass. This option allows a clip plane to be defined - the user provides the position, azimuth and inclination as a single argument.
- fsleyes.parseargs._applySpecial_Volume3DOpts_clipPlane(args, overlayList, displayCtx, target)[source]
Applies the
Volume3DOpts.clipPlaneoption.
- fsleyes.parseargs._generateSpecial_Volume3DOpts_clipPlane(overlayList, displayCtx, source, longArg)[source]
Generates arguemnts for the
Volume3DOpts.clipPlaneoption.
- fsleyes.parseargs._configSpecial_Scene3DOpts_cameraRotation(target, parser, shortArg, longArg, helpText)[source]
Configures the
Scene3DOpts.cameraRotationoption.
- fsleyes.parseargs._applySpecial_Scene3DOpts_cameraRotation(args, overlayList, displayCtx, target)[source]
Applies the
Scene3DOpts.cameraRotationoption.
- fsleyes.parseargs._generateSpecial_Scene3DOpts_cameraRotation(overlayList, displayCtx, source, longArg)[source]
Generates arguments for the
Scene3DOpts.cameraRotationoption.
- fsleyes.parseargs._applySpecial_VectorOpts_orientFlip(args, overlayList, displayCtx, target)[source]
Applies the
VectorOpts.orientFlipoption.The
VectorOpts.orientFlipproperty is initialised toFalsefor images with a radiological storage order, andTruefor images with a neurological storage order. So if this argument is specified, we need to invert its initial value - apply the flip for radiologically stored images, but not for neurologically stored images.
- fsleyes.parseargs._generateSpecial_VectorOpts_orientFlip(overlayList, displayCtx, source, longArg)[source]
Generates the
VectorOpts.orientFlipoption.
- fsleyes.parseargs._configSpecial_VectorOpts_clipImage(target, parser, shortArg, longArg, helpText)[source]
Configures an
ArgumentParserto handle theVectorOpts.clipImageoption.
- fsleyes.parseargs._applySpecial_VectorOpts_clipImage(args, overlayList, displayCtx, target)[source]
Sets the
VectorOpts.clipImageoption from command-line arguments.
- fsleyes.parseargs._generateSpecial_VectorOpts_clipImage(overlayList, displayCtx, source, longArg)[source]
Generates command-line arguments from the
VectorOpts.clipImageoption.
- fsleyes.parseargs._configSpecial_VectorOpts_modulateImage(target, parser, shortArg, longArg, helpText)[source]
Configures an
ArgumentParserto handle theVectorOpts.modulateImageoption.
- fsleyes.parseargs._applySpecial_VectorOpts_modulateImage(args, overlayList, displayCtx, target)[source]
Sets the
VectorOpts.modulateImageoption from command-line arguments.
- fsleyes.parseargs._generateSpecial_VectorOpts_modulateImage(overlayList, displayCtx, source, longArg)[source]
Generates command-line arguments from the
VectorOpts.modulateImageoption.
- fsleyes.parseargs._configSpecial_VectorOpts_colourImage(target, parser, shortArg, longArg, helpText)[source]
Configures an
ArgumentParserto handle theVectorOpts.colourImageoption.
- fsleyes.parseargs._applySpecial_VectorOpts_colourImage(args, overlayList, displayCtx, target)[source]
Sets the
VectorOpts.colourImageoption from command-line arguments.
- fsleyes.parseargs._generateSpecial_VectorOpts_colourImage(overlayList, displayCtx, source, longArg)[source]
Generates command-line arguments from the
VectorOpts.colourImageoption.
- fsleyes.parseargs._configSpecial_MeshOpts_flatShading(target, parser, shortArg, longArg, helpText)[source]
Configures the deprecated MeshOpts.flatShading option. This has been replaced by
MeshOpts.interpolation, and is the equivalent of settingMeshOpts.interpolationto'nearest'.
- fsleyes.parseargs._applySpecial_MeshOpts_flatShading(args, overlayList, displayCtx, target)[source]
Applies the deprecated
MeshOpts.flatShadingoption.
- fsleyes.parseargs._generateSpecial_MeshOpts_flatShading(overlayList, displayCtx, source, longArg)[source]
Returns no argument - the
MeshOpts.flatShadingoption is deprecated.
- fsleyes.parseargs._applySpecial_MeshOpts_vertexData(args, overlayList, displayCtx, target)[source]
Applies the
MeshOpts.vertexDataoption.
- fsleyes.parseargs._applySpecial_MeshOpts_modulateData(args, overlayList, displayCtx, target)[source]
Applies the
MeshOpts.modulateDataoption.
- fsleyes.parseargs._applySpecial_MeshOpts_vertexSet(args, overlayList, displayCtx, target)[source]
Applies the
MeshOpts.vertexSetoption.
- fsleyes.parseargs._configSpecial_RefImageOpts_refImage(target, parser, shortArg, longArg, helpText)[source]
Configures an
ArgumentParserto handle theRefImageOpts.refImageoption.
- fsleyes.parseargs._applySpecial_RefImageOpts_refImage(args, overlayList, displayCtx, target)[source]
Sets the
RefImageOpts.refImageoption from command-line arguments.
- fsleyes.parseargs._generateSpecial_RefImageOpts_refImage(overlayList, displayCtx, source, longArg)[source]
Generates command-line arguments from the
RefImageOpts.refImageoption.
- fsleyes.parseargs._configSpecial_VolumeOpts_clipImage(target, parser, shortArg, longArg, helpText)[source]
Configures an
ArgumentParserto handle theVolumeOpts.clipImageoption.
- fsleyes.parseargs._applySpecial_VolumeOpts_clipImage(args, overlayList, displayCtx, target)[source]
Sets the
VolumeOpts.clipImageoption from command-line arguments.
- fsleyes.parseargs._generateSpecial_VolumeOpts_clipImage(overlayList, displayCtx, source, longArg)[source]
Generates command-line arguments from the
VolumeOpts.clipImageoption.
- fsleyes.parseargs._configSpecial_VolumeOpts_modulateImage(target, parser, shortArg, longArg, helpText)[source]
Configures an
ArgumentParserto handle theVolumeOpts.modulateImageoption.
- fsleyes.parseargs._applySpecial_VolumeOpts_modulateImage(args, overlayList, displayCtx, target)[source]
Sets the
VolumeOpts.modulateImageoption from command-line arguments.
- fsleyes.parseargs._generateSpecial_VolumeOpts_modulateImage(overlayList, displayCtx, source, longArg)[source]
Generates command-line arguments from the
VolumeOpts.modulateImageoption.
- fsleyes.parseargs._applySpecial_VolumeOpts_overrideDataRange(args, overlayList, displayCtx, target)[source]
Applies the
VolumeOpts.overrideDataRangeoption.If the
overrideDataRangecommand line argument has been provided, we need to set theVolumeOpts.enableOverrideDataRangeproperty.
- fsleyes.parseargs._generateSpecial_VolumeOpts_overrideDataRange(overlayList, displayCtx, source, longArg)[source]
Generates the
VolumeOpts.overrideDataRangeoption.If the
VolumeOpts.enableOverrideDataRangeproperty isFalse, no arguments are generated.
- fsleyes.parseargs._applySpecial_VolumeOpts_clippingRange(args, overlayList, displayCtx, target)[source]
Applies the
VolumeOpts.clippingRangeoption.The
VolumeOpts.clippingRangeproperty can be specified on the command line normally (as two numbers), or can be specified as a percentile by appending a'%'character to the high range value.
- fsleyes.parseargs._applySpecial_VolumeOpts_modulateRange(args, overlayList, displayCtx, target)[source]
Applies the
VolumeOpts.modulateRangeoption.The
VolumeOpts.modulateRangeproperty can be specified on the command line normally (as two numbers), or can be specified as a percentile by appending a'%'character to the high range value.
- fsleyes.parseargs._applySpecial_VolumeOpts_displayRange(args, overlayList, displayCtx, target)[source]
Applies the
VolumeOpts.displayRangeoption.The
VolumeOpts.displayRangeproperty can be specified on the command line normally (as two numbers), or can be specified as a percentile by appending a'%'character to the high range value.
- fsleyes.parseargs._applyVolumeOptsRange(arange, target, auximage=None)[source]
This function is used to parse display/clipping range arguments.
- fsleyes.parseargs._parseDisplayRange(arange)[source]
Parses values given to a display range command-line option. Used for
--displayRange,--clippingRange--modulateRange, and--initialDisplayRange.- Returns a tuple containing:
the
(low, high)range values as floats.Trueif the values should be interpreted as percentiles,Falseif they should be interpreted as raw intensities.
- fsleyes.parseargs._applySpecial_ColourMapOpts_cmap(args, overlayList, displayCtx, target)[source]
Handles the
ColourMapOpts.cmapoption. See_applyColourMap().
- fsleyes.parseargs._applySpecial_ColourMapOpts_negativeCmap(args, overlayList, displayCtx, target)[source]
Handles the
ColourMapOpts.negativeCmapoption. See_applyColourMap().
- fsleyes.parseargs._applySpecial_VectorOpts_cmap(args, overlayList, displayCtx, target)[source]
Handles the
VectorOpts.cmapoption. See_applyColourMap().
- fsleyes.parseargs._applyColourMap(cmap, overlayList, displayCtx)[source]
Handles a colour map argument. If the specified colour map is a file, it is loaded and registered with the
colourmapsmodule. Returns a new value for the colour map argument.
- fsleyes.parseargs._generateSpecial_ColourMapOpts_cmap(overlayList, displayCtx, source, longArg)[source]
Generates arguments for the
ColourMapOpts.cmapargument.
- fsleyes.parseargs._generateSpecial_ColourMapOpts_negativeCmap(overlayList, displayCtx, source, longArg)[source]
Generates arguments for the
ColourMapOpts.negativeCmapargument.
- fsleyes.parseargs._generateSpecial_VectorOpts_cmap(overlayList, displayCtx, source, longArg)[source]
Generates arguments for the
VectorOpts.lutargument.
- fsleyes.parseargs._generateColourMap(longArg, cmap)[source]
Generates a command line argument for the given colour map. This be different depending on whether the colour map is installed as a FSLeyes colour map, or has been manualy specified from a colour map file.
- fsleyes.parseargs._applySpecial_LabelOpts_lut(args, overlayList, displayCtx, target)[source]
Handles the
LabelOpts.lutoption. See_applyLookupTable().
- fsleyes.parseargs._applySpecial_MeshOpts_lut(args, overlayList, displayCtx, target)[source]
Handles the
MeshOpts.lutoption. See_applyLookupTable().
- fsleyes.parseargs._applyLookupTable(lut, overlayList, displayCtx)[source]
Handles a lookup table argument. If the specified lookup table is a file, it is loaded and registered with the
colourmapsmodule. Returns a new value for the lookup table argument.
- fsleyes.parseargs._generateSpecial_LabelOpts_lut(overlayList, displayCtx, source, longArg)[source]
Generates arguments for the
LabelOpts.lutargument.
- fsleyes.parseargs._generateSpecial_MeshOpts_lut(overlayList, displayCtx, source, longArg)[source]
Generates arguments for the
MeshOpts.lutargument.
- fsleyes.parseargs._generateLookupTable(longArg, lut)[source]
Generates a command line argument for the given lookup table. This will be different depending on whether the lookup table is installed as a FSLeyes lookup tablea, or has been manualy specified from a lookup table file.
- fsleyes.parseargs._configSpecial_TractogramOpts_colourBy(target, parser, shortArg, longArg, helpText)[source]
Configures the –colourBy option for
TractogramOptsinstances. This option allows theTractogramOpts.colourModeoption to be set to some per-vertex/streamline data, or to anImageinstance.
- fsleyes.parseargs._configSpecial_TractogramOpts_clipBy(target, parser, shortArg, longArg, helpText)[source]
Configures the –clipBy option for
TractogramOptsinstances. This option allows theTractogramOpts.clipModeoption to be set to some per-vertex/streamline data, or to anImageinstance.
- fsleyes.parseargs._applySpecial_TractogramOpts_colourBy(args, overlayList, displayCtx, target)[source]
Applies the
--colourByoption, setting theTractogramOpts.colourModeproperty.
- fsleyes.parseargs._applySpecial_TractogramOpts_clipBy(args, overlayList, displayCtx, target)[source]
Applies the
--clipByoption, setting theTractogramOpts.clipModeproperty.
- fsleyes.parseargs._applySpecial_TractogramOpts_xBy(val, overlayList, displayCtx, target, propName)[source]
Used by
_applySpecial_TractogramOpts_xBy()and_applySpecial_TractogramOpts_xBy(). Applies the--colourByor--clipByoption forTractogramOpts, which respectively affect theTractogramOpts.colourModeandTractogramOpts.clipModeproperties.
- fsleyes.parseargs._generateSpecial_TractogramOpts_colourBy(overlayList, displayCtx, source, longArg)[source]
Generates arguments for the
TractogramOpts.colourModeargument.
- fsleyes.parseargs._generateSpecial_TractogramOpts_clipBy(overlayList, displayCtx, source, longArg)[source]
Generates arguments for the
TractogramOpts.clipModeargument.
- fsleyes.parseargs._generateSpecial_TractogramOpts_xBy(value, source, longArg)[source]
Used by
_generateSpecial_TractogramOpts_colourBy()and_generateSpecial_TractogramOpts_clipBy(). Generates command-line arguments for theTractogramOpts.colourModeandTractogramOpts.clipModeproperties.