Operators

Module holding the classes for different linear Operators.

class pyqmri.operator.Operator(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>)

Abstract base class for linear Operators used in the optimization.

This class serves as the base class for all linear operators used in the varous optimization algorithms. it requires to implement a forward and backward application in and out of place.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
NScan

Number of total measurements (Scans)

Type:int
NC

Number of complex coils

Type:int
NSlice

Number ofSlices

Type:int
dimX

X dimension of the parameter maps

Type:int
dimY

Y dimension of the parameter maps

Type:int
N

N number of samples per readout

Type:int
Nproj

Number of rreadouts

Type:int
unknowns_TGV

Number of unknowns which should be regularized with TGV. It is assumed that these occure first in the unknown vector. Currently at least 1 TGV unknown is required.

Type:int
unknowns_H1

Number of unknowns which should be regularized with H1. It is assumed that these occure after all TGV unknowns in the unknown vector. Currently this number can be zero which implies that no H1 regularization is used.

Type:int
unknowns

The sum of TGV and H1 unknowns.

Type:int
ctx

The context for the PyOpenCL computations. If streamed operations are used a list of ctx is required. One for each computation device.

Type:list of PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels. If streamed operations are used a list of queues is required. Four for each computation device.

Type:list of PyOpenCL.Queue
dz

The ratio between the physical X,Y dimensions vs the Z dimension. This allows for anisotrpic regularization along the Z dimension.

Type:float
num_dev

Number of compute devices

Type:int
NUFFT

A PyOpenCLnuFFT object to perform forward and backword transformations from image to k-space and vice versa.

Type:PyQMRI.transforms.PyOpenCLnuFFT
prg

The PyOpenCL program containing all compiled kernels.

Type:PyOpenCL.Program
self.DTYPE

Complex working precission. Currently single precission only.

Type:numpy.dtype
self.DTYPE_real

Real working precission. Currently single precission only.

Type:numpy.dtype
static GradientOperatorFactory(par, prg, DTYPE, DTYPE_real, streamed=False, spacetimederivatives='', **kwargs)

Gradient forward/adjoint operator factory method.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
  • streamed (bool, false) – Use standard reconstruction (false) or streaming of memory blocks to the compute device (true). Only use this if data does not fit in one block.
Returns:

A specialized instance of a PyQMRI.Operator to perform forward and ajoint gradient calculations.

Return type:

PyQMRI.Operator

static MRIOperatorFactory(par, prg, DTYPE, DTYPE_real, trafo=False, imagespace=False, SMS=False, streamed=False, imagerecon=False)

MRI forward/adjoint operator factory method.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
  • trafo (bool, false) – Select between radial (True) or cartesian FFT (false).
  • imagespace (bool, false) – Select between fitting in imagespace (True) or k-space (false).
  • SMS (bool, false) – Select between simulatneous multi-slice reconstruction or standard.
  • streamed (bool, false) – Use standard reconstruction (false) or streaming of memory blocks to the compute device (true). Only use this if data does not fit in one block.
Returns:

  • PyQMRI.Operator – A specialized instance of a PyQMRI.Operator to perform forward and ajoint operations for fitting.
  • PyQMRI.NUFFT – An instance of the used (nu-)FFT if k-space fitting is performed, None otherwise.

static SoftSenseOperatorFactory(par, prg, DTYPE, DTYPE_real, streamed=False)

Sense forward/adjoint operator factory method.

static SymGradientOperatorFactory(par, prg, DTYPE, DTYPE_real, streamed=False, spacetimederivatives='', **kwargs)

Symmetrized Gradient forward/adjoint operator factory method.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
  • streamed (bool, false) – Use standard reconstruction (false) or streaming of memory blocks to the compute device (true). Only use this if data does not fit in one block.
Returns:

A specialized instance of a PyQMRI.Operator to perform forward and ajoint symmetriced gradient calculations.

Return type:

PyQMRI.Operator

adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:inp (PyOpenCL.Array) – The complex measurement space which is used as input.
Returns:
  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.
fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex measurement space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
Returns:
  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.
updateRatio(inp)
class pyqmri.operator.OperatorFiniteGradient(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>)

Gradient operator.

This class implements the finite difference gradient operation and the adjoint (negative divergence).

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
ratio

Ratio between the different unknowns

Type:list of PyOpenCL.Array
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

updatePrecondMat(inp)
updateRatio(inp)
class pyqmri.operator.OperatorFiniteGradientStreamed(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>)

Streamed gradient operator.

This class implements the finite difference gradient operation and the adjoint (negative divergence).

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
par_slices

Slices to parallel transfer to the compute device.

