Skip to content

Commit

Permalink
Merge pull request #237 from friskluft/POL5328_inten_geo_moments
Browse files Browse the repository at this point in the history
POL5328 2D intensity geometric moments
  • Loading branch information
sameeul authored Sep 30, 2024
2 parents f0b3cb7 + f7d199f commit feccfd6
Show file tree
Hide file tree
Showing 23 changed files with 1,984 additions and 951 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ set(SOURCE
src/nyx/features/hexagonality_polygonality.cpp
src/nyx/features/image_matrix.cpp
src/nyx/features/image_matrix_nontriv.cpp
src/nyx/features/image_moments.cpp
src/nyx/features/image_moments_nontriv.cpp
src/nyx/features/2d_geomoments.cpp
src/nyx/features/2d_geomoments_basic.cpp
src/nyx/features/2d_geomoments_basic_nt.cpp
src/nyx/features/intensity.cpp
src/nyx/features/intensity_3d.cpp
src/nyx/features/neighbors.cpp
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ Apart from defining your feature set by explicitly specifying comma-separated fe
| \*all_intensity\* | integrated_intensity, mean, median, min, max, range, standard_deviation, standard_error, uniformity, skewness, kurtosis, hyperskewness, hyperflatness, mean_absolute_deviation, energy, root_mean_squared, entropy, mode, uniformity, p01, p10, p25, p75, p90, p99, interquartile_range, robust_mean_absolute_deviation, mass_displacement
| \*all_morphology\* | area_pixels_count, area_um2, centroid_x, centroid_y, weighted_centroid_y, weighted_centroid_x, compactness, bbox_ymin, bbox_xmin, bbox_height, bbox_width, major_axis_length, minor_axis_length, eccentricity, orientation, num_neighbors, extent, aspect_ratio, equivalent_diameter, convex_hull_area, solidity, perimeter, edge_mean_intensity, edge_stddev_intensity, edge_max_intensity, edge_min_intensity, circularity
| \*basic_morphology\* | area_pixels_count, area_um2, centroid_x, centroid_y, bbox_ymin, bbox_xmin, bbox_height, bbox_width
| \*geomoms\* | shape and intensity geometric moments, equivalent to \*igeomoms\* and \*sgeomoms\* combined
| \*igeomoms\* | intensity raw moments IMOM_RM_pq, central moments IMOM_CM_pq, normalized raw moments IMOM_NRM_pq, normalized central moments IMOM_NCM_pq, Hu invariants IMOM_HUk, weighted raw moments IMOM_WRM_pq, weighted central moments IMOM_WCM_pq, weighted normalized central moments IMOM_WNCM_pq, weighted Hu invariants IMOM_WHUk
| \*sgeomoms\* | shape raw moments SPAT_MOMENT_pq, central moments CENTRAL_MOMENT_pq, normalized raw moments NORM_SPAT_MOMENT_pq, normalized central moments NORM_CENTRAL_MOMENT_pq, Hu invariants HU_Mk, weighted raw moments WEIGHTED_SPAT_MOMENT_pq, weighted central moments WEIGHTED_CENTRAL_MOMENT_pq, weighted normalized central moments WT_NORM_CTR_MOM_pq, weighted Hu invariants WEIGHTED_HU_Mk
| \*all_glcm\* | glcm_asm, glcm_acor, glcm_cluprom, glcm_clushade, glcm_clutend, glcm_contrast, glcm_correlation, glcm_difave, glcm_difentro, glcm_difvar, glcm_dis, glcm_energy, glcm_entropy, glcm_hom1, glcm_hom2, glcm_id, glcm_idn, glcm_idm, glcm_idmn, glcm_infomeas1, glcm_infomeas2, glcm_iv, glcm_jave, glcm_je, glcm_jmax, glcm_jvar, glcm_sumaverage, glcm_sumentropy, glcm_sumvariance, glcm_variance
| \*all_glrlm\* | glrlm_sre, glrlm_lre, glrlm_gln, glrlm_glnn, glrlm_rln, glrlm_rlnn, glrlm_rp, glrlm_glv, glrlm_rv, glrlm_re, glrlm_lglre, glrlm_hglre, glrlm_srlgle, glrlm_srhgle, glrlm_lrlgle, glrlm_lrhgle
| \*all_glszm\* | glszm_sae, glszm_lae, glszm_gln, glszm_glnn, glszm_szn, glszm_sznn, glszm_zp, glszm_glv, glszm_zv, glszm_ze, glszm_lglze, glszm_hglze, glszm_salgle, glszm_sahgle, glszm_lalgle, glszm_lahgle
Expand Down
2 changes: 1 addition & 1 deletion docs/source/Math/f_2dmoments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ and
represent the center of mass of the image :math:`f(x,y)`. Hu's Uniqueness Theorem states that if :math:`f(x,y)` is piecewise continuous and has nonzero values only in the finite part
of the :math:`(x,y)` plane, then geometric moments of all orders exist. It can then be shown that the moment set :math:`{\mu_{pq}}` is
uniquely determined by :math:`f(x,y)` and conversely, :math:`f(x,y)` is uniquely determined by :math:`{\mu_{pq}}`. Since an image has
finite area, a moment set can be evaluated computationally and used to uniquely describe the information contained in the image.
finite area, a moment set can be evaluated computationally and used to uniquely describe the information contained in the image. Nyxus calculates 2 sets of geometric moments: moments where :math:`f(x,y)=1` within the ROI mask and 0 outside the ROI mask define shape moments while moments whose :math:`f(x,y)` are intensity at pixel location :math:`x,y` define intensity moments.

Raw moments
-----------
Expand Down
135 changes: 134 additions & 1 deletion docs/source/featurelist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ Nyxus provided features
- A set of Gabor filters of varying frequencies and orientations


**2D image moments:**
**2D shape image moments:**

----

Expand Down Expand Up @@ -689,6 +689,139 @@ Nyxus provided features
* - WEIGHTED_HU_M7
- Weighted Hu's moment 7

**2D intensity image moments:**

----

.. list-table::
:header-rows: 1

* - Nyxus feature code
- Description
* - IMOM_RM_00
- Spatial (raw) moments
* - IMOM_RM_01
- of order 00, 01, 02, etc
* - IMOM_RM_02
-
* - IMOM_RM_03
-
* - IMOM_RM_10
-
* - IMOM_RM_11
-
* - IMOM_RM_12
-
* - IMOM_RM_20
-
* - IMOM_RM_21
-
* - IMOM_RM_30
-
* - IMOM_WRM_00
- Spatial moments weighted by pixel distance to ROI edge
* - IMOM_WRM_01
-
* - IMOM_WRM_02
-
* - IMOM_WRM_03
-
* - IMOM_WRM_10
-
* - IMOM_WRM_11
-
* - IMOM_WRM_12
-
* - IMOM_WRM_20
-
* - IMOM_WRM_21
-
* - IMOM_WRM_30
-
* - IMOM_СM_02
- Central moments
* - IMOM_СM_03
-
* - IMOM_СM_11
-
* - IMOM_СM_12
-
* - IMOM_СM_20
-
* - IMOM_СM_21
-
* - IMOM_СM_30
-
* - IMOM_WСM_02
- Central moments weighted by pixel distance to ROI edge
* - IMOM_WСM_03
-
* - IMOM_WСM_11
-
* - IMOM_WСM_12
-
* - IMOM_WСM_20
-
* - IMOM_WСM_21
-
* - IMOM_WСM_30
-
* - IMOM_NСM_02
- Normalized central moments
* - IMOM_NСM_03
-
* - IMOM_NСM_11
-
* - IMOM_NСM_
-
* - IMOM_NСM_20
-
* - IMOM_NСM_21
-
* - IMOM_NСM_30
-
* - IMOM_NRM_00
- Normalized (standardized) spatial moments
* - IMOM_NRM_01
-
* - IMOM_NRM_02
-
* - IMOM_NRM_03
-
* - IMOM_NRM_10
-
* - IMOM_NRM_20
-
* - IMOM_NRM_30
-
* - IMOM_HU1
- Hu's moment 1
* - IMOM_HU2
- Hu's moment 2
* - IMOM_HU3
- Hu's moment 3
* - IMOM_HU4
- Hu's moment 4
* - IMOM_HU5
- Hu's moment 5
* - IMOM_HU6
- Hu's moment 6
* - IMOM_HU7
- Hu's moment 7
* - IMOM_WHU1
- Weighted Hu's moment 1
* - IMOM_WHU2
- Weighted Hu's moment 2
* - IMOM_WHU3
- Weighted Hu's moment 3
* - IMOM_WHU4
- Weighted Hu's moment 4
* - IMOM_WHU5
- Weighted Hu's moment 5
* - IMOM_WHU6
- Weighted Hu's moment 6
* - IMOM_WHU7
- Weighted Hu's moment 7

**Neighbor features:**

Expand Down
22 changes: 18 additions & 4 deletions src/nyx/env_features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "features/gldzm.h"
#include "features/glrlm.h"
#include "features/glszm.h"
#include "features/image_moments.h"
#include "features/2d_geomoments.h"
#include "features/intensity.h"
#include "features/neighbors.h"
#include "features/ngldm.h"
Expand Down Expand Up @@ -248,7 +248,8 @@ bool Environment::expand_2D_featuregroup (const std::string & s)
theFeatureSet.enableAll();
theFeatureSet.disableFeatures(GaborFeature::featureset);
theFeatureSet.disableFeatures(GLCMFeature::featureset);
theFeatureSet.disableFeatures(ImageMomentsFeature::featureset);
theFeatureSet.disableFeatures(Imoms2D_feature::featureset);
theFeatureSet.disableFeatures(Smoms2D_feature::featureset);
return true;
}

