kwneuro.io module

class kwneuro.io.FslBvalResource(path_in)

Bases: BvalResource

A b-value list that is saved to disk in the FSL text file format.

Parameters:

path_in (InitVar)

get()

Get the underlying array of b-values

Return type:

ndarray[tuple[Any, ...], dtype[floating]]

is_loaded: ClassVar[bool] = False

Whether a resource corresponds to in-memory data, rather than for example on-disk data.

load()

Load b-values into memory

Return type:

InMemoryBvalResource

path: Path
path_in: dataclasses.InitVar[pathlib.Path | str]

Path to the underlying bval txt file

static save(bvals, path)

Save data to a path, creating a FslBvalResource.

Parameters:
Return type:

FslBvalResource

class kwneuro.io.FslBvecResource(path_in)

Bases: BvecResource

A b-vector list that is saved to disk in the FSL text file format.

Parameters:

path_in (InitVar)

get()

Get the underlying array of b-vectors of shape (N,3)

Return type:

ndarray[tuple[Any, ...], dtype[floating]]

is_loaded: ClassVar[bool] = False

Whether a resource corresponds to in-memory data, rather than for example on-disk data.

load()

Load b-vectors into memory

Return type:

InMemoryBvecResource

path: Path
path_in: dataclasses.InitVar[pathlib.Path | str]

Path to the underlying bvec txt file

static save(bvecs, path)

Save data to a path, creating a FslBvecResource.

Parameters:
Return type:

FslBvecResource

class kwneuro.io.JsonResponseFunctionResource(path_in)

Bases: ResponseFunctionResource

A response function that is saved to disk in a json file.

Parameters:

path_in (InitVar)

get()

Get the underlying response function

Return type:

tuple[ndarray[tuple[Any, ...], dtype[TypeVar(_ScalarT, bound= generic)]], floating]

get_dipy_object()

Get the underlying response function in a format compatible with Dipy

Return type:

AxSymShResponse

is_loaded: ClassVar[bool] = False

Whether a resource corresponds to in-memory data, rather than for example on-disk data.

load()

Load volume into memory

Return type:

InMemoryResponseFunctionResource

path: Path
path_in: dataclasses.InitVar[pathlib.Path | str]

Path to the underlying json file

static save(response, path)

Save response function data to a path, creating a JsonResponseFunctionResource.

Parameters:
Return type:

JsonResponseFunctionResource

class kwneuro.io.NiftiVolumeResource(path_in)

Bases: VolumeResource

A volume or volume stack that is saved to disk in the nifti file format.

Parameters:

path_in (InitVar)

get_affine()

Get the 4x4 affine matrix that maps index space to patient/scanner space

Return type:

ndarray[tuple[Any, ...], dtype[floating]]

get_array()

Get the underlying volume data array

Return type:

ndarray[tuple[Any, ...], dtype[number]]

get_metadata()

Get the volume image metadata

Return type:

dict[str, Any]

is_loaded: ClassVar[bool] = False

Whether a resource corresponds to in-memory data, rather than for example on-disk data.

load()

Load volume into memory

Return type:

InMemoryVolumeResource

path: Path
path_in: dataclasses.InitVar[pathlib.Path | str]

Path to the underlying volume nifti file

static save(vol, path)

Save volume data to a path, creating a NiftiVolumeResource.

Parameters:
Return type:

NiftiVolumeResource