Axon python API modules¶
This part of the API is in the Python path, it may be imported without running Brainvisa.
Modules organization¶
brainvisa.axon
: loading Brainvisa in a Python script.brainvisa.processes
: classes about processes and pipelines.brainvisa.anatomist
: specialization of pyanatomist API for Brainvisa. Used by most of Brainvisa viewers.brainvisa.toolboxes
: Toolbox class representing a BrainVISA toolbox.brainvisa.shelltools
: functions to copy, move, delete files.brainvisa.workflow
: Conversion of a Process into a Workflow usable in Soma-workflow.brainvisa.validation
: Definition of an exception that can be raised by processes validation functions.brainvisa.history
: Framework to manage history of processes.brainvisa.multipleExecfile
: A class to load several inter-dependent python files.brainvisa.registration
: referentials and transformations management.
brainvisa.configuration¶
This module contains the classes that manage BrainVisa set of options, accessible throught the menu BrainVISA -> Preferences.
brainvisa.configuration.api
: Initialization of the configuration object that contains the user preferences.brainvisa.configuration.neuroConfig
: global variables describing configuration parameters and user preferences.brainvisa.configuration.anatomist_configuration
: options about Anatomist.brainvisa.configuration.brainvisa_configuration
: general options.brainvisa.configuration.databases_configuration
: options about the databases.brainvisa.configuration.fsl_configuration
: options about FSL.brainvisa.configuration.matlab_configuration
: options about Matlab.brainvisa.configuration.spm_configuration
: options about SPM.brainvisa.configuration.r_configuration
: options about R.brainvisa.configuration.qt4gui
: specific graphical user interface for options about databases and Matlab.brainvisa.configuration.mpegConfig
brainvisa.configuration.soma_workflow_configuration
: Soma-Workflow-related configbrainvisa.configuration.qt4gui.neuroConfigGUI
: Bug report dialog.
brainvisa.data¶
brainvisa.data.neuroData
: classes defining the signature of a process, parameter types.brainvisa.data.neuroDiskItems
: class DiskItem that defines data and matching files.brainvisa.data.neuroHierarchy
: databases creation and initialization.brainvisa.data.fileSystemOntology
: classes to define a BrainVISA ontology.brainvisa.data.sqlFSODatabase
brainvisa.data.readdiskitem
brainvisa.data.writediskitem
brainvisa.data.actions
brainvisa.data.databaseCheck
brainvisa.data.directory_iterator
brainvisa.data.fileformats
brainvisa.data.ftpDirectory
brainvisa.data.labelSelection
brainvisa.data.minfExtensions
: declaration of the type of objects that can be written in minf format.brainvisa.data.patterns
brainvisa.data.sql
brainvisa.data.temporary
brainvisa.data.virtualDirectory
brainvisa.data.qt4gui
brainvisa.processing¶
brainvisa.processing.axon_fso_to_fom
: convert Axon File System Organization (hierarchies) to CAPSUL File Orgnaization Models.brainvisa.processing.axon_to_capsul
: convert Axon processes and pipelines CAPSUL processes or pipelines.brainvisa.processing.capsul_process
: wrapper class to make a CAPSUL process or pipeline available as an Axon process.brainvisa.processing.neuroException
: classes and functions defining error and warning messages.brainvisa.processing.neuroLog
: creation of BrainVISA log file.brainvisa.processing.process_based_viewer
: specialized viewer process, which works with a process or pipeline to get its parameters
brainvisa.tools¶
brainvisa.tools.aimsGlobals
: definition of named lists of formats.brainvisa.tools.mainthreadlife
: ensure an object is deleted in the main thread.brainvisa.tools.matlabValidation
: validation function that checks if matlab is enabled.brainvisa.tools.spm_conversion
brainvisa.tools.spm_registration
brainvisa.tools.spm_results
brainvisa.tools.spm_run
brainvisa.tools.spm_segmentation
brainvisa.tools.spm_utils
brainvisa.tools.DisplayResultsFromSPM
brainvisa.tools.displayTitledGrid
brainvisa.processing.qt4gui: GUI Modules¶
The classes related to the graphical user interface are located in qt4gui
modules. They use PyQt API, a set of Python bindings for Qt application framework:
brainvisa.processing.qtgui.backwardCompatibleQt
: it has been used to keep backward compatibility with old versions of PyQt.brainvisa.processing.qt4gui.neuroProcessesGUI
: BrainVISA main window and processes windows.brainvisa.processing.qt4gui.neuroExceptionGUI
: Error and warning messages window.brainvisa.processing.qt4gui.neuroLogGUI
: Log window.brainvisa.processing.qt4gui.command
: class CommandWithQProcess used to call commands in Brainvisa processes. This module is not related to the graphical user interface but it uses Qt, that’s why it is inqt4gui
module.
Some qtgui
modules also exist but are mainly just redirections to the corresponding qt4gui
module. It was useful when we maintained the compatibility with qt3 but is no more the case.
Note that the qt4gui
modules do work for both Qt4 and Qt5.
brainvisa.data.qt4gui: GUI Modules¶
brainvisa.data.qt4gui.databaseCheckGUI
brainvisa.data.qt4gui.diskItemBrowser
brainvisa.data.qt4gui.hierarchyBrowser
brainvisa.data.qt4gui.history
brainvisa.data.qt4gui.labelSelectionGUI
brainvisa.data.qt4gui.neuroDataGUI
: Editor windows for the parameter types defined inbrainvisa.data.neuroData
.brainvisa.data.qt4gui.readdiskitemGUI
brainvisa.data.qt4gui.scalarFeaturesViewer
brainvisa.data.qt4gui.updateDatabases
brainvisa.shelltools¶
brainvisa.anatomist: a specialized wrapper for Anatomist¶
-
class
brainvisa.anatomist.
AWindowChoice
(noSelectionLabel=None, aslist=False)[source]¶ Bases:
brainvisa.data.neuroData.Choice
A process parameter to choose an Anatomist window. This parameter is a choice between several anatomist windows. By default, if anatomist isn’t started or if there’s no opened windows, the choice offer the possibility to create any type of anatomist window.
If anatomist is started, the set of opened window is added to the choices list.
The list of choices is not updated automatically, to refresh the choices it is necessary to open a new instance of the process.
brainvisa.toolboxes¶
-
class
brainvisa.toolboxes.
Toolbox
(name, toolboxDirectory, icon=None, description=None)[source]¶ Bases:
object
@type name: string @ivar name: toolbox name. It can be the name given in the constructor, or the userName specified in the toolbox .py file. @type id: string @ivar id: identifier for the toolbox. @type processTree: ProcessTree @ivar processTree: content of the toolbox
@type name: string @param name: toolbox name. @type toolboxDirectory: string @param toolboxDirectory: main directory for this toolbox. @type description: string @param description: short text describing the toolbox. It’s optional, it can be set in init file. It will be printed in a tooltip.
-
links
()[source]¶ Gets the links between this toolbox and other toolboxes reading the minf file of the toolbox (if there is one). Must be called only after having loaded all toolboxes to be sure that all referenced processes are loaded. @rtype: list of ProcessTree @return : links to other toolboxes. each process tree represents another toolbox and contains part of current toolbox that must be added in the other toolbox.
-
-
brainvisa.toolboxes.
allToolboxes
()[source]¶ @rtype: iterator of Toolbox @return: all loaded toolboxes.
brainvisa.workflow¶
brainvisa.validation¶
-
exception
brainvisa.validation.
ValidationError
[source]¶ Bases:
exceptions.RuntimeError
This class inherits from
RuntimeError
and defines an exception that will be raised by processes validation functions.
brainvisa.history¶
-
class
brainvisa.history.
HistoryBook
(directory=None, database=None, dirBvsession=None, compression=False)[source]¶ Bases:
object
An L{HistoryBook} contains some L{HistoricalEvent}.
-
class
brainvisa.history.
ProcessExecutionEvent
(uuid=None, content={})[source]¶ Bases:
brainvisa.history.HistoricalEvent
This object enables to store the state of a
Process
instance in a dictionary format.
brainvisa.multipleExecfile¶
This module defines the class MultipleExecfile
that is used to read Brainvisa ontology files.
-
class
brainvisa.multipleExecfile.
MultipleExecfile
(localDict=None, globalDict=None)[source]¶ Bases:
object
This object enables to execute several python files that can have dependencies between us. One file can include another to indicate that it needs something defined in this other file.
Attributes: -
fileExtensions
¶ list of string indicating the possible file extensions for the files that can be executed via this object.
-
includePath
¶ Set of paths where the files to execute are searched.
-
globalDict
¶ Global dictionary that will be used to execute the files.
-
localDict
¶ Local dictionary that will be used to execute the files.
Methods: -
execute
(*args, **kwargs)[source]¶ Executes the files listed in args if they are found in the
includePath
passingglobalDict
andlocalDict
as global and local namespaces.kwargs may contain a parameter continue_on_error. If it is True, the execution won’t be stopped by the first exception, the exceptions will be stored in a list and returned at the end of the method.
Returns: The list of exception that occured during files execution.
-
findFile
(localFileName)[source]¶ Finds the file in
includePath
trying to append thefileExtensions
to its name.Parameters: localFileName (string) – name of the searched file, possibly wihtout extension, relative to the include path. Return type: string Returns: absolute path to the found file, else None.
-
brainvisa.registration¶
-
class
brainvisa.registration.
DatabasesTransformationManager
[source]¶ Bases:
object
TransformationsManager linked with BrainVISA database system.
-
copyReferential
(sourceDiskItem, destinationDiskItem, copy_transformations=True)[source]¶ Copy the referential of sourceDiskItem to the one of destinationDiskItem. The minf file of destinationDiskItem is saved by this function.
Parameters:
-
createNewReferential
(referential)[source]¶ Creates the file for the referential diskitem and add it to the database and to the transformation manager.
-
createNewReferentialFor
(diskItem, name=None, description=None, dimension_count=3, referentialType=None, simulation=False, output_diskitem=None)[source]¶ Create a new referential for an object stored in a DiskItem and record it in the database. Returns None if the referential has not been created because its location in the database cannot be found with ReadDiskItem( ‘Referential’, ‘Referential’ ).findValue( diskItem ).
-
findOrCreateReferential
(referentialType, diskItem, name=None, description=None, dimension_count=3, simulation=False, assign=False, output_diskitem=None)[source]¶ Search a referential of type referentialType for the data diskitem. if simulation is false, the referential will be created and added to the database and transformation manager. if assign is True, the referential will be assign to the diskitem.
-
findPaths
(source_referential, destination_referential, maxLength=None, bidirectional=False, extensive=True)[source]¶ Return a generator object that iterate over all the transformation paths going from source_referential to destination_referential. A transformation path is a list of transformation objects. The paths are returned in increasing length order. If maxlength is set to a non null positive value, it limits the size of the paths returned. Source and destination referentials can be given either as string uuid or as referential object.
If extensive is False, not all paths will be searched, and a faster algorithm will be used which may stop when at least one matching path is found. But ambiguous paths will not necessarily be detected.
-
findReferentialNeighbours
(ref, bidirectional=True, flat_output=False)[source]¶ From one referential, find all referentials directly linked by transforms and return a tuple (referentials, paths), where paths is a dictionary which contains a list of transforms that leads to each referential (key of the dictionary) from the source_referential (a transform is a triplet (uuid_transform, uuid_from, uuid_to))
If flat_output is True, the output is a list of tuples (transform, source, dest).
-
referential
(diskItemOrId)[source]¶ Return the referential object corresponding to the given diskItem or uuid. Return None if the diskItem has no referential or the referential is not in the manager.
-