Closed JWBisschop closed 3 months ago
Thank you for highlighting the issues. You are right, the loop should break after the if condition. I have also corrected the distance calculation and the indexing accordingly.
Thank you very much for the quick update. All works now :)
Shouldn't the code break from the loop in the following line? Also I think it should be k spheres, not k-1 (iterator starts from 0, not from 1 like in Matlab).
if radius < rMin: print(f"The mimimum radius rMin={rMin} has been met using {k - 1} spheres")
Also as noted in the Matlab version, comparing should be done with the radii in the correct units: % Note: rMin is given in Cartesian units, not in voxel units, hence the % multiplication with the voxel size below if radius*voxel_size(:)<rMin % Break the loop if the minimum radius has been met using less than N spheres warning(['The mimimum radius rMin=',num2str(rMin),' has been met using ', num2str(k-1),' spheres']) break end