Expand Down Expand Up @@ -349,9 +350,22 @@ bool Environment::expand_2D_featuregroup (const std::string & s)
return true;
}

if (s == Nyxus::theFeatureSet.findGroupNameByCode(Fgroup2D::FG2_MOMENTS))
if (s == Nyxus::theFeatureSet.findGroupNameByCode(Fgroup2D::FG2_GEOMOMENTS))
{
theFeatureSet.enableFeatures(ImageMomentsFeature::featureset);
theFeatureSet.enableFeatures (Smoms2D_feature::featureset);
theFeatureSet.enableFeatures (Imoms2D_feature::featureset);
return true;
}

if (s == Nyxus::theFeatureSet.findGroupNameByCode(Fgroup2D::FG2_GEOMOMENTS_I))
{
theFeatureSet.enableFeatures(Imoms2D_feature::featureset);
return true;
}

if (s == Nyxus::theFeatureSet.findGroupNameByCode(Fgroup2D::FG2_GEOMOMENTS_S))
{
theFeatureSet.enableFeatures(Smoms2D_feature::featureset);
return true;
}

Expand Down
5 changes: 3 additions & 2 deletions src/nyx/feature_mgr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "features/hexagonality_polygonality.h"
#include "features/ngldm.h"
#include "features/ngtdm.h"
#include "features/image_moments.h"
#include "features/2d_geomoments.h"
#include "features/intensity.h"
#include "features/intensity_3d.h"
#include "features/moments.h"
Expand Down Expand Up @@ -60,7 +60,8 @@ FeatureManager::FeatureManager()
register_feature (new GLDMFeature());
register_feature (new NGLDMfeature());
register_feature (new NGTDMFeature());
register_feature (new ImageMomentsFeature());
register_feature (new Imoms2D_feature());
register_feature (new Smoms2D_feature());
register_feature (new GaborFeature());
register_feature (new ZernikeFeature());
register_feature (new RadialDistributionFeature());
Expand Down
Loading

0 comments on commit feccfd6

Please sign in to comment.