toblerone.pvestimation package

Submodules

toblerone.pvestimation.estimators module

toblerone.pvestimation.estimators.stack_images(images)[source]

Combine the results of estimate_complete() into overall PV maps for each tissue. Note that the below logic is entirely specific to the surfaces produced by FreeSurfer, FIRST and how they may be combined with FAST estimates. If you’re going off-piste anywhere else then you probably DON’T want to re-use this logic.

Parameters:
  • maps (dictionary of PV) – all FIRST subcortical

  • follows (keyed as) – all FIRST subcortical

  • convention (structures named by their FIST) –

  • cortex_GM/WM/non_brain (named as FAST_CSF/WM/GM; cortex estimates as) –

Returns:

single 4D array of PVs, arranged GM/WM/non-brain in the 4th dim

Module contents

PV estimation functions

toblerone.pvestimation.cortex(ref, struct2ref, *args, **kwargs)[source]

Estimate PVs for L/R cortex. To estimate for a single hemisphere, provide only surfaces for that side.

Parameters:
  • ref (str/regtricks ImageSpace) – voxel grid in which to estimate PVs.

  • struct2ref (str/np.array/rt.Registration) – registration between space of surface and reference [see -flirt and -stuct], use ‘I’ for identity.

  • fsdir (str) – path to a FreeSurfer subject directory.

  • LWS/LPS/RWS/RPS (str) – individual paths to the surfaces, eg LWS = Left White surface, RPS = Right Pial surace.

  • flirt (bool) – denoting struct2ref is FLIRT transform; if so, set struct.

  • struct (str) – path to structural image from which surfaces were derived.

  • cores (int) – number of cores to use, default 8.

  • supersample (int/array) – single or 3 values, supersampling factor.

Returns:

(np.array) PVs arranged GM/WM/non-brain in 4th dim.

toblerone.pvestimation.structure(ref, struct2ref, *args, **kwargs)[source]

Estimate PVs for a structure defined by a single surface.

Parameters:
  • ref (str/regtricks ImageSpace) – voxel grid in which to estimate PVs.

  • struct2ref (str/np.array/rt.Registration) – registration between space of surface and reference (see -flirt and -stuct). Use ‘I’ for identity.

  • surf (str/Surface) – path to surface (see coords argument below)

  • flirt (bool) – denoting struct2ref is FLIRT transform; if so, set struct.

  • coords (str) – convention by which surface is defined: default is ‘world’ (mm coords), for FIRST surfaces set as ‘fsl’ and provide struct argument

  • struct (str) – path to structural image from which surfaces were derived

  • cores (int) – number of cores to use, default 8

  • supersample (int/array) – single or 3 values, supersampling factor

Returns:

(np.array) PV image, sized equal to reference space

toblerone.pvestimation.complete(ref, struct2ref, *args, **kwargs)[source]

Estimate PVs for cortex and all structures identified by FIRST within a reference image space. Use FAST to fill in non-surface PVs.

Parameters:
  • ref (str/regtricks.ImageSpace) – voxel grid in which to estimate PVs.

  • struct2ref (str/np.array/regtricks.Registration) – registration between space of surface and reference (see -flirt and -stuct). Use ‘I’ for identity.

  • fslanat – path to fslanat directory. This REPLACES firstdir/fastdir/struct.

  • firstdir (str) – FIRST directory in which .vtk surfaces are located

  • fastdir (str) – FAST directory in which _pve_0/1/2 are located

  • struct (str) – path to structural image from which FIRST surfaces were dervied

  • fsdir (str) – FreeSurfer subject directory, OR:

  • LWS/LPS/RWS/RPS (str) – paths to individual surfaces (L/R white/pial)

  • flirt (bool) – denoting struct2ref is FLIRT transform; if so, set struct.

  • coords (str) – convention by which surface is defined: default is ‘world’ (mm coords), for FIRST surfaces set as ‘fsl’ and provide struct argument

  • struct – path to structural image from which surfaces were derived

  • cores (int) – number of cores to use, default 8

  • supersample (int/array) – single or 3 values, supersampling factor

Returns:

(dict) keyed for each structure and also flattened (‘stacked’)