tools.phantom

Contents

tools.phantom#

bartorch.tools.phantom()#

Analytical phantom, as an image or as its k-space.

Parameters:
  • shape (int or tuple of int, default=None) – Spatial size (-x). The phantom is square or cubic: a tuple repeats one size, and three entries select the three-dimensional phantom. BART’s default is 128.

  • kspace (bool, default=False) – Return the analytical k-space rather than the image (-k).

  • coils (int, default=None) – Number of simulated coils (-s); adds a leading coil axis.

  • traj (torch.Tensor, default=None) – Trajectory (..., samples, 3) in grid units to sample the k-space along (-t) rather than a grid; implies kspace.

  • geometry ({'circle', 'brain', 'nist', 'sonar', 'tubes', 'bart'}, default=None) – Phantom geometry, each one of BART’s flags; BART’s default is the Shepp-Logan phantom.

  • rotation_angle (float, int, default=None) – Rotation angle in degrees (--rotation-angle), and the number of frames rotated by it, for "nist", "sonar" and "tubes" (--rotation-steps).

  • rotation_steps (float, int, default=None) – Rotation angle in degrees (--rotation-angle), and the number of frames rotated by it, for "nist", "sonar" and "tubes" (--rotation-steps).

  • **extra – Further BART phantom options, by name.

Returns:

(coils, z, y, x) with coils, otherwise (y, x) or (z, y, x), with leading axes for frames; with traj, the samples as bartorch.nufft() returns them.

Return type:

torch.Tensor

Raises:

ValueError – If shape has unequal sizes or geometry is unknown.

Examples

>>> image = phantom(128)
>>> kspace = phantom(128, coils=8, kspace=True)