From c4caf8b7b8d7c16418ea02db62313c165d8b6774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Sat, 17 Aug 2013 18:04:07 +0200 Subject: [PATCH] Sort functions in alphabetical order --- skimage/measure/_regionprops.py | 82 ++++++++++++++++----------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/skimage/measure/_regionprops.py b/skimage/measure/_regionprops.py index 35952b48..acf251af 100644 --- a/skimage/measure/_regionprops.py +++ b/skimage/measure/_regionprops.py @@ -127,11 +127,6 @@ class _RegionProperties(object): row, col = self.local_centroid return row + self._slice[0].start, col + self._slice[1].start - @_cached_property - def moments_central(self): - row, col = self.local_centroid - return _moments.moments_central(self._image_double, row, col, 3) - @_cached_property def convex_area(self): return np.sum(self.convex_image) @@ -176,10 +171,6 @@ class _RegionProperties(object): def filled_image(self): return ndimage.binary_fill_holes(self.image, STREL_8) - @_cached_property - def moments_hu(self): - return _moments.moments_hu(self.moments_normalized) - @_cached_property def image(self): return self._label_image[self._slice] == self.label @@ -214,10 +205,6 @@ class _RegionProperties(object): def _intensity_image_double(self): return self.intensity_image.astype(np.double) - @_cached_property - def moments(self): - return _moments.moments(self._image_double, 3) - @_cached_property def local_centroid(self): m = self.moments @@ -247,6 +234,19 @@ class _RegionProperties(object): _, l2 = self.inertia_tensor_eigvals return 4 * sqrt(l2) + @_cached_property + def moments(self): + return _moments.moments(self._image_double, 3) + + @_cached_property + def moments_central(self): + row, col = self.local_centroid + return _moments.moments_central(self._image_double, row, col, 3) + + @_cached_property + def moments_hu(self): + return _moments.moments_hu(self.moments_normalized) + @_cached_property def moments_normalized(self): return _moments.moments_normalized(self.moments_central, 3) @@ -271,12 +271,6 @@ class _RegionProperties(object): def solidity(self): return self.moments[0, 0] / np.sum(self.convex_image) - @_cached_property - def weighted_central_moments(self): - row, col = self.weighted_local_centroid - return _moments.moments_central(self._intensity_image_double, - row, col, 3) - @_cached_property def weighted_centroid(self): row, col = self.weighted_local_centroid @@ -289,14 +283,20 @@ class _RegionProperties(object): col = m[1, 0] / m[0, 0] return row, col - @_cached_property - def weighted_moments_hu(self): - return _moments.moments_hu(self.weighted_moments_normalized) - @_cached_property def weighted_moments(self): return _moments.moments_central(self._intensity_image_double, 0, 0, 3) + @_cached_property + def weighted_central_moments(self): + row, col = self.weighted_local_centroid + return _moments.moments_central(self._intensity_image_double, + row, col, 3) + + @_cached_property + def weighted_moments_hu(self): + return _moments.moments_hu(self.weighted_moments_normalized) + @_cached_property def weighted_moments_normalized(self): return _moments.moments_normalized(self.weighted_central_moments, 3) @@ -347,13 +347,6 @@ def regionprops(label_image, properties=None, Number of pixels of region. **bbox** : tuple Bounding box `(min_row, min_col, max_row, max_col)` - **moments_central** : (3, 3) ndarray - Central moments (translation invariant) up to 3rd order:: - - mu_ji = sum{ array(x, y) * (x - x_c)^j * (y - y_c)^i } - - where the sum is over the `x`, `y` coordinates of the region, - and `x_c` and `y_c` are the coordinates of the region's centroid. **centroid** : array Centroid coordinate tuple `(row, col)`. **convex_area** : int @@ -379,8 +372,6 @@ def regionprops(label_image, properties=None, **filled_image** : (H, J) ndarray Binary region image with filled holes which has the same size as bounding box. - **moments_hu** : tuple - Hu moments (translation, scale and rotation invariant). **image** : (H, J) ndarray Sliced binary region image which has the same size as bounding box. **inertia_tensor** : (2, 2) ndarray @@ -407,6 +398,15 @@ def regionprops(label_image, properties=None, m_ji = sum{ array(x, y) * x^j * y^i } where the sum is over the `x`, `y` coordinates of the region. + **moments_central** : (3, 3) ndarray + Central moments (translation invariant) up to 3rd order:: + + mu_ji = sum{ array(x, y) * (x - x_c)^j * (y - y_c)^i } + + where the sum is over the `x`, `y` coordinates of the region, + and `x_c` and `y_c` are the coordinates of the region's centroid. + **moments_hu** : tuple + Hu moments (translation, scale and rotation invariant). **moments_normalized** : (3, 3) ndarray Normalized moments (translation and scale invariant) up to 3rd order:: @@ -422,6 +422,15 @@ def regionprops(label_image, properties=None, through the centers of border pixels using a 4-connectivity. **solidity** : float Ratio of pixels in the region to pixels of the convex hull image. + **weighted_centroid** : array + Centroid coordinate tuple `(row, col)` weighted with intensity + image. + **weighted_moments** : (3, 3) ndarray + Spatial moments of intensity image up to 3rd order:: + + wm_ji = sum{ array(x, y) * x^j * y^i } + + where the sum is over the `x`, `y` coordinates of the region. **weighted_central_moments** : (3, 3) ndarray Central moments (translation invariant) of intensity image up to 3rd order:: @@ -430,18 +439,9 @@ def regionprops(label_image, properties=None, where the sum is over the `x`, `y` coordinates of the region, and `x_c` and `y_c` are the coordinates of the region's centroid. - **weighted_centroid** : array - Centroid coordinate tuple `(row, col)` weighted with intensity - image. **weighted_moments_hu** : tuple Hu moments (translation, scale and rotation invariant) of intensity image. - **weighted_moments** : (3, 3) ndarray - Spatial moments of intensity image up to 3rd order:: - - wm_ji = sum{ array(x, y) * x^j * y^i } - - where the sum is over the `x`, `y` coordinates of the region. **weighted_moments_normalized** : (3, 3) ndarray Normalized moments (translation and scale invariant) of intensity image up to 3rd order::