Type:int
ratio

Ratio between the different unknowns

Type:list of PyOpenCL.Array
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

getStreamedGradientObject()

Access privat stream gradient object.

Returns:A PyQMRI streaming object for the gradient computation.
Return type:PyqMRI.Streaming.Stream
updatePrecondMat(inp)
updateRatio(inp)
class pyqmri.operator.OperatorFiniteSpaceTimeGradient(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, mu1=1, dt=1, tsweight=1)

Gradient operator.

This class implements the finite difference gradient operation and the adjoint (negative divergence).

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
ratio

Ratio between the different unknowns

Type:list of PyOpenCL.Array
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

computeTimeSpaceWeight(ds, dt, t)
fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

updateRatio(inp)
class pyqmri.operator.OperatorFiniteSpaceTimeSymGradient(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, mu1=1, dt=1, tsweight=1)

Symmetrized gradient operator.

This class implements the finite difference symmetrized gradient operation and the adjoint (negative symmetrized divergence).

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
ratio

Ratio between the different unknowns

Type:list of PyOpenCL.Array
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

computeTimeSpaceWeight(ds, dt, t)
fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

updateRatio(inp)
class pyqmri.operator.OperatorFiniteSymGradient(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>)

Symmetrized gradient operator.

This class implements the finite difference symmetrized gradient operation and the adjoint (negative symmetrized divergence).

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
ratio

Ratio between the different unknowns

Type:list of PyOpenCL.Array
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

class pyqmri.operator.OperatorFiniteSymGradientStreamed(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>)

Streamed symmetrized gradient operator.

This class implements the finite difference symmetrized gradient operation and the adjoint (negative symmetrized divergence).

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
par_slices

Slices to parallel transfer to the compute device.

Type:int
ratio

Ratio between the different unknowns

Type:list of PyOpenCL.Array
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

getStreamedSymGradientObject()

Access privat stream symmetrized gradient object.

Returns:A PyQMRI streaming object for the symmetrized gradient computation.
Return type:PyqMRI.Streaming.Stream
updateRatio(inp)
class pyqmri.operator.OperatorImagespace(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>)

Imagespace based Operator.

This class serves as linear operator between parameter and imagespace.

Use this operator if you want to perform complex parameter fitting from complex image space data without the need of performing FFTs.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjKyk1(out, inp, **kwargs)

Apply the linear operator from image space to parameter space.

This method fully implements the combined linear operator consisting of the data part as well as the TGV regularization part.

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex image space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex measurement space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

class pyqmri.operator.OperatorImagespaceStreamed(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>)

The streamed version of the Imagespace based Operator.

This class serves as linear operator between parameter and imagespace. All calculations are performed in a streamed fashion.

Use this operator if you want to perform complex parameter fitting from complex image space data without the need of performing FFTs. In contrast to non-streaming classes no out of place operations are implemented.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
overlap

Number of slices that overlap between adjacent blocks.

Type:int
par_slices

Number of slices per streamed block

Type:int
fwdstr

The streaming object to perform the forward evaluation

Type:PyQMRI.Stream
adjstr

The streaming object to perform the adjoint evaluation

Type:PyQMRI.Stream
adjstrKyk1

The streaming object to perform the adjoint evaluation including z1 of the algorithm.

Type:PyQMRI.Stream
unknown_shape

Size of the parameter maps

Type:tuple of int
data_shape

Size of the data

Type:tuple of int
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjKyk1(out, inp)

Apply the linear operator from parameter space to image space.

This method fully implements the combined linear operator consisting of the data part as well as the TGV regularization part.

Parameters:
  • out (numpy.Array) – The complex parameter space data which is used as input.
  • inp (numpy.Array) – The complex parameter space data which is used as input.
adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex measurement space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

class pyqmri.operator.OperatorKspace(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, trafo=True)

k-Space based Operator.

This class serves as linear operator between parameter and k-space.

Use this operator if you want to perform complex parameter fitting from complex k-space data. The type of fft is defined through the NUFFT object. The NUFFT object can also be used for simple Cartesian FFTs.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
  • trafo (bool, true) – Switch between cartesian (false) and non-cartesian FFT (True, default).
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
NUFFT

The (nu) FFT used for fitting.

Type:PyQMRI.PyOpenCLnuFFT
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjKyk1(out, inp, **kwargs)

Apply the linear operator from parameter space to k-space.

This method fully implements the combined linear operator consisting of the data part as well as the TGV regularization part.

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex measurement space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

class pyqmri.operator.OperatorKspaceImageRecon(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, trafo=True)

