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', # . # . # . })If the property specifies a file/path name (e.g.
VolumeOpts.clipImage), add an entry in theFILE_OPTIONSdictionary. In the present example, this is not necessary, but if it were, theFILE_OPTIONSentry 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.
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._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.
Note
This is unnecessary in python 3.5 and above, due to the addition of the
allow_abbrevoption.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 (if defined)
-
-
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:
argparse.RawDescriptionHelpFormatterA custom
argparse.HelpFormatterclass which customises a few annoying things about defaultargparsebehaviour.-
__module__= 'fsleyes.parseargs'¶
-
-
fsleyes.parseargs.OPTIONS= <MagicMock name='mock.utils.typedict.TypeDict()' id='4116378456'>¶ 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= <MagicMock name='mock.utils.typedict.TypeDict()' id='4116378456'>¶ 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= <MagicMock name='mock.utils.typedict.TypeDict()' id='4116378456'>¶ This dictionary contains descriptions for each argument group.
-
fsleyes.parseargs.GROUPEPILOGS= <MagicMock name='mock.utils.typedict.TypeDict()' id='4116378456'>¶ 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= <MagicMock name='mock.utils.typedict.TypeDict()' id='4116378456'>¶ 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= <MagicMock name='mock.utils.typedict.TypeDict()' id='4116378456'>¶ This dictionary defines the help text for all command line options.
-
fsleyes.parseargs.SHORT_HELP= <MagicMock name='mock.utils.typedict.TypeDict()' id='4116378456'>¶ 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='4116378456'>¶ 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.TRANSFORMS= <MagicMock name='mock.utils.typedict.TypeDict()' id='4116378456'>¶ 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)[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
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)[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.
-
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]¶ 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 theoverlayListbefore 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_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._applySpecial_SceneOpts_movieSyncRefresh(args, overlayList, displayCtx, target)[source]¶ Applies the
SceneOpts.movieSyncRefreshoption.
-
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_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._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._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.