5050kspace_data = kspace_data_gpu .get () # convert back to numpy array for display
5151adjoint = nufft .adj_op (kspace_data_gpu ).get () # adjoint NUFFT
5252
53+ # %%
54+ # Pseudo-inverse solver
55+ # =====================
56+ # The least-square solution to the inverse problem can be obtained by solving
57+ # the following optimization problem:
58+ #
59+ # .. math::
60+ # \min_x \|Ax - b\|_2^2
61+ #
62+ # where :math:`A` is the NUFFT operator, :math:`x` is the image to be
63+ # reconstructed, and :math:`b` is the k-space data. The optimization problem can
64+ # be solved using different iterative solvers, such as Conjugate Gradient (CG),
65+ # LSQR and LSMR. The solvers are implemented in the :meth:`mrinufft.pinv_solver`
66+ # method, which takes as input the k-space data, the maximum number of
67+ # iterations, and the optimization method to use.
68+
69+ # %%
70+ # Callback monitoring
71+ # -------------------
72+ # We can monitor the convergence of the optimization by using a callback function
73+ # that is called at each iteration of the optimization. The callback function can
74+ # compute different metrics, such as the residual norm, the PSNR, or the time taken
75+
5376
5477def mixed_cb (* args , ** kwargs ):
5578 """A compound callback function, to track iterations time and convergence."""
@@ -76,7 +99,9 @@ def process_cb_results(cb_results):
7699 return {"time" : time_it , "res" : r , "AHres" : rH , "psnr" : psnrs }
77100
78101
79- # Run the least-square minimization for all the solvers:
102+ # %%
103+ # Run the least-square minimization for all the solvers
104+ # -----------------------------------------------------
80105
81106OPTIM = ["cg" , "lsqr" , "lsmr" ]
82107METRICS = {
@@ -167,8 +192,10 @@ def process_cb_results(cb_results):
167192# This is done by solving the following optimization problem:
168193#
169194# .. math::
195+
170196# \min_x \|Ax - b\|_2^2 + \gamma \|x\|_2^2
171- # where :math:`\gamma` is the regularization parameter.
197+
198+ # where :math:`\gamma` is the regularization parameter.
172199
173200
174201images = dict ()
0 commit comments