k-Space based Operator for simple image reconstruction.

This class serves as linear operator between iamge and k-space.

Use this operator if you want to perform complex image fitting from complex k-space data. The type of fft is defined through the NUFFT object. The NUFFT object can also be used for simple Cartesian FFTs.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
  • trafo (bool, true) – Switch between cartesian (false) and non-cartesian FFT (True, default).
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
NUFFT

The (nu) FFT used for fitting.

Type:PyQMRI.PyOpenCLnuFFT
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjKyk1(out, inp, **kwargs)

Apply the linear operator from parameter space to k-space.

This method fully implements the combined linear operator consisting of the data part as well as the TGV regularization part.

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex measurement space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

class pyqmri.operator.OperatorKspaceSMS(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>)

k-Space based Operator for SMS reconstruction.

This class serves as linear operator between parameter and k-space. It implements simultaneous-multi-slice (SMS) reconstruction.

Use this operator if you want to perform complex parameter fitting from complex k-space data measured with SMS. Currently only Cartesian FFTs are supported.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
packs

Number of SMS packs.

Type:int
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
NUFFT

The (nu) FFT used for fitting.

Type:PyQMRI.PyOpenCLnuFFT
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjKyk1(out, inp, **kwargs)

Apply the linear operator from parameter space to k-space.

This method fully implements the combined linear operator consisting of the data part as well as the TGV regularization part.

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex measurement space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

class pyqmri.operator.OperatorKspaceSMSStreamed(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>)

The streamed version of the k-space based SMS Operator.

This class serves as linear operator between parameter and k-space. It implements simultaneous-multi-slice (SMS) reconstruction.

All calculations are performed in a streamed fashion.

Use this operator if you want to perform complex parameter fitting from complex k-space data measured with SMS. Currently only Cartesian FFTs are supported.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
overlap

Number of slices that overlap between adjacent blocks.

Type:int
par_slices

Number of slices per streamed block

Type:int
packs

Number of packs to stream

Type:int
fwdstr

The streaming object to perform the forward evaluation

Type:PyQMRI.Stream
adjstr

The streaming object to perform the adjoint evaluation

Type:PyQMRI.Stream
NUFFT

A list of NUFFT objects. One for each context.

Type:list of PyQMRI.transforms.PyOpenCLnuFFT
FTstr

A streamed version of the used (non-uniform) FFT, applied forward.

Type:PyQMRI.Stream
FTHstr

A streamed version of the used (non-uniform) FFT, applied adjoint.

Type:PyQMRI.Stream
updateKyk1SMSstreamed
dat_trans_axes

Order in which the data needs to be transformed during the SMS reconstruction and streaming.

Type:list of int
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array :param out: The complex parameter space data which is used as input. :type out: numpy.Array :param inp: The complex parameter space data which is used as input. :type inp: numpy.Array :param wait_for: A List of PyOpenCL events to wait for. :type wait_for: list of PyopenCL.Event

Returns:The lhs and rhs for the line search of the primal-dual algorithm.
Return type:tupel of floats
adjKyk1(out, inp, **kwargs)

Apply the linear operator from parameter space to k-space.

This method fully implements the combined linear operator consisting of the data part as well as the TGV regularization part.

Parameters:
  • out (numpy.Array) – The complex parameter space data which is used as input.
  • inp (numpy.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

The lhs and rhs for the line search of the primal-dual algorithm.

Return type:

tupel of floats

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex measurement space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

class pyqmri.operator.OperatorKspaceStreamed(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, trafo=True)

The streamed version of the k-space based Operator.

This class serves as linear operator between parameter and k-space. All calculations are performed in a streamed fashion.

Use this operator if you want to perform complex parameter fitting from complex k-space data without the need of performing FFTs. In contrast to non-streaming classes no out of place operations are implemented.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
  • trafo (bool, true) – Switch between cartesian (false) and non-cartesian FFT (True, default).
overlap

Number of slices that overlap between adjacent blocks.

Type:int
par_slices

Number of slices per streamed block.

Type:int
fwdstr

The streaming object to perform the forward evaluation.

Type:PyQMRI.Stream
adjstr

The streaming object to perform the adjoint evaluation.

Type:PyQMRI.Stream
adjstrKyk1

The streaming object to perform the adjoint evaluation including z1 of the algorithm.

Type:PyQMRI.Stream
NUFFT

A list of NUFFT objects. One for each context.

Type:list of PyQMRI.transforms.PyOpenCLnuFFT
FTstr

A streamed version of the used (non-uniform) FFT, applied forward.

Type:PyQMRI.Stream
unknown_shape

Size of the parameter maps

Type:tuple of int
data_shape

Size of the data

Type:tuple of int
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex measurement space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjKyk1(out, inp)

Apply the linear operator from parameter space to k-space.

This method fully implements the combined linear operator consisting of the data part as well as the TGV regularization part.

Parameters:
  • out (numpy.Array) – The complex parameter space data which is used as input.
  • inp (numpy.Array) – The complex parameter space data which is used as input.
adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear operator from measurement space to parameter space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex measurement space which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex measurement space data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear operator from parameter space to measurement space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method need to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

class pyqmri.operator.OperatorSoftSense(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, trafo=False)

Soft-SENSE Operator.

Parameters:
  • 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).
  • prg (PyOpenCL.Program) – The PyOpenCL.Program object containing the necessary kernels to execute the linear Operator.
  • DTYPE (numpy.dtype, numpy.complex64) – Complex working precission.
  • DTYPE_real (numpy.dtype, numpy.float32) – Real working precission.
  • trafo (bool, true) – Switch between cartesian (false) and non-cartesian FFT (True, default).
ctx

The context for the PyOpenCL computations.

Type:PyOpenCL.Context
queue

The computation Queue for the PyOpenCL kernels.

Type:PyOpenCL.Queue
NUFFT

The (nu) FFT used for fitting.

Type:PyQMRI.PyOpenCLnuFFT
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear Soft-SENSE operator from kspace to image space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex image data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex kspace data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

adjKyk1(out, inp, **kwargs)

Apply the linear operator from kspace to image space.

This method fully implements the combined linear operator consisting of the data part as well as the TGV regularization part.

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

PyOpenCL.Event

Return type:

A PyOpenCL event to wait for.

adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear Soft-SENSE operator from kspace to image space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method needs to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex kspace data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear Soft-SENSE operator from image space to kspace If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex image data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex kspace data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear Soft-SENSE operator from image space to kspace If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method needs to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex image data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

class pyqmri.operator.OperatorSoftSenseStreamed(par, prg, DTYPE=<class 'numpy.complex64'>, DTYPE_real=<class 'numpy.float32'>, trafo=False)

The streamed version of the Soft-SENSE Operator

overlap

int Number of slices that overlap between adjacent blocks.

par_slices

int Number of slices per streamed block

fwdstr

PyQMRI.Stream The streaming object to perform the forward evaluation

adjstr

PyQMRI.Stream The streaming object to perform the adjoint evaluation

adjstrKyk1

PyQMRI.Stream The streaming object to perform the adjoint evaluation including z1 of the algorithm.

NUFFT

list of PyQMRI.transforms.PyOpenCLnuFFT A list of NUFFT objects. One for each context.

FTstr

PyQMRI.Stream A streamed version of the used (non-uniform) FFT, applied forward.

unknown_shape

tuple of int Size of the reconstructed images

data_shape

tuple of int Size of the data

FT(outp, inp, par=None, idx=0, idxq=0, bound_cond=0, wait_for=None)
adj(out, inp, **kwargs)

Adjoint operator application in-place.

Apply the linear Soft-SENSE operator from kspace to image space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex image data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex kspace data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

adjKyk1(out, inp)

Apply the linear operator from kspace to image space.

This method fully implements the combined linear operator consisting of the data part as well as the TGV regularization part.

Parameters:
  • out (PyOpenCL.Array) – The complex parameter space data which is used as input.
  • inp (PyOpenCL.Array) – The complex parameter space data which is used as input.
adjoop(inp, **kwargs)

Adjoint operator application out-of-place.

Apply the linear Soft-SENSE operator from kspace to image space If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method needs to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex kspace data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.

fwd(out, inp, **kwargs)

Forward operator application in-place.

Apply the linear Soft-SENSE operator from image space to kspace If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array

Parameters:
  • out (PyOpenCL.Array) – The complex image data which is the result of the computation.
  • inp (PyOpenCL.Array) – The complex kspace data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

A PyOpenCL event to wait for.

Return type:

PyOpenCL.Event

fwdoop(inp, **kwargs)

Forward operator application out-of-place.

Apply the linear Soft-SENSE operator from image space to kspace If streamed operations are used the PyOpenCL.Arrays are replaced by Numpy.Array This method needs to generate a temporary array and will return it as the result.

Parameters:
  • inp (PyOpenCL.Array) – The complex image data which is used as input.
  • wait_for (list of PyopenCL.Event) – A List of PyOpenCL events to wait for.
Returns:

  • PyOpenCL.Array (A PyOpenCL array containing the result of the)
  • computation.