# ############################################################################## pySAP - Copyright (C) CEA, 2017 - 2018 ## Distributed under the terms of the CeCILL-B license, ## as published by the CEA-CNRS-INRIA. Refer to the LICENSE file or to ## http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html for details. ## #############################################################################"""Classes for defining gradient operators."""# Internal importfrom.baseimportGradBaseMRIfrom..fourier.utilsimportcheck_if_fourier_op_uses_sense# Third party importimportnumpyasnp
[docs]classGradAnalysis(GradBaseMRI):r"""Gradient class for analysis formulation. This class defines the grad operators for: .. math:: \frac{1}{2} \sum_l ||F x - y_l||^2_2 Parameters ---------- fourier_op: mri.operators.OperatorBase A Fourier operator such as FFT, NonCartesianFFT or Stacked3DNFFT, corresponding to `F` in the above equation. verbose: int, default=0 Verbose levels for debug prints. The default value is 0. """def__init__(self,fourier_op,verbose=0,**kwargs):iffourier_op.n_coils!=1andnotcheck_if_fourier_op_uses_sense(fourier_op):data_shape=(fourier_op.n_coils,*fourier_op.shape)else:data_shape=fourier_op.shapesuper(GradAnalysis,self).__init__(operator=fourier_op.op,trans_operator=fourier_op.adj_op,shape=data_shape,verbose=verbose,**kwargs,)self.fourier_op=fourier_op
[docs]classGradSynthesis(GradBaseMRI):r"""Gradient class for synthesis formulation. This class defines the grad operators for: .. math:: \frac{1}{2} \sum_l ||F \Psi_t x - y_l||^2_2 Parameters ---------- fourier_op: mri.operators.OperatorBase A Fourier operator such as FFT, NonCartesianFFT or Stacked3DNFFT, corresponding to `F` in the above equation. linear_op: mri.operators.OperatorBase A linear operator such as WaveltN or WaveletUD2, corresponding to :math:`\Psi` in above equation. verbose: int, default=0 Verbose levels for debug prints. The default value is 0. """def__init__(self,fourier_op,linear_op,verbose=0,**kwargs):self.fourier_op=fourier_opself.linear_op=linear_opcoef=linear_op.op(np.squeeze(np.zeros((linear_op.n_coils,*fourier_op.shape))))self.linear_op_coeffs_shape=coef.shapesuper(GradSynthesis,self).__init__(self._op_method,self._trans_op_method,self.linear_op_coeffs_shape,verbose=verbose,**kwargs,)
[docs]classGradSelfCalibrationAnalysis(GradBaseMRI):r"""Gradient class for analysis formulation based on sensitivity profile. This class defines the grad operators for: .. math:: \frac{1}{2} \sum_l ||F S_l x - y_l||^2_2 Parameters ---------- fourier_op: mri.operators.OperatorBase A Fourier operator such as FFT, NonCartesianFFT or Stacked3DNFFT, corresponding to `F` in the above equation. Smaps: numpy.ndarray The coil sensitivity profile of shape (L, *data.shape), composed of :math:`S_l` in above equation. verbose: int, default=0 Verbose levels for debug prints. The default value is 0. """def__init__(self,fourier_op,Smaps,verbose=0,**kwargs):self.Smaps=Smapsself.fourier_op=fourier_opsuper(GradSelfCalibrationAnalysis,self).__init__(self._op_method,self._trans_op_method,fourier_op.shape,verbose=verbose,**kwargs,)
[docs]classGradSelfCalibrationSynthesis(GradBaseMRI):r"""Gradient class for synthesis formulation based on sensitivity profile. This class defines the grad operators for: .. math:: \frac{1}{2} \sum_l ||F S_l \Psi_t x - y_l||^2_2 Parameters ---------- fourier_op: mri.operators.OperatorBase A Fourier operator such as FFT, NonCartesianFFT or Stacked3DNFFT, corresponding to `F` in the above equation. linear_op: mri.operators.OperatorBase A linear operator such as WaveltN or WaveletUD2, corresponding to :math:`\Psi` in above equation. Smaps: numpy.ndarray The coil sensitivity profile of shape (L, *data.shape), composed of :math:`S_l` in above equation. verbose: int, default=0 Verbose levels for debug prints. The default value is 0. """def__init__(self,fourier_op,linear_op,Smaps,verbose=0,**kwargs):self.Smaps=Smapsself.fourier_op=fourier_opself.linear_op=linear_opcoef=linear_op.op(np.zeros(fourier_op.shape))self.linear_op_coeffs_shape=coef.shapesuper(GradSelfCalibrationSynthesis,self).__init__(self._op_method,self._trans_op_method,self.linear_op_coeffs_shape,verbose=verbose,**kwargs,)