UKB-Atlas#
- class ukb.atlas.Points(ED, ES)[source]#
- ED: ndarray#
Alias for field number 0
- ES: ndarray#
Alias for field number 1
- ukb.atlas.compute_S(hdf: AtlasFile | File, mode: int = -1, std: float = 1.5) ndarray [source]#
Compute the shape matrix S from the PCA atlas.
- Parameters:
hdf (h5py.File) – HDF5 file containing the PCA atlas.
mode (int, optional) – Mode to generate points from. If -1, generate points from the mean shape. If between 0 and the number of modes, generate points from the specified mode. By default -1
std (float, optional) – Standard deviation to scale the mode by, by default 1.5
- Returns:
Shape matrix S.
- Return type:
np.ndarray
- ukb.atlas.download_atlas(outdir: Path, all: bool = True) Path [source]#
Download the UK Biobank atlas from the Cardiac Atlas Project.
- Parameters:
outdir (Path) – Directory to download the atlas to.
all (bool, optional) – If true, download the PCA atlas derived from all 4,329 subjects from the UK Biobank Study. If false, downlaod PCA atlas derived from 630 healthy reference subjects from the UK Biobank Study (see [1]) by default False
- Returns:
Path to the downloaded file.
- Return type:
Path
References
- ukb.atlas.generate_points(filename: Path, mode: int = -1, std: float = 1.5) Points [source]#
Generate points from the UK Biobank atlas.
- Parameters:
filename (Path) – Path to the UK Biobank atlas file.
mode (int, optional) – Mode to generate points from. If -1, generate points from the mean shape. If between 0 and the number of modes, generate points from the specified mode. By default -1
std (float, optional) – Standard deviation to scale the mode by, by default 1.5
- Returns:
Named tuple containing the end-diastolic (ED) and end-systolic (ES) points.
- Return type:
- ukb.atlas.generate_points_burns(filename: Path, mode: int = -1, std: float = 1.5) Points [source]#
Generate points from the Burns atlas.
- Parameters:
filename (Path) – Path to the Burns atlas file.
mode (int, optional) – Mode to generate points from. If -1, generate points from the mean shape. If between 0 and the number of modes, generate points from the specified mode. By default -1
std (float, optional) – Standard deviation to scale the mode by, by default 1.5
- Returns:
Named tuple containing the end-diastolic (ED) and end-systolic (ES) points.
- Return type:
- class ukb.surface.Surface(name, vertex_range, face_range)[source]#
- face_range: list[tuple[int, int]]#
Alias for field number 2
- name: str#
Alias for field number 0
- vertex_range: list[tuple[int, int]]#
Alias for field number 1
- ukb.surface.main(folder: Path, all: bool = False, mode: int = -1, std: float = 1.5, verbose: bool = False, cache_dir: Path = PosixPath('/github/home/.ukb'), case: Literal['ED', 'ES', 'both'] = 'ED', use_burns: bool = False, burns_path: Path | None = None) None [source]#
Main function to generate surfas from the UK Biobank atlas.
- Parameters:
folder (Path) – Directory to save the generated points.
all (bool) – If true, download the PCA atlas derived from all 4,329 subjects from the UK Biobank Study. If false, downlaod PCA atlas derived from 630 healthy reference subjects from the UK Biobank Study (see [1]) by default False
mode (int) – Mode to generate points from. If -1, generate points from the mean shape. If between 0 and the number of modes, generate points from the specified mode. By default -1
std (float) – Standard deviation to scale the mode by, by default 1.5
verbose (bool) – If true, print verbose output.
cache_dir (Path) – Directory to save the downloaded atlas.
case (str) – Case to generate surfaces for.
use_burns (bool) – If true, use the atlas from Richard Burns to generate the surfaces. This will override the all parameter and use the burns atlas instead.
burns_path (Path | None) – Path to the burns atlas file. This will be a .mat file which will be loaded using scipy.io.loadmat. This needs to be specified if use_burns
- ukb.mesh.add_parser_arguments(parser: ArgumentParser) None [source]#
Add parser arguments for mesh generation.
- Parameters:
parser (ArgumentParser) – The argument parser to add arguments to.
- ukb.mesh.create_clipped_mesh(folder: Path, case: Literal['ED', 'ES', 'both'] = 'ED', char_length_max: float = 5.0, char_length_min: float = 5.0, verbose: bool = False) None [source]#
Create a gmsh mesh file from the surface mesh representation.
- Parameters:
folder (Path) – Path to the output folde
name (str) – Case name
char_length_max (float) – Maximum characteristic length of the mesh elements
char_length_min (float) – Minimum characteristic length of the mesh elements
verbose (bool, optional) – Print verbose output, by default False
- ukb.mesh.create_mesh_geo(folder: Path, char_length_max: float, char_length_min: float, case: Literal['ED', 'ES', 'both'] = 'ED') None [source]#
Convert a vtp file to a gmsh mesh file using the surface mesh representation. The surface mesh is coarsened using the gmsh algorithm.
- Parameters:
vtp (Path) – Path to the vtp file
output (Path) – Path to the output folder
- ukb.mesh.main(folder: Path, case: Literal['ED', 'ES', 'both'] = 'ED', char_length_max: float = 5.0, char_length_min: float = 5.0, verbose: bool = False, clipped: bool = False) None [source]#
Create a gmsh mesh file from the surface mesh representation.
- Parameters:
folder (Path) – Path to the output folder
case (str) – Case name, by default “ED”
char_length_max (float) – Maximum characteristic length of the mesh elements, by default 5.0
char_length_min (float) – Minimum characteristic length of the mesh elements, by default 5.0
verbose (bool, optional) – Print verbose output, by default False
clipped (bool, optional) – Create a clipped mesh, by default False