This now uses a for loop with an iteration counter up to a maximum number of iterations, which is declared as a named constant. The loop is ended early if the scans stop changing, which indicates convergence. This ensures that the reconstruction will not run forever even in the presence of NaNs or some other reason why it wouldn't converged.
Note that we do not current signal to the caller that the reconstruction has not converged. A value could be returned from this function to indicate whether it has converged, but it is unclear to me what the caller (namely fillsinks) should do with that information.
This now uses a for loop with an iteration counter up to a maximum number of iterations, which is declared as a named constant. The loop is ended early if the scans stop changing, which indicates convergence. This ensures that the reconstruction will not run forever even in the presence of NaNs or some other reason why it wouldn't converged.
Note that we do not current signal to the caller that the reconstruction has not converged. A value could be returned from this function to indicate whether it has converged, but it is unclear to me what the caller (namely
fillsinks
) should do with that information.