I'm trying to use raster geometry to make a sphere-shaped mask (found in How to generate a sphere in 3D Numpy array made by user @norok2). Code is as following:
import raster_geometry as rg
import numpy as np
sphere_mask = rg.sphere((224, 224, 160), 15,(112,112,80)) #rg.sphere takes(shape,radius,midpoint)
sphere_mask = sphere_mask.astype(np.int_)
print(np.sum(sphere_mask))
When I print the sum of the sphere mask, it gives 0 so no sphere was created. Modifying the code to not include the midpoint however works fine:
import raster_geometry as rg
import numpy as np
sphere_mask = rg.sphere((224, 224, 160), 15) #rg.sphere takes(shape,radius,midpoint)
sphere_mask = sphere_mask.astype(np.int_)
print(np.sum(sphere_mask))
I've adapted the midpoint to be contained well within the shape of the image. I'm not sure what's going wrong here?