I am trying to compute the volume (or surface area) of a 3D numpy array. The voxels are anisotropic in a lot of cases, and I have the pixel to cm conversion factor in each direction.
Does anyone know a good place to find a toolkit or package to do the above??
Right now, I have some in-house code, but I am looking to upgrade to something more industrial strength in terms of accuracy.
Edit1: Here is some (poor) sample data. This is much smaller than the typical sphere. I will add better data when I can generate it! It is in (self.)tumorBrain.tumor.
One option is to use
VTK. (I’m going to use thetvtkpython bindings for it here…)At least in some circumstances, getting the area within the isosurface will be a bit more accurate.
Also, as far as surface area goes,
tvtk.MassPropertiescalculates surface area as well. It’smass.surface_area(with themassobject in the code below).This yields: