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.Namespace object which contains the parsed options.

  • _Apply_ the options contained in an argparse.Namespace option to the objects which describe a scene - a SceneOpts instance, a DisplayContext instance, and the Display and DisplayOpts instances 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, LightBoxOpts and DisplayContext classes.

  • 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 Display class, and sub-classes of DisplayOpts.

This module provides the following functions:

parseArgs

Parses the given command line arguments, returning an argparse.Namespace object containing all the arguments.

applyMainArgs

Applies top-level arguments that are not specific to the scene or any overlays.

applySceneArgs

Configures the scene displayed by the given DisplayContext instance according to the arguments that were passed in on the command line.

applyOverlayArgs

Loads and configures any overlays which were specified on the command line.

generateSceneArgs

Generates command line arguments which describe the current state of the provided displayCtx and sceneOpts instances.

generateOverlayArgs

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):

  1. All overlay paths are identified.

  2. Main arguments are separated out from the display arguments for every overlay.

  3. Main arguments are parsed.

  4. The display arguments for each overlay are parsed, using a parser that is only configured to identify the overlay type.

  5. 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:

  1. Add an entry to the OPTIONS dictionary:

    OPTIONS = td.TypeDict({
        # .
        # .
        # .
        'MeshOpts'      : ['colour',
                           'outline',
                           'outlineWidth',
                           'refImage',
                           'rotation'],
        # .
        # .
        # .
    })
    
  2. Specify the command line flags to use, in the ARGUMENTS dictionary:

    ARGUMENTS = td.TypeDict({
        # .
        # .
        # .
        'MeshOpts.rotation' : ('mr', 'meshRotation', True),
        # .
        # .
        # .
    })
    
  3. Add a description in the HELP dictionary:

    HELP = td.TypeDict({
        # .
        # .
        # .
        'MeshOpts.rotation' : 'Rotate the mesh by this much',
        # .
        # .
        # .
    })
    
  4. If the property specifies a file/path name (e.g. VolumeOpts.clipImage), add an entry in the FILE_OPTIONS dictionary. In the present example, this is not necessary, but if it were, the FILE_OPTIONS entry might look like this:

    FILE_OPTIONS = td.TypeDict({
        # .
        # .
        # .
        'MeshOpts' : ['refImage', 'rotation'],
        # .
        # .
        # .
    })
    

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.

  1. Following steps 1-3 above, we add 'clipAndDisplay' to the OPTIONS['VolumeOpts'] list, and add a 'VolumeOpts.clipAndDisplay' entries to the ARGUMENTS and HELP dictionaries.

  2. 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 target is the name of the DisplayOpts class you are adding an option for (e.g. 'VolumeOpts'), and option is 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 ArgumentParser instance.

  3. 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 None or False, 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 by fsleyes_props.applyArguments(), you can have your apply function return True, which indicates that the arguemnt should be passed through to applyArguments, in addition to being handled by your apply function.

  4. Add a function which, given a target instance, will generate command line arguments that can reproduce the target state. 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 the fsleyes_props.generateArguments() function.

fsleyes.parseargs._get_option_tuples(self, option_string)[source]

By default, the argparse module 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.

Note

This is unnecessary in python 3.5 and above, due to the addition of the allow_abbrev option.

See http://stackoverflow.com/questions/33900846/ disable-unique-prefix-matches-for-argparse-and-optparse

exception fsleyes.parseargs.ArgumentError[source]

Bases: Exception

Custom Exception class raised by ArgumentParser instances created and used in this module.

__module__ = 'fsleyes.parseargs'
__weakref__

list of weak references to the object (if defined)

fsleyes.parseargs.ArgumentParser(*args, **kwargs)[source]

Wrapper around the argparse.ArgumentParser` constructor which creates, monkey-patches, and returns an ``ArgumentParser instance.

class fsleyes.parseargs.FSLeyesHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)[source]

Bases: argparse.RawDescriptionHelpFormatter

A custom argparse.HelpFormatter class which customises a few annoying things about default argparse behaviour.

_format_usage(usage, actions, groups, prefix)[source]
__module__ = 'fsleyes.parseargs'
fsleyes.parseargs.OPTIONS = <MagicMock name='mock.utils.typedict.TypeDict()' id='281473492539520'>

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 a HasProperties class, and the list of values are the names of properties on that class.

fsleyes.parseargs.GROUPNAMES = <MagicMock name='mock.utils.typedict.TypeDict()' id='281473492539520'>

Command line arguments are grouped according to the class to which they are applied (see the ARGUMENTS dictionary). This dictionary defines descriptions for each command line group.

fsleyes.parseargs.GROUPDESCS = <MagicMock name='mock.utils.typedict.TypeDict()' id='281473492539520'>

This dictionary contains descriptions for each argument group.

fsleyes.parseargs.GROUPEPILOGS = <MagicMock name='mock.utils.typedict.TypeDict()' id='281473492539520'>

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 GROUPEPILOGS dictionary. The target must be a type.

fsleyes.parseargs.ARGUMENTS = <MagicMock name='mock.utils.typedict.TypeDict()' id='281473492539520'>

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 expectsArguments is True if the flag is to be followed by one or more arguments, False otherwise.

Note

  1. There cannot be any collisions between the main options, the SceneOpts options, the OrthOpts options, the LightBoxOpts options, and the Scene3DOpts options.

  2. There cannot be any collisions between the Display options and any one set of DisplayOpts options.

  3. There can be collisions between these two groups, and between the options for different DisplayOpts types.

fsleyes.parseargs.HELP = <MagicMock name='mock.utils.typedict.TypeDict()' id='281473492539520'>

This dictionary defines the help text for all command line options.

fsleyes.parseargs.SHORT_HELP = <MagicMock name='mock.utils.typedict.TypeDict()' id='281473492539520'>

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.FILE_OPTIONS = <MagicMock name='mock.utils.typedict.TypeDict()' id='281473492539520'>

This dictionary contains all arguments which accept file or path names. These arguments need special treatment - for these arguments, the user may specify a file which refers to an overlay that may or may not have already been loaded, so we need to figure out what to do.

fsleyes.parseargs._imageTrans(i, **kwargs)[source]
fsleyes.parseargs._boolTrans(b, **kwargs)[source]
fsleyes.parseargs._colourTrans(c, **kwargs)[source]
fsleyes.parseargs.TRANSFORMS = <MagicMock name='mock.utils.typedict.TypeDict()' id='281473492539520'>

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() and props.generateArguments() functions.

fsleyes.parseargs._setupMainParser(mainParser)[source]

Sets up an argument parser which handles options related to the scene. This function configures the following argument groups:

  • Main: Top level optoins

  • 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, propNames=None, shortHelp=False)[source]

Configures the given parser so it will parse arguments for the given target.

fsleyes.parseargs._configMainParser(mainParser)[source]

Adds options to the given parser which allow the user to specify main FSLeyes options.

fsleyes.parseargs._setupOverlayParsers(forHelp=False, shortHelp=False)[source]

Creates a set of parsers which handle command line options for Display instances, and for all DisplayOpts instances.

Parameters
  • forHelp – If False (the default), each of the parsers created to handle options for the DisplayOpts sub-classes will be configured so that the can also handle options for Display properties. Otherwise, the DisplayOpts parsers will be configured to only handle DisplayOpts properties. 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 the HELP dictionary. Otherwise, help text will be taken from the SHORT_HELP dictionary.

Returns

A tuple containing:

  • An ArgumentParser which parses arguments specifying the Display properties. This parser is not actually used to parse arguments - it is only used to generate help text.

  • An ArgumentParser which just parses arguments specifying the Display.overlayType property.

  • An ArgumentParser which parses arguments specifying Display and DisplayOpts properties.

fsleyes.parseargs.parseArgs(mainParser, argv, name, prolog=None, desc=None, usageProlog=None, argOpts=None, shortHelpExtra=None)[source]

Parses the given command line arguments, returning an argparse.Namespace object containing all the arguments.

The display options for individual overlays are parsed separately. The Namespace objects for each overlay are returned in a list, stored as an attribute, called overlays, of the returned top-level Namespace instance. Each of the overlay Namespace instances also has an attribute, called overlay, which contains the full path of the overlay file that was speciied.

A SystemExit exception is raised if invalid arguments have been passed in or, for example, the user simply requested command line help.

Parameters
  • mainParser – A argparse.ArgumentParser which 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, or main.

  • 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 mainParser has 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.

fsleyes.parseargs._printVersion(name)[source]

Prints the current FSLeyes version.

Parameters

name – Name of the tool (probably either fsleyes or render).

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 another source instance 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() or applyOverlayArgs().

Parameters
  • argsargparse.Namespace object containing the parsed command line arguments.

  • overlayList – A OverlayList instance.

  • displayCtx – A DisplayContext instance.

fsleyes.parseargs.applySceneArgs(args, overlayList, displayCtx, sceneOpts)[source]

Configures the scene displayed by the given DisplayContext instance 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 the applyOverlayArgs() function also applies its arguments asynchrnously, and we want the order of application to match the order in which these functions were called.

Parameters
  • argsargparse.Namespace object containing the parsed command line arguments.

  • overlayList – A OverlayList instance.

  • displayCtx – A DisplayContext instance.

  • sceneOpts – A SceneOpts instance.

fsleyes.parseargs.generateSceneArgs(overlayList, displayCtx, sceneOpts, exclude=None)[source]

Generates command line arguments which describe the current state of the provided displayCtx and sceneOpts instances.

Parameters
fsleyes.parseargs.generateOverlayArgs(overlay, overlayList, displayCtx)[source]

Generates command line arguments which describe the display of the current overlay.

Parameters
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 uses idle.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 the loadoverlay.loadOverlays() documentation for more details.

Parameters
  • args – A Namespace instance, as returned by the parseArgs() function.

  • overlayList – An OverlayList instance, to which the overlays should be added.

  • displayCtx – A DisplayContext instance, which manages the scene and overlay display.

  • loadOverlays – Defaults to True. If False, 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 (unless loadOverlays``is ``False).

fsleyes.parseargs.wasSpecified(namespace, obj, propName)[source]

Returns True if the given propName on the given object was specified on the command line, False otherwise.

fsleyes.parseargs._findOrLoad(overlayList, overlayFile, overlayType, relatedTo=None)[source]

Searches for the given overlayFile in the overlayList. If not present, it is created using the given overlayType constructor, and inserted into the overlayList. The new overlay is inserted into the overlayList before the relatedTo overlay 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 _configParser function for any options which do not map directly to a SceneOpts or DisplayOpts property. Calls the _configSpecial function for the option.

Parameters
  • target – The Opts class with which the option is associated

  • parser – the ArgumentParser to be configured

  • optNmae – 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 _applyArgs function for any options which do not map directly to a SceneOpts or DisplayOpts property. Calls the _applySpecial function for the option.

Parameters
  • args – The argparse.Namespace containing parsed arguments

  • overlayList – The OverlayList

  • displayCtx – The DisplayContext instance

  • target – The Opts instance with which the option is associated

  • optNmae – 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 a SceneOpts, Display or DisplayOpts instance. Calls the _generateSpecial function for the option.

Parameters
  • overlayList – The OverlayList

  • displayCtx – The DisplayContext instance

  • source – The Opts instance with which the option is associated

  • optNmae – Name of the option

  • longArg – String to use as the long form argument

fsleyes.parseargs._isSpecialConfigOption(target, optName)[source]

Returns True if the given option has a special configuration function, False otherwise.

fsleyes.parseargs._isSpecialApplyOption(target, optName)[source]

Returns True if the given option has a special apply function, False otherwise.

fsleyes.parseargs._isSpecialGenerateOption(target, optName)[source]

Returns True if the given option has a special generation function, False otherwise.

fsleyes.parseargs._getSpecialFunction(target, optName, prefix)[source]

Searches for a function in this module with the name _prefix_target_option, searching the class hierarchy for target.

fsleyes.parseargs._configSpecial_OrthoOpts_xcentre(target, parser, shortArg, longArg, helpText)[source]

Configures the xcentre option for the OrthoOpts class.

fsleyes.parseargs._configSpecial_OrthoOpts_ycentre(target, parser, shortArg, longArg, helpText)[source]

Configures the ycentre option for the OrthoOpts class.

fsleyes.parseargs._configSpecial_OrthoOpts_zcentre(target, parser, shortArg, longArg, helpText)[source]

Configures the zcentre option for the OrthoOpts class.

fsleyes.parseargs._applySpecial_OrthoOpts_xcentre(args, overlayList, displayCtx, target)[source]

Applies the OrthoOpts.xcentre option.

fsleyes.parseargs._applySpecial_OrthoOpts_ycentre(args, overlayList, displayCtx, target)[source]

Applies the OrthoOpts.ycentre option.

fsleyes.parseargs._applySpecial_OrthoOpts_zcentre(args, overlayList, displayCtx, target)[source]

Applies the OrthoOpts.zcentre option.

fsleyes.parseargs._applySpecialOrthoOptsCentre(centre, displayCtx, xax, yax, canvas)[source]

Shared by the xcentre, ycentre, and zcentre functions.

fsleyes.parseargs._generateSpecial_OrthoOpts_xcentre(overlayList, displayCtx, source, longArg)[source]

Generates CLI arguments for the OrthoOpts.xcentre option.

fsleyes.parseargs._generateSpecial_OrthoOpts_ycentre(overlayList, displayCtx, source, longArg)[source]

Generates CLI arguments for the OrthoOpts.ycentre option.

fsleyes.parseargs._generateSpecial_OrthoOpts_zcentre(overlayList, displayCtx, source, longArg)[source]

Generates CLI arguments for the OrthoOpts.zcentre option.

fsleyes.parseargs._generateSpecialOrthoOptsCentre(displayCtx, xax, yax, canvas)[source]

Used by the generation functions for the xcentre, ycentre, and zcentre options.

fsleyes.parseargs._applySpecial_SceneOpts_movieSyncRefresh(args, overlayList, displayCtx, target)[source]

Applies the SceneOpts.movieSyncRefresh option.

fsleyes.parseargs._configSpecial_Volume3DOpts_clipPlane(target, parser, shortArg, longArg, helpText)[source]

Configures the clipPlane option for the VolumeOpts class. 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.clipPlane option.

fsleyes.parseargs._configSpecial_Volume3DOpts_dithering(target, parser, shortArg, longArg, helpText)[source]

Handle the deprecated Volume3DOpts.dithering property.

fsleyes.parseargs._applySpecial_Volume3DOpts_dithering(args, overlayList, displayCtx, target)[source]

Handle the deprecated Volume3DOpts.dithering property.

fsleyes.parseargs._generateSpecial_Volume3DOpts_dithering(overlayList, displayCtx, source, longArg)[source]

Handle the deprecated Volume3DOpts.dithering property.

fsleyes.parseargs._generateSpecial_Volume3DOpts_clipPlane(overlayList, displayCtx, source, longArg)[source]

Generates arguemnts for the Volume3DOpts.clipPlane option.

fsleyes.parseargs._configSpecial_Scene3DOpts_cameraRotation(target, parser, shortArg, longArg, helpText)[source]

Configures the Scene3DOpts.cameraRotation option.

fsleyes.parseargs._applySpecial_Scene3DOpts_cameraRotation(args, overlayList, displayCtx, target)[source]

Applies the Scene3DOpts.cameraRotation option.

fsleyes.parseargs._generateSpecial_Scene3DOpts_cameraRotation(overlayList, displayCtx, source, longArg)[source]

Generates arguments for the Scene3DOpts.cameraRotation option.

fsleyes.parseargs._applySpecial_VectorOpts_orientFlip(args, overlayList, displayCtx, target)[source]

Applies the VectorOpts.orientFlip option.

The VectorOpts.orientFlip property is initialised to False for images with a radiological storage order, and True for 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.orientFlip option.

fsleyes.parseargs._applySpecial_MeshOpts_vertexData(args, overlayList, displayCtx, target)[source]

Applies the MeshOpts.vertexData option.

fsleyes.parseargs._applySpecial_MeshOpts_modulateData(args, overlayList, displayCtx, target)[source]

Applies the MeshOpts.modulateData option.

fsleyes.parseargs._applySpecial_MeshOpts_vertexSet(args, overlayList, displayCtx, target)[source]

Applies the MeshOpts.vertexSet option.

fsleyes.parseargs._applySpecial_VolumeOpts_overrideDataRange(args, overlayList, displayCtx, target)[source]

Applies the VolumeOpts.overrideDataRange option.

If the overrideDataRange command line argument has been provided, we need to set the VolumeOpts.enableOverrideDataRange property.

fsleyes.parseargs._generateSpecial_VolumeOpts_overrideDataRange(overlayList, displayCtx, source, longArg)[source]

Generates the VolumeOpts.overrideDataRange option.

If the VolumeOpts.enableOverrideDataRange property is False, no arguments are generated.

fsleyes.parseargs._applySpecial_VolumeOpts_clippingRange(args, overlayList, displayCtx, target)[source]

Applies the VolumeOpts.clippingRange option.

The VolumeOpts.clippingRange property 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.modulateRange option.

The VolumeOpts.modulateRange property 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.displayRange option.

The VolumeOpts.displayRange property 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._applySpecial_ColourMapOpts_cmap(args, overlayList, displayCtx, target)[source]

Handles the ColourMapOpts.cmap option. See _applyColourMap().

fsleyes.parseargs._applySpecial_ColourMapOpts_negativeCmap(args, overlayList, displayCtx, target)[source]

Handles the ColourMapOpts.negativeCmap option. See _applyColourMap().

fsleyes.parseargs._applySpecial_VectorOpts_cmap(args, overlayList, displayCtx, target)[source]

Handles the VectorOpts.cmap option. 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 colourmaps module. Returns a new value for the colour map argument.

fsleyes.parseargs._generateSpecial_ColourMapOpts_cmap(overlayList, displayCtx, source, longArg)[source]

Generates arguments for the ColourMapOpts.cmap argument.

fsleyes.parseargs._generateSpecial_ColourMapOpts_negativeCmap(overlayList, displayCtx, source, longArg)[source]

Generates arguments for the ColourMapOpts.negativeCmap argument.

fsleyes.parseargs._generateSpecial_VectorOpts_cmap(overlayList, displayCtx, source, longArg)[source]

Generates arguments for the VectorOpts.lut argument.

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.lut option. See _applyLookupTable().

fsleyes.parseargs._applySpecial_MeshOpts_lut(args, overlayList, displayCtx, target)[source]

Handles the MeshOpts.lut option. 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 colourmaps module. Returns a new value for the lookup table argument.

fsleyes.parseargs._generateSpecial_LabelOpts_lut(overlayList, displayCtx, source, longArg)[source]

Generates arguments for the LabelOpts.lut argument.

fsleyes.parseargs._generateSpecial_MeshOpts_lut(overlayList, displayCtx, source, longArg)[source]

Generates arguments for the MeshOpts.lut argument.

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.