
It seems that the code in the Segger module for calculating the center of a region breaks when the region contain a large number of points. I don't have the error message on hand, but it complains about calling _contour.affine_transform_vertices with a double, rather than a float. It seems that in regions.py the summed coordinate is cast to a float32, then divided by the number of points, which can cause an implicit cast up to float64's when point_count is large! Here's a simple patch to share/Segger/regions.py that re-orders the calls to cast after division, rather than before: --- old/share/Segger/regions.py 2012-03-19 13:45:34.000000000 -0700 +++ new/share/Segger/regions.py 2012-07-09 14:55:26.241372503 -0700 @@ -873,7 +873,7 @@ plists = [r.points() for r in self.childless_regions()] s = numpy.sum([numpy.sum(plist, axis=0) for plist in plists], axis=0) - com = s.astype(numpy.float32) / self.point_count() + com = (s / self.point_count()).astype(numpy.float32) if transform: tf = self.segmentation.point_transform() import _contour -- Nader Morshed <morshed.nader@berkeley.edu>