BrainVisa tools modules

brainvisa.tools.aimsGlobals

This module provides a few functions using pyaims (soma.aims module), and defines several lists of formats (neuroDiskItems.NamedFormatList):

brainvisa.tools.aimsGlobals.anatomistVolumeFormats

The name of the list is Anatomist volume formats and it contains the volume formats which are handled by Anatomist.

brainvisa.tools.aimsGlobals.aimsVolumeFormats
brainvisa.tools.aimsGlobals.vipVolumeFormats

The name of the list is Aims readable volume formats and it contains the volume formats which can be read with Aims.

brainvisa.tools.aimsGlobals.aimsWriteVolumeFormats

The name of the list is Aims writable volume formats and it contains the volume formats which can be written with Aims.

brainvisa.tools.aimsGlobals.aimsImageFormats

The name of the list is Aims image formats and it contains the 2D image formats which are readable with Aims.

brainvisa.tools.aimsGlobals.anatomistMeshFormats

The name of the list is Anatomist mesh formats and it contains the mesh formats which are handled by Anatomist.

brainvisa.tools.aimsGlobals.aimsMeshFormats

The name of the list is Aims mesh formats and it contains the mesh formats which are handled by Aims.

brainvisa.tools.aimsGlobals.aimsTextureFormats

The name of the list is Aims texture formats and it contains the texture formats which are handled by Aims.

brainvisa.tools.aimsGlobals.anatomistTextureFormats

The name of the list is Anatomist texture formats and it contains the texture formats which are handled by Anatomist.

brainvisa.tools.aimsGlobals.html_pdf_formats

Formats list for HTML format, and PDF if the wkhtmltopdf tool is installed on the system and available in the PATH.

These global variables are initialized through the function initializeFormatLists().

brainvisa.tools.aimsGlobals.aimsVolumeAttributes(item, writeOnly=0, forceFormat=0)[source]

Gets the header attributes of a DiskItem if the item is a readable volume.

Parameters
  • item – the diskitem

  • writeonly – if True, the function just returns an empty dictionary

  • forceFormat – if True, the format of the diskitem is not checked

Returns

a dictionary containing the attributes of the header.

brainvisa.tools.aimsGlobals.aims_to_bv_formats(formats)[source]

Translates formats (single string or list) from AIMS formats names into BrainVISA’s

brainvisa.tools.aimsGlobals.initializeFormatLists()[source]

Initializes several lists of formats. The lists are stored in global variables.

brainvisa.tools.aimsGlobals.reordered_formats(formats, priority_list=['gz compressed NIFTI-1 image', 'NIFTI-1 image', 'GIS Image', 'MINC image', 'gz compressed MINC image', 'SPM image', 'Z Compressed GIS Image', 'gz Compressed GIS Image', 'ECAT v image', 'ECAT i image', 'FreesurferMGZ', 'FreesurferMGH', 'Z compressed VIDA Image', 'gz compressed VIDA Image', 'Z compressed SPM image', 'gz compressed SPM image', 'Z compressed ECAT v image', 'gz compressed ECAT v image', 'Z compressed ECAT i image', 'gz compressed ECAT i image', 'JPEG image', 'GIF image', 'PNG image', 'MNG image', 'BMP image', 'PBM image', 'PGM image', 'PPM image', 'XBM image', 'XPM image', 'TIFF image', 'TIFF(.tif) image', 'DICOM image', 'Directory', 'FDF image', 'VIDA Image', 'GIFTI file', 'MESH mesh', 'TRI mesh', 'Z compressed MESH mesh', 'gz compressed MESH mesh', 'Z compressed TRI mesh', 'gz compressed TRI mesh', 'PLY mesh', 'Z compressed PLY mesh', 'gz compressed PLY mesh', 'Z compressed GIFTI file', 'gz compressed GIFTI file', 'MNI OBJ mesh', 'Z compressed MNI OBJ mesh', 'gz compressed MNI OBJ mesh', 'Texture', 'Z compressed Texture', 'gz compressed texture', 'Z compressed GIFTI file', 'gz compressed GIFTI file'])[source]

Reorder brainvisa formats according to a priority list: set formats from the priority list first (in their order) when they are part of the formats list, then append the remaining ones (in their order also)

brainvisa.tools.aimsGlobals.zipped_bv_formats(formats)[source]

Translates formats (single string or list) from AIMS formats names into BrainVISA’s, and adds gz/Z compressed versions

brainvisa.tools.mainthreadlife

Deprecated module, it has been moved to soma.qt_gui.qtThread: please use soma.qt_gui.qtThread.MainThreadLife now.

brainvisa.tools.matlabValidation

brainvisa.tools.spm_conversion

brainvisa.tools.spm_registration

brainvisa.tools.spm_results

brainvisa.tools.spm_run

exception brainvisa.tools.spm_run.Spm8Standalone_error[source]

Bases: RuntimeError

exception brainvisa.tools.spm_run.Spm8_error[source]

Bases: RuntimeError

exception brainvisa.tools.spm_run.SpmConfigError[source]

Bases: RuntimeError

brainvisa.tools.spm_run.run(context, configuration, jobPath, cmd=None, useMatlabFirst=False, isMatlabMandatory=False)[source]

Run a SPM job using SPM8 standalone or SMP8 Matlab version, trying them alternatively, with a specifiable priority

brainvisa.tools.spm_segmentation

brainvisa.tools.spm_utils

brainvisa.tools.spm_utils.merge_mat_files(mergedMatFile, *matFiles)[source]

Create a .m file from a set of .m files

:param string mergedMatFile

The .m file containing the merge result

:param set *matFiles

The .m files to merge

Returns

True if the merge succeeds and False otherwise

brainvisa.tools.DisplayResultsFromSPM

brainvisa.tools.displayTitledGrid

class brainvisa.tools.displayTitledGrid.DisplayTitledGrid(objPathMatrix, parent=None, mainColormap='B-W LINEAR', overlayColormap='RAINBOW', customOverlayColormap='Blue-White')[source]

Bases: PyQt5.QtWidgets.QWidget

brainvisa.tools.displayTitledGrid.displayTitledGrid(transformationManager, parent, inverseRawColumn, objPathMatrix, rowTitles=['raw_space', 'MRI_native_space', 'mask', 'MNI_space'], rowColors=['darkOrange', 'blue', 'MRI', 'blue', 'magenta'], colTitles=['PET', 'MRI', 'grey'], windowTitle='View grid', linkWindows='space', overlaidImages=[], mainColormap='B-W LINEAR', overlayColormap='RAINBOW', customOverlayColormap='Blue-White', rowButtonSubTitles=None)[source]

Grid of Anatomist views

Parameters: linkWindows: str

possible values : ‘all’ | none | row

rowColors: list

default: [‘darkOrange’, ‘blue’, “MRI”, ‘blue’, ‘magenta’] orange = rawSpace, blue = mri space, magenta = mni space