snake.core.phantom.static#

Module to create phantom for simulation.

Module Contents#

Classes#

PropTissueEnum

Enum for the tissue properties.

TissueFile

Enum for the tissue properties file.

Phantom

A Phantom consist of a list of tissue mask and parameters for those tissues.

Functions#

serialize_array

Serialize the array for mrd compatible format.

unserialize_array

Unserialize the array for mrd compatible format.

Data#

log

T

API#

snake.core.phantom.static.log = 'getLogger(...)'[source]#
class snake.core.phantom.static.PropTissueEnum[source]#

Bases: enum.IntEnum

Enum for the tissue properties.

Initialization

Initialize self. See help(type(self)) for accurate signature.

T1 = 0#
T2 = 1#
T2s = 2#
rho = 3#
chi = 4#
class snake.core.phantom.static.TissueFile[source]#

Bases: str, snake._meta.NoCaseEnum

Enum for the tissue properties file.

Initialization

Initialize self. See help(type(self)) for accurate signature.

tissue_1T5 = 'str(...)'#
tissue_7T = 'str(...)'#
class snake.core.phantom.static.Phantom[source]#

A Phantom consist of a list of tissue mask and parameters for those tissues.

name: str = None#
masks: numpy.typing.NDArray[numpy.float32] = None#
labels: numpy.typing.NDArray[numpy.string_] = None#
props: numpy.typing.NDArray[numpy.float32] = None#
smaps: numpy.typing.NDArray[numpy.complex64] | None = None#
add_tissue(tissue_name: str, mask: numpy.typing.NDArray[numpy.float32], props: numpy.typing.NDArray[numpy.float32], phantom_name: str | None = None) snake.core.phantom.static.Phantom[source]#

Add a tissue to the phantom. Creates a new Phantom object.

property labels_idx: dict[str, int]#

Get the index of the labels.

make_smaps(n_coils: int = None, sim_conf: snake.core.simulation.SimConfig = None, antenna: str = 'birdcage') None[source]#

Get coil sensitivity maps for the phantom.

classmethod from_brainweb(sub_id: int, sim_conf: snake.core.simulation.SimConfig, tissue_file: str | snake.core.phantom.static.TissueFile = TissueFile.tissue_1T5, tissue_select: list[str] | None = None, tissue_ignore: list[str] | None = None) snake.core.phantom.static.Phantom[source]#

Get the Brainweb Phantom.

abstract classmethod from_shepp_logan(resolution: tuple[int]) snake.core.phantom.static.Phantom[source]#

Get the Shepp-Logan Phantom.

abstract classmethod from_guerin_kern(resolution: tuple[int]) snake.core.phantom.static.Phantom[source]#

Get the Guerin-Kern Phantom.

classmethod from_mrd_dataset(dataset: ismrmrd.Dataset | os.PathLike, imnum: int = 0) snake.core.phantom.static.Phantom[source]#

Load the phantom from a mrd dataset.

to_mrd_dataset(dataset: ismrmrd.Dataset, sim_conf: snake.core.simulation.SimConfig, imnum: int = 0) ismrmrd.Dataset[source]#

Add the phantom as an image to the dataset.

classmethod from_shared_memory(name: str, mask_prop: snake.core.parallel.ArrayProps, properties_prop: snake.core.parallel.ArrayProps, label_prop: snake.core.parallel.ArrayProps, smaps_prop: snake.core.parallel.ArrayProps) collections.abc.Generator[snake.core.phantom.static.Phantom, None, None][source]#

Give access the tissue masks and properties in shared memory.

in_shared_memory(manager: multiprocessing.managers.SharedMemoryManager) tuple[tuple[str, snake.core.parallel.ArrayProps, snake.core.parallel.ArrayProps, snake.core.parallel.ArrayProps, snake.core.parallel.ArrayProps | None], tuple[multiprocessing.shared_memory.SharedMemory, multiprocessing.shared_memory.SharedMemory, multiprocessing.shared_memory.SharedMemory, multiprocessing.shared_memory.SharedMemory | None]][source]#

Add a copy of the phantom in shared memory.

property anat_shape: tuple[int, ...]#

Get the shape of the base volume.

property n_tissues: int#

Get the number of tissues.

__repr__()[source]#
__deepcopy__(memo: Any) snake.core.phantom.static.Phantom[source]#

Create a copy of the phantom.

copy() snake.core.phantom.static.Phantom[source]#

Return deep copy of the Phantom.

snake.core.phantom.static.T = 'TypeVar(...)'#
snake.core.phantom.static.serialize_array(arr: numpy.typing.NDArray) str[source]#

Serialize the array for mrd compatible format.

snake.core.phantom.static.unserialize_array(s: str) numpy.typing.NDArray[source]#

Unserialize the array for mrd compatible format.