Transforms¶
Module holding the classes for different FFT operators.

class
pyqmri.transforms.
PyOpenCL3DRadialNUFFT
(ctx, queue, par, kwidth=5, klength=200, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, streamed=False)¶ Nonuniform FFT object.
This class performs the 3D nonuniform FFT (NUFFT) operation. Linear interpolation of a sampled gridding kernel is used to regrid points from the noncartesian grid back on the cartesian grid.
Parameters:  ctx (PyOpenCL.Context) – The context for the PyOpenCL computations.
 queue (PyOpenCL.Queue) – The computation Queue for the PyOpenCL kernels.
 par (dict) – A python dict containing the necessary information to setup the object. Needs to contain the number of slices (NSlice), number of scans (NScan), image dimensions (dimX, dimY), number of coils (NC), sampling points (N) and read outs (NProj) a PyOpenCL queue (queue) and the complex coil sensitivities (C).
 kwidth (int) – The width of the sampling kernel for regridding of nonuniform kspace samples.
 klength (int) – The length of the kernel lookup table which samples the contineous gridding kernel.
 DTYPE (Numpy.dtype) – The comlex precision type. Currently complex64 is used.
 DTYPE_real (Numpy.dtype) – The real precision type. Currently float32 is used.

traj
¶ The comlex sampling trajectory
Type: PyOpenCL.Array

dcf
¶ The densitiy compenation function
Type: PyOpenCL.Array

ogf
(float)¶ The overgriddingfactor for noncartesian kspaces.

fft_shape
¶ 3 dimensional tuple. Dim 0 containts all Scans, Coils and Slices. Dim 1 and 2 the overgridded image dimensions.
Type: tuple of ints

fft_scale
¶ The scaling factor to achieve a good adjointness of the forward and backward FFT.
Type: float32

cl_kerneltable
(PyOpenCL.Buffer)¶ The gridding lookup table as read only Buffer

cl_deapo
(PyOpenCL.Buffer)¶ The deapodization lookup table as read only Buffer

par_fft
¶ The number of parallel fft calls. Typically it iterates over the Scans.
Type: int

fft
¶ The fft object created from gpyfft (A wrapper for clFFT). The object is created only once an reused in each iterations, iterationg over all scans to keep the memory footprint low.
Type: gpyfft.fft.FFT

prg
¶ The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator. This will be determined by the factory and set after the object is created.
Type: PyOpenCL.Program

FFT
(s, sg, wait_for=None, scan_offset=0)¶ Perform the forward NUFFT operation.
Parameters:  s (PyOpenCL.Array) – The nonuniformly gridded kspace.
 sg (PyOpenCL.Array) – The complex image data.
 wait_for (list of PyopenCL.Event, None) – A List of PyOpenCL events to wait for.
 scan_offset (int, 0) – Offset compared to the first acquired scan.
Returns: PyOpenCL.Event
Return type: A PyOpenCL event to wait for.

FFTH
(sg, s, wait_for=None, scan_offset=0)¶ Perform the inverse (adjoint) NUFFT operation.
Parameters:  sg (PyOpenCL.Array) – The complex image data.
 s (PyOpenCL.Array) – The nonuniformly gridded kspace
 wait_for (list of PyopenCL.Event, None) – A List of PyOpenCL events to wait for.
 scan_offset (int, 0) – Offset compared to the first acquired scan.
Returns: PyOpenCL.Event
Return type: A PyOpenCL event to wait for.

class
pyqmri.transforms.
PyOpenCLCartNUFFT
(ctx, queue, par, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, streamed=False)¶ Cartesian FFT object.
This class performs the FFT operation.
Parameters:  ctx (PyOpenCL.Context) – The context for the PyOpenCL computations.
 queue (PyOpenCL.Queue) – The computation Queue for the PyOpenCL kernels.
 par (dict A python dict containing the necessary information to) – setup the object. Needs to contain the number of slices (NSlice), number of scans (NScan), image dimensions (dimX, dimY), number of coils (NC), sampling points (N) and read outs (NProj) a PyOpenCL queue (queue) and the complex coil sensitivities (C).
 DTYPE (Numpy.dtype) – The comlex precision type. Currently complex64 is used.
 DTYPE_real (Numpy.dtype) – The real precision type. Currently float32 is used.

fft_shape
¶ 3 dimensional tuple. Dim 0 containts all Scans, Coils and Slices. Dim 1 and 2 the overgridded image dimensions.
Type: tuple of ints

fft_scale
¶ The scaling factor to achieve a good adjointness of the forward and backward FFT.
Type: float32

par_fft
¶ The number of parallel fft calls. Typically it iterates over the Scans.
Type: int

fft
¶ The fft object created from gpyfft (A wrapper for clFFT). The object is created only once an reused in each iterations, iterationg over all scans to keep the memory footprint low.
Type: gpyfft.fft.FFT

mask
¶ The undersampling mask for the Cartesian grid.
Type: PyOpenCL.Array

prg
¶ The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator. This will be determined by the factory and set after the object is created.
Type: PyOpenCL.Program

FFT
(s, sg, wait_for=None, scan_offset=0)¶ Perform the forward FFT operation.
Parameters:  s (PyOpenCL.Array) – The uniformly gridded kspace.
 sg (PyOpenCL.Array) – The complex image data.
 wait_for (list of PyopenCL.Event, None) – A List of PyOpenCL events to wait for.
 scan_offset (int, 0) – Offset compared to the first acquired scan.
Returns: PyOpenCL.Event
Return type: A PyOpenCL event to wait for.

FFTH
(sg, s, wait_for=None, scan_offset=0)¶ Perform the inverse (adjoint) FFT operation.
Parameters:  sg (PyOpenCL.Array) – The complex image data.
 s (PyOpenCL.Array) – The uniformly gridded kspace
 wait_for (list of PyopenCL.Event, None) – A List of PyOpenCL events to wait for.
 scan_offset (int, 0) – Offset compared to the first acquired scan.
Returns: PyOpenCL.Event
Return type: A PyOpenCL event to wait for.

class
pyqmri.transforms.
PyOpenCLRadialNUFFT
(ctx, queue, par, kwidth=5, klength=200, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, streamed=False)¶ Nonuniform FFT object.
This class performs the nonuniform FFT (NUFFT) operation. Linear interpolation of a sampled gridding kernel is used to regrid points from the noncartesian grid back on the cartesian grid.
Parameters:  ctx (PyOpenCL.Context) – The context for the PyOpenCL computations.
 queue (PyOpenCL.Queue) – The computation Queue for the PyOpenCL kernels.
 par (dict) – A python dict containing the necessary information to setup the object. Needs to contain the number of slices (NSlice), number of scans (NScan), image dimensions (dimX, dimY), number of coils (NC), sampling points (N) and read outs (NProj) a PyOpenCL queue (queue) and the complex coil sensitivities (C).
 kwidth (int) – The width of the sampling kernel for regridding of nonuniform kspace samples.
 klength (int) – The length of the kernel lookup table which samples the contineous gridding kernel.
 DTYPE (Numpy.dtype) – The comlex precision type. Currently complex64 is used.
 DTYPE_real (Numpy.dtype) – The real precision type. Currently float32 is used.

traj
¶ The comlex sampling trajectory
Type: PyOpenCL.Array

dcf
¶ The densitiy compenation function
Type: PyOpenCL.Array

ogf
(float)¶ The overgriddingfactor for noncartesian kspaces.

fft_shape
¶ 3 dimensional tuple. Dim 0 containts all Scans, Coils and Slices. Dim 1 and 2 the overgridded image dimensions.
Type: tuple of ints

fft_scale
¶ The scaling factor to achieve a good adjointness of the forward and backward FFT.
Type: float32

cl_kerneltable
(PyOpenCL.Buffer)¶ The gridding lookup table as read only Buffer

cl_deapo
(PyOpenCL.Buffer)¶ The deapodization lookup table as read only Buffer

par_fft
¶ The number of parallel fft calls. Typically it iterates over the Scans.
Type: int

fft
¶ The fft object created from gpyfft (A wrapper for clFFT). The object is created only once an reused in each iterations, iterationg over all scans to keep the memory footprint low.
Type: gpyfft.fft.FFT

prg
¶ The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator. This will be determined by the factory and set after the object is created.
Type: PyOpenCL.Program

FFT
(s, sg, wait_for=None, scan_offset=0)¶ Perform the forward NUFFT operation.
Parameters:  s (PyOpenCL.Array) – The nonuniformly gridded kspace.
 sg (PyOpenCL.Array) – The complex image data.
 wait_for (list of PyopenCL.Event, None) – A List of PyOpenCL events to wait for.
 scan_offset (int, 0) – Offset compared to the first acquired scan.
Returns: PyOpenCL.Event
Return type: A PyOpenCL event to wait for.

FFTH
(sg, s, wait_for=None, scan_offset=0)¶ Perform the inverse (adjoint) NUFFT operation.
Parameters:  sg (PyOpenCL.Array) – The complex image data.
 s (PyOpenCL.Array) – The nonuniformly gridded kspace
 wait_for (list of PyopenCL.Event, None) – A List of PyOpenCL events to wait for.
 scan_offset (int, 0) – Offset compared to the first acquired scan.
Returns: PyOpenCL.Event
Return type: A PyOpenCL event to wait for.

class
pyqmri.transforms.
PyOpenCLSMSNUFFT
(ctx, queue, par, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, streamed=False)¶ Cartesian FFTSMS object.
This class performs the FFT operation assuming a SMS acquisition.
Parameters:  ctx (PyOpenCL.Context) – The context for the PyOpenCL computations.
 queue (PyOpenCL.Queue) – The computation Queue for the PyOpenCL kernels.
 par (dict A python dict containing the necessary information to) – setup the object. Needs to contain the number of slices (NSlice), number of scans (NScan), image dimensions (dimX, dimY), number of coils (NC), sampling points (N) and read outs (NProj) a PyOpenCL queue (queue) and the complex coil sensitivities (C).
 DTYPE (Numpy.dtype) – The comlex precision type. Currently complex64 is used.
 DTYPE_real (Numpy.dtype) – The real precision type. Currently float32 is used.

fft_shape
¶ 3 dimensional tuple. Dim 0 containts all Scans, Coils and Slices. Dim 1 and 2 the overgridded image dimensions.
Type: tuple of ints

fft_scale
¶ The scaling factor to achieve a good adjointness of the forward and backward FFT.
Type: float32

par_fft
¶ The number of parallel fft calls. Typically it iterates over the Scans.
Type: int

fft
¶ The fft object created from gpyfft (A wrapper for clFFT). The object is created only once an reused in each iterations, iterationg over all scans to keep the memory footprint low.
Type: gpyfft.fft.FFT

mask
¶ The undersampling mask for the Cartesian grid.
Type: PyOpenCL.Array

packs
¶ The distance between the slices
Type: int

MB
¶ The multiband factor
Type: int

shift
¶ The vector pixel shifts used in the fft computation.
Type: PyOpenCL.Array

prg
¶ The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator. This will be determined by the factory and set after the object is created.
Type: PyOpenCL.Program

FFT
(s, sg, wait_for=None, scan_offset=0)¶ Perform the forward FFT operation.
Parameters:  s (PyOpenCL.Array) – The uniformly gridded kspace compressed by the MB factor.
 sg (PyOpenCL.Array) – The complex image data.
 wait_for (list of PyopenCL.Event, None) – A List of PyOpenCL events to wait for.
 scan_offset (int, 0) – Offset compared to the first acquired scan.
Returns: PyOpenCL.Event
Return type: A PyOpenCL event to wait for.

FFTH
(sg, s, wait_for=None, scan_offset=0)¶ Perform the inverse (adjoint) FFT operation.
Parameters:  sg (PyOpenCL.Array) – The complex image data.
 s (PyOpenCL.Array) – The uniformly gridded kspace compressed by the MB factor.
 wait_for (list of PyopenCL.Event, None) – A List of PyOpenCL events to wait for.
 scan_offset (int, 0) – Offset compared to the first acquired scan.
Returns: PyOpenCL.Event
Return type: A PyOpenCL event to wait for.

class
pyqmri.transforms.
PyOpenCLnuFFT
(ctx, queue, fft_dim, DTYPE, DTYPE_real)¶ Base class for FFT calculation.
This class serves as the base class for all FFT object used in the varous optimization algorithms. It provides a factory method to generate a FFT object based on the input.
Parameters:  ctx (PyOpenCL.Context) – The context for the PyOpenCL computations.
 queue (PyOpenCL.Queue) – The computation Queue for the PyOpenCL kernels.
 fft_dim (tuple of int) – The dimensions to take the fft over
 DTYPE (Numpy.dtype) – The comlex precision type. Currently complex64 is used.
 DTYPE_real (Numpy.dtype) – The real precision type. Currently float32 is used.

DTYPE
¶ The comlex precision type. Currently complex64 is used.
Type: Numpy.dtype

DTYPE_real
¶ The real precision type. Currently float32 is used.
Type: Numpy.dtype

ctx
¶ The context for the PyOpenCL computations.
Type: PyOpenCL.Context

queue
¶ The computation Queue for the PyOpenCL kernels.
Type: PyOpenCL.Queue

prg
¶ The PyOpenCL Program Object containing the compiled kernels.
Type: PyOpenCL.Program

fft_dim
¶ The dimensions to take the fft over
Type: tuple of int

static
create
(ctx, queue, par, kwidth=5, klength=1000, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, radial=False, SMS=False, streamed=False)¶ FFT factory method.
Based on the inputs this method decides which FFT object should be returned.
Parameters:  ctx (PyOpenCL.Context) – The context for the PyOpenCL computations.
 queue (PyOpenCL.Queue) – The computation Queue for the PyOpenCL kernels.
 par (dict) – A python dict containing the necessary information to setup the object. Needs to contain the number of slices (NSlice), number of scans (NScan), image dimensions (dimX, dimY), number of coils (NC), sampling points (N) and read outs (NProj) a PyOpenCL queue (queue) and the complex coil sensitivities (C).
 kwidth (int, 5) – The width of the sampling kernel for regridding of nonuniform kspace samples.
 klength (int, 200) – The length of the kernel lookup table which samples the contineous gridding kernel.
 DTYPE (Numpy.dtype, numpy.complex64) – The comlex precision type. Currently complex64 is used.
 DTYPE_real (Numpy.dtype, numpy.float32) – The real precision type. Currently float32 is used.
 radial (bool, False) – Switch for Cartesian (False) and nonCartesian (True) FFT.
 SMS (bool, False) – Switch between Simultaneous Multi Slice reconstruction (True) and simple slice by slice reconstruction.
 streamed (bool, False) – Switch between normal reconstruction in one big block versus streamed reconstruction of smaller blocks.
Returns: The setup FFT object.
Return type: PyOpenCLnuFFT object
Raises: AssertionError: – If the Combination of passed flags to choose the FFT aren’t compatible with each other. E.g.: Radial and SMS True.