public static unsafe float CalculateCoverage( [NotNull] float* data, int length, float threshold )
{
if ( data == null )
throw new ArgumentNullException( "data" );
int coveredVoxels = 0;
float* end = data + length;
while ( data < end ) {
if ( *data < threshold )
coveredVoxels++;
data++;
}
return coveredVoxels / ( float )length;
}