Sisyphe.core.sisypheConstants

External packages/modules

Sisyphe.core.sisypheConstants.addPrefixSuffixToFilename(filename: str, prefix: str, suffix: str, sep: str = '_') str

Add prefix and suffix to a file name.

Parameters

filenamestr

filename to be prefixed and suffixed

prefixstr

prefix to add

suffixstr

suffix to add

sepstr

separator between prefix/suffix and file name (default ‘_’)

Returns

str

file name with prefix and suffix

Sisyphe.core.sisypheConstants.addPrefixToFilename(filename: str, prefix: str, sep: str = '_') str

Add a prefix to a file name.

Parameters

filenamestr

filename to be prefixed

prefixstr

prefix to add

sepstr

separator between prefix and file name (default ‘_’)

Returns

str

file name with prefix

Sisyphe.core.sisypheConstants.addSuffixToFilename(filename: str, suffix: str, sep: str = '_') str

Add a suffix to a file name.

Parameters

filenamestr

filename to be suffixed

suffixstr

suffix to add

sepstr

separator between file name and suffix (default ‘_’)

Returns

str

file name with suffix

Sisyphe.core.sisypheConstants.getATROPOSPath() str

Get Atropos template path.

Returns

str

PySisyphe Atropos template path

Sisyphe.core.sisypheConstants.getBitmapExt() list[str]

Get list of bitmap image file extensions.

Returns

list[str]

[‘.bmp’, ‘.jpg’, ‘.jpeg’,’.png’,’.pbm’,’.pgm’, ‘.ppm’, ‘.xpm’,’.svg’]

Sisyphe.core.sisypheConstants.getBrainVoyagerVMRExt() list[str]

Get list of BrainVoyager image file extension.

Returns

list[str]

[‘.vmr’]

Sisyphe.core.sisypheConstants.getBrainVoyagerVOIExt() list[str]

Get list of BrainVoyager ROI file extension.

Returns

list[str]

[‘.voi’]

Sisyphe.core.sisypheConstants.getDISTALPath() str

Get Distal template path.

Returns

str

PySisyphe Distal template path

Sisyphe.core.sisypheConstants.getDatatypes() list[str]

Get list of numpy datatypes in str format.

Returns

list[str]

[‘uint8’, ‘int8’, ‘uint16’, ‘int16’, ‘uint32’, ‘int32’, ‘uint64’, ‘int64’, ‘float32’, ‘float64’]

Sisyphe.core.sisypheConstants.getDicomExt() list[str]

Get list of DICOM file extensions.

Returns

list[str]

[‘.dcm’, ‘.dicom’, ‘.ima’, ‘.nema’]

Sisyphe.core.sisypheConstants.getFloatStdDatatypes() list[str]

Get list of numpy float datatypes in str format.

Returns

list[str]

[‘float32’, ‘float64’]

Sisyphe.core.sisypheConstants.getFreeSurferExt() list[str]

Get list of FreeSurfer volume file extension.

Returns

list[str]

[‘.mgh’, ‘.mgz’]

Sisyphe.core.sisypheConstants.getICBM152Path() str

Get ICBM152 template path.

Returns

str

PySisyphe ICBM152 template path

Sisyphe.core.sisypheConstants.getICBM452Path() str

Get ICBM452 template path.

Returns

str

PySisyphe ICBM452 template path

Sisyphe.core.sisypheConstants.getID_ATROPOS() str

Get ATROPOS template ID used by PySisyphe.

Returns

str

ATROPOS template ID

Sisyphe.core.sisypheConstants.getID_DISTAL() str

Get DISTAL template ID used by PySisyphe.

Returns

str

DISTAL template ID

Sisyphe.core.sisypheConstants.getID_ICBM152() str

Get ICBM152 template ID used by PySisyphe.

Returns

str

ICBM152 template ID

Sisyphe.core.sisypheConstants.getID_ICBM452() str

Get ICBM452 template ID used by PySisyphe.

Returns

str

ICBM452 template ID

Sisyphe.core.sisypheConstants.getID_NAC() str

Get NAC template ID used by PySisyphe.

Returns

str

NAC template ID

Sisyphe.core.sisypheConstants.getID_SPL() str

Get SPL template ID used by PySisyphe.

Returns

str

SPL template ID

Sisyphe.core.sisypheConstants.getID_SRI24() str

Get SRI24 template ID used by PySisyphe.

Returns

str

SRI24 template ID

Sisyphe.core.sisypheConstants.getImageExt() list[str]

Get list of image file extensions supported by PySisyphe.

Returns

list[str]

list of image file extensions

Sisyphe.core.sisypheConstants.getIntStdDatatypes() list[str]

Get list of numpy int datatypes in str format.

Returns

list[str]

[‘uint8’, ‘int8’, ‘uint16’, ‘int16’, ‘uint32’, ‘int32’, ‘uint64’, ‘int64’]

Sisyphe.core.sisypheConstants.getJsonExt() list[str]

Get list of JSON file extension.

Returns

list[str]

[‘.json’]

Sisyphe.core.sisypheConstants.getLibraryDataType(datatype: str = 'uint8', lib: str | int = 2) str | int | None

Get native library datatype from numpy datatype in str format.

Parameters

datatypestr

numpy datatype in str format (default ‘uint8’)

libstr | int
  • library name (i.e. ‘ants’, ‘itk’, ‘sitk’, ‘vtk’)

  • library code (i.e. ants=0, itk=1, sitk=2, vtk=3)

Returns

str | int

native library datatype

Sisyphe.core.sisypheConstants.getLutExt() list[str]

Get list of look-up table (LUT colormap) file extensions supported by PySisyphe.

Returns

list[str]

[‘.lut’, ‘.xlut’]

Sisyphe.core.sisypheConstants.getMincExt() list[str]

Get list of Minc file extension.

Returns

list[str]

[‘.mnc’]

Sisyphe.core.sisypheConstants.getNACPath() str

Get NAC template path.

Returns

str

PySisyphe NAC template path

Sisyphe.core.sisypheConstants.getNiftiCompressedExt() list[str]

Get list of nifti compressed file extensions.

Returns

list[str]

[‘.nii.gz’, ‘.img.gz’]

Sisyphe.core.sisypheConstants.getNiftiExt() list[str]

Get list of nifti file extensions.

Returns

list[str]

[‘.nii’, ‘.hdr’, ‘.img’, ‘.nia’, ‘.nii.gz’, ‘.img.gz’]

Sisyphe.core.sisypheConstants.getNrrdExt() list[str]

Get list of Nrrd file extensions.

Returns

list[str]

[‘.nrrd’, ‘.nhdr’]

Sisyphe.core.sisypheConstants.getNumpyExt() list[str]

Get list of Numpy file extension.

Returns

list[str]

[‘.npy’]

Sisyphe.core.sisypheConstants.getOrigin_ICBM152() list[float]

Get origin (i.e. world coordinates in mm) of ICBM152 templates.

Returns

list[float, float, float]

ICBM152 templates origin

Sisyphe.core.sisypheConstants.getRegularDirections() list[float]

Get default direction vectors of SisypheVolume image axes in RAS+ coordinates system.

PySisyphe uses RAS+ world coordinates system convention (as MNI, Nibabel, Dipy…) with origin to corner of the voxel:

  • x, direction [1.0, 0.0, 0.0]: left(-) to right(+)

  • y, direction [0.0, 1.0, 0.0]: posterior(-) to anterior(+)

  • z, direction [0.0, 0.0, 1.0]: inferior(-) to superior(+)

Directions is a list of 9 float, 3 vectors of 3 floats:

  • First vector, x-axis image direction, [1.0, 0.0, 0.0]

  • Second vector, y-axis image direction, [0.0, 1.0, 0.0]

  • Third vector, z-axis image direction, [0.0, 0.0, 1.0]

Returns

list[float]

default direction vectors

Sisyphe.core.sisypheConstants.getSPLPath() str

Get SPL template path.

Returns

str

PySisyphe SPL template path

Sisyphe.core.sisypheConstants.getSRI24Path() str

Get SRI24 template path.

Returns

str

PySisyphe SRI24 template path

Sisyphe.core.sisypheConstants.getShape_ICBM152() list[int]

Get shape (i.e. number of voxels in x, y and z axes) of ICBM152 templates.

Returns

list[int, int, int]

ICBM152 templates shape

Sisyphe.core.sisypheConstants.getSisypheDirections() list[float]

Get direction vectors of old Sisyphe image axes in RAS+ coordinates system.

PySisyphe uses RAS+ world coordinates system convention (as MNI, Nibabel, Dipy…) with origin to corner of the voxel:

  • x, direction [1.0, 0.0, 0.0]: left(-) to right(+)

  • y, direction [0.0, 1.0, 0.0]: posterior(-) to anterior(+)

  • z, direction [0.0, 0.0, 1.0]: inferior(-) to superior(+)

Directions is a list of 9 float, 3 vectors of 3 floats:

  • First vector, x-axis image direction, [1.0, 0.0, 0.0]

  • Second vector, y-axis image direction, [0.0, 1.0, 0.0]

  • Third vector, z-axis image direction, [0.0, 0.0, -1.0]

Returns

list[float]

Sisyphe direction vectors

Sisyphe.core.sisypheConstants.getSisypheExt() list[str]

Get list of Sisyphe image file extension.

Returns

list[str]

[‘.vol’]

Sisyphe.core.sisypheConstants.getSisypheROIExt() list[str]

Get list of Sisyphe ROI file extension.

Returns

list[str]

[‘.roi’]

Sisyphe.core.sisypheConstants.getSupportedITKDatatypes() list[itkCType]

Get supported itk datatypes (wrapped in itk python package).

Returns

list[itk.itkCType]

list of native itk datatype codes

Sisyphe.core.sisypheConstants.getSupportedITKStdDatatypes() list[str]

Get supported itk datatypes (wrapped in itk python package) in numpy str format.

Returns

list[str]

list of datatypes in numpy str format (i.e. ‘uint8’, ‘uint16’, ‘int16’, ‘uint64’, ‘float32’, ‘float64’)

Sisyphe.core.sisypheConstants.getTemplatePath() str

Get template path.

Returns

str

PySisyphe template path

Sisyphe.core.sisypheConstants.getTemplatesID() list[str]

Get list of template ID used by PySisyphe.

Returns

list[str]

list of template ID

Sisyphe.core.sisypheConstants.getTractsExt() list[str]

Get list of tractogram file extensions supported by PySisyphe.

Returns

list[str]

list of tractogram file extensions

Sisyphe.core.sisypheConstants.getVTKDirections() list[float]

Get direction vectors of VTK image axes in RAS+ coordinates system.

PySisyphe uses RAS+ world coordinates system convention (as MNI, Nibabel, Dipy…) with origin to corner of the voxel:

  • x, direction [1.0, 0.0, 0.0]: left(-) to right(+)

  • y, direction [0.0, 1.0, 0.0]: posterior(-) to anterior(+)

  • z, direction [0.0, 0.0, 1.0]: inferior(-) to superior(+)

Directions is a list of 9 float, 3 vectors of 3 floats:

  • First vector, x-axis image direction, [-1.0, 0.0, 0.0]

  • Second vector, y-axis image direction, [0.0, -1.0, 0.0]

  • Third vector, z-axis image direction, [0.0, 0.0, 1.0]

Returns

list[float]

VTK direction vectors

Sisyphe.core.sisypheConstants.getVtkExt() list[str]

Get list of VTK file extensions.

Returns

list[str]

[‘.vtk’, ‘.vti’]

Sisyphe.core.sisypheConstants.isATROPOS(ID: str) bool

Check whether ID parameter is an ATROPOS template ID.

Parameters

IDstr

ID to test

Returns

bool

True if ATROPOS template ID

Sisyphe.core.sisypheConstants.isDISTAL(ID: str) bool

Check whether ID parameter is a DISTAL template ID.

Parameters

IDstr

ID to test

Returns

bool

True if DISTAL template ID

Sisyphe.core.sisypheConstants.isICBM152(ID: str) bool

Check whether ID parameter is an ICBM152 template ID.

Parameters

IDstr

ID to test

Returns

bool

True if ICBM152 template ID

Sisyphe.core.sisypheConstants.isICBM452(ID: str) bool

Check whether ID parameter is an ICBM452 template ID.

Parameters

IDstr

ID to test

Returns

bool

True if ICBM452 template ID

Sisyphe.core.sisypheConstants.isITKImageSupportedType(itkimage: <itkTemplate itk::Image>) bool

Checks whether itk image datatype is supported.

Parameters

itkimageitk.Image

itk image instance

Returns

bool

True if itk image datatype is supported (i.e. ‘uint8’, ‘uint16’, ‘int16’, ‘uint64’, ‘float32’, ‘float64’)

Sisyphe.core.sisypheConstants.isITKSupportedStdType(datatype: str) bool

Checks whether the parameter, in numpy str format, is a supported itk datatype (wrapped in python itk package).

Parameters

datatypestr

numpy datatype in str format

Returns

bool

True if parameter is a supported itk datatype (i.e. ‘uint8’, ‘uint16’, ‘int16’, ‘uint64’, ‘float32’, ‘float64’)

Sisyphe.core.sisypheConstants.isITKSupportedType(itkdatatype: itkCType) bool

Checks whether the parameter is a supported itk datatype (wrapped in itk python package).

Parameters

itkdatatypeitk.itkCType

native itk datatype code

Returns

bool

True if parameter is a supported itk datatype

Sisyphe.core.sisypheConstants.isNAC(ID: str) bool

Check whether ID parameter is a NAC template ID.

Parameters

IDstr

ID to test

Returns

bool

True if NAC template ID

Sisyphe.core.sisypheConstants.isSPL(ID: str) bool

Check whether ID parameter is an SPL template ID.

Parameters

IDstr

ID to test

Returns

bool

True if SPL template ID

Sisyphe.core.sisypheConstants.isSRI24(ID: str) bool

Check whether ID parameter is an SRI24 template ID.

Parameters

IDstr

ID to test

Returns

bool

True if SRI24 template ID

Sisyphe.core.sisypheConstants.isTemplateID(ID: str) bool

Check whether ID parameter is a valid template ID used by PySisyphe.

Parameters

IDstr

ID to test

Returns

bool

True if template ID

Sisyphe.core.sisypheConstants.isUint8ITKImage(itkimage: <itkTemplate itk::Image>) bool

Checks whether itk image datatype is ‘uint8’ (wrapped in itk python package).

Parameters

itkimageitk.Image

itk image instance

Returns

bool

True if itk image datatype is ‘unit8’

Sisyphe.core.sisypheConstants.isValidDatatype(datatype: str) bool

Checks whether the str parameter is a valid numpy datatype.

Parameters

datatypestr

numpy datatype in str format

Returns

bool

True if datatype parameter is a valid numpy datatype

Sisyphe.core.sisypheConstants.isValidLibraryName(libname) bool

Checks whether the str parameter is a valid library name.

Parameters

libnamestr

library name (‘ants’, ‘itk’, ‘sitk’, ‘vtk’)

Returns

bool

True if parameter is a valid library name (i.e. ‘ants’, ‘itk’, ‘sitk’, ‘vtk’)

Sisyphe.core.sisypheConstants.listToStr(l: list) str

List to str conversion. Each item of the list is converted to str and concatenated in a new str with a space char as separator.

Parameters

llist

list elements must be convertible to str

Returns

str

converted list

Sisyphe.core.sisypheConstants.removeAllPrefixesFromFilename(filename: str, sep: str = '_') str

Remove all prefixes from a file name.

Parameters

filenamestr

file name with prefix to be removed

sepstr

char between prefix(es) (default ‘_’)

Returns

str

file name without prefix

Sisyphe.core.sisypheConstants.removeAllSuffixesFromFilename(filename: str, sep: str = '_') str

Remove all suffixes from a file name.

Parameters

filenamestr

file name with suffix to be removed

sepstr

char between prefix(es) (default ‘_’)

Returns

str

file name without suffix

Sisyphe.core.sisypheConstants.removeSuffixNumberFromFilename(filename: str, sep: str = '_') str

Remove a suffix number (if any) from a file name.

Parameters

filenamestr

file name with suffix to be removed

sepstr

char between prefix(es) (default ‘_’)

Returns

str

file name without suffix number

Sisyphe.core.sisypheConstants.replaceDirname(filename: str, newdir: str) str

Replace the dirname of a file name.

Parameters

filenamestr

path that dirname will be replaced

newdirstr

new dirname

Returns

str

new file name