Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
friskluft committed Dec 21, 2024
1 parent e47e56e commit 7381ae0
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ set(SOURCE
src/nyx/features/3d_gldzm.cpp
src/nyx/features/3d_glcm.cpp
src/nyx/features/3d_glcm_nontriv.cpp
src/nyx/features/3d_glrlm.cpp
src/nyx/features/3d_glrlm_nontriv.cpp
src/nyx/features/intensity.cpp
src/nyx/features/neighbors.cpp
src/nyx/features/ngldm.cpp
Expand Down
114 changes: 114 additions & 0 deletions src/nyx/env_features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,76 @@ bool Environment::expand_3D_featuregroup (const std::string& s)
return true;
}

if (s == Nyxus::theFeatureSet.findGroupNameByCode(Fgroup3D::FG3_GLCM))
{
theFeatureSet.enableAll (false);

auto F =
{
Nyxus::Feature3D::GLCM_ACOR,
Nyxus::Feature3D::GLCM_ASM,
Nyxus::Feature3D::GLCM_CLUPROM,
Nyxus::Feature3D::GLCM_CLUSHADE,
Nyxus::Feature3D::GLCM_CLUTEND,
Nyxus::Feature3D::GLCM_CONTRAST,
Nyxus::Feature3D::GLCM_CORRELATION,
Nyxus::Feature3D::GLCM_DIFAVE,
Nyxus::Feature3D::GLCM_DIFENTRO,
Nyxus::Feature3D::GLCM_DIFVAR,
Nyxus::Feature3D::GLCM_DIS,
Nyxus::Feature3D::GLCM_ENERGY,
Nyxus::Feature3D::GLCM_ENTROPY,
Nyxus::Feature3D::GLCM_HOM1,
Nyxus::Feature3D::GLCM_HOM2,
Nyxus::Feature3D::GLCM_ID,
Nyxus::Feature3D::GLCM_IDN,
Nyxus::Feature3D::GLCM_IDM,
Nyxus::Feature3D::GLCM_IDMN,
Nyxus::Feature3D::GLCM_INFOMEAS1,
Nyxus::Feature3D::GLCM_INFOMEAS2,
Nyxus::Feature3D::GLCM_IV,
Nyxus::Feature3D::GLCM_JAVE,
Nyxus::Feature3D::GLCM_JE,
Nyxus::Feature3D::GLCM_JMAX,
Nyxus::Feature3D::GLCM_JVAR,
Nyxus::Feature3D::GLCM_SUMAVERAGE,
Nyxus::Feature3D::GLCM_SUMENTROPY,
Nyxus::Feature3D::GLCM_SUMVARIANCE,
Nyxus::Feature3D::GLCM_VARIANCE,
Nyxus::Feature3D::GLCM_ASM_AVE,
Nyxus::Feature3D::GLCM_ACOR_AVE,
Nyxus::Feature3D::GLCM_CLUPROM_AVE,
Nyxus::Feature3D::GLCM_CLUSHADE_AVE,
Nyxus::Feature3D::GLCM_CLUTEND_AVE,
Nyxus::Feature3D::GLCM_CONTRAST_AVE,
Nyxus::Feature3D::GLCM_CORRELATION_AVE,
Nyxus::Feature3D::GLCM_DIFAVE_AVE,
Nyxus::Feature3D::GLCM_DIFENTRO_AVE,
Nyxus::Feature3D::GLCM_DIFVAR_AVE,
Nyxus::Feature3D::GLCM_DIS_AVE,
Nyxus::Feature3D::GLCM_ENERGY_AVE,
Nyxus::Feature3D::GLCM_ENTROPY_AVE,
Nyxus::Feature3D::GLCM_HOM1_AVE,
Nyxus::Feature3D::GLCM_ID_AVE,
Nyxus::Feature3D::GLCM_IDN_AVE,
Nyxus::Feature3D::GLCM_IDM_AVE,
Nyxus::Feature3D::GLCM_IDMN_AVE,
Nyxus::Feature3D::GLCM_IV_AVE,
Nyxus::Feature3D::GLCM_JAVE_AVE,
Nyxus::Feature3D::GLCM_JE_AVE,
Nyxus::Feature3D::GLCM_INFOMEAS1_AVE,
Nyxus::Feature3D::GLCM_INFOMEAS2_AVE,
Nyxus::Feature3D::GLCM_VARIANCE_AVE,
Nyxus::Feature3D::GLCM_JMAX_AVE,
Nyxus::Feature3D::GLCM_JVAR_AVE,
Nyxus::Feature3D::GLCM_SUMAVERAGE_AVE,
Nyxus::Feature3D::GLCM_SUMENTROPY_AVE,
Nyxus::Feature3D::GLCM_SUMVARIANCE_AVE
};

theFeatureSet.enableFeatures(F);
return true;
}
if (s == Nyxus::theFeatureSet.findGroupNameByCode(Fgroup3D::FG3_GLDZM))
{
theFeatureSet.enableAll(false);
Expand Down Expand Up @@ -476,6 +546,50 @@ bool Environment::expand_3D_featuregroup (const std::string& s)
return true;
}

if (s == Nyxus::theFeatureSet.findGroupNameByCode(Fgroup3D::FG3_GLRLM))
{
theFeatureSet.enableAll(false);

auto F =
{
Nyxus::Feature3D::GLRLM_SRE,
Nyxus::Feature3D::GLRLM_LRE,
Nyxus::Feature3D::GLRLM_GLN,
Nyxus::Feature3D::GLRLM_GLNN,
Nyxus::Feature3D::GLRLM_RLN,
Nyxus::Feature3D::GLRLM_RLNN,
Nyxus::Feature3D::GLRLM_RP,
Nyxus::Feature3D::GLRLM_GLV,
Nyxus::Feature3D::GLRLM_RV,
Nyxus::Feature3D::GLRLM_RE,
Nyxus::Feature3D::GLRLM_LGLRE,
Nyxus::Feature3D::GLRLM_HGLRE,
Nyxus::Feature3D::GLRLM_SRLGLE,
Nyxus::Feature3D::GLRLM_SRHGLE,
Nyxus::Feature3D::GLRLM_LRLGLE,
Nyxus::Feature3D::GLRLM_LRHGLE,

Nyxus::Feature3D::GLRLM_SRE_AVE,
Nyxus::Feature3D::GLRLM_LRE_AVE,
Nyxus::Feature3D::GLRLM_GLN_AVE,
Nyxus::Feature3D::GLRLM_GLNN_AVE,
Nyxus::Feature3D::GLRLM_RLN_AVE,
Nyxus::Feature3D::GLRLM_RLNN_AVE,
Nyxus::Feature3D::GLRLM_RP_AVE,
Nyxus::Feature3D::GLRLM_GLV_AVE,
Nyxus::Feature3D::GLRLM_RV_AVE,
Nyxus::Feature3D::GLRLM_RE_AVE,
Nyxus::Feature3D::GLRLM_LGLRE_AVE,
Nyxus::Feature3D::GLRLM_HGLRE_AVE,
Nyxus::Feature3D::GLRLM_SRLGLE_AVE,
Nyxus::Feature3D::GLRLM_SRHGLE_AVE,
Nyxus::Feature3D::GLRLM_LRLGLE_AVE,
Nyxus::Feature3D::GLRLM_LRHGLE_AVE
};

theFeatureSet.enableFeatures(F);
return true;
}
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions src/nyx/feature_mgr_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "features/3d_intensity.h"
#include "features/3d_glcm.h"
#include "features/3d_gldzm.h"
#include "features/3d_glrlm.h"

#include "features/focus_score.h"
#include "features/power_spectrum.h"
Expand Down Expand Up @@ -74,6 +75,7 @@ FeatureManager::FeatureManager()
register_feature (new D3_PixelIntensityFeatures());
register_feature (new D3_GLCM_feature());
register_feature (new D3_GLDZM_feature());
register_feature (new D3_GLRLM_feature());

// image quality
register_feature (new FocusScoreFeature());
Expand Down
4 changes: 1 addition & 3 deletions src/nyx/features/3d_gldzm.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#pragma once

#pragma once

#include "../feature_method.h"
#include "texture_feature.h"

/// @brief Grey Level Distance Zone (GLDZM) features
///
/// Grey Level Dsitance Zone (GLDZM) quantifies distances zones of same intensity to the ROI border
/// GLDZM quantifies distance zones of same intensity to the ROI border

class D3_GLDZM_feature : public FeatureMethod, public TextureFeature
{
Expand Down
34 changes: 34 additions & 0 deletions src/nyx/featureset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,39 @@ namespace Nyxus
{ "3GLDZM_ZDM", Feature3D::GLDZM_ZDM },
{ "3GLDZM_ZDV", Feature3D::GLDZM_ZDV },
{ "3GLDZM_ZDE", Feature3D::GLDZM_ZDE },

{ "3GLRLM_SRE", Feature3D::GLRLM_SRE },
{ "3GLRLM_LRE", Feature3D::GLRLM_LRE },
{ "3GLRLM_GLN", Feature3D::GLRLM_GLN },
{ "3GLRLM_GLNN", Feature3D::GLRLM_GLNN },
{ "3GLRLM_RLN", Feature3D::GLRLM_RLN },
{ "3GLRLM_RLNN", Feature3D::GLRLM_RLNN },
{ "3GLRLM_RP", Feature3D::GLRLM_RP },
{ "3GLRLM_GLV", Feature3D::GLRLM_GLV },
{ "3GLRLM_RV", Feature3D::GLRLM_RV },
{ "3GLRLM_RE", Feature3D::GLRLM_RE },
{ "3GLRLM_LGLRE", Feature3D::GLRLM_LGLRE },
{ "3GLRLM_HGLRE", Feature3D::GLRLM_HGLRE },
{ "3GLRLM_SRLGLE", Feature3D::GLRLM_SRLGLE },
{ "3GLRLM_SRHGLE", Feature3D::GLRLM_SRHGLE },
{ "3GLRLM_LRLGLE", Feature3D::GLRLM_LRLGLE },
{ "3GLRLM_LRHGLE", Feature3D::GLRLM_LRHGLE },
{ "3GLRLM_SRE_AVE", Feature3D::GLRLM_SRE_AVE },
{ "3GLRLM_LRE_AVE", Feature3D::GLRLM_LRE_AVE },
{ "3GLRLM_GLN_AVE", Feature3D::GLRLM_GLN_AVE },
{ "3GLRLM_GLNN_AVE", Feature3D::GLRLM_GLNN_AVE },
{ "3GLRLM_RLN_AVE", Feature3D::GLRLM_RLN_AVE },
{ "3GLRLM_RLNN_AVE", Feature3D::GLRLM_RLNN_AVE },
{ "3GLRLM_RP_AVE", Feature3D::GLRLM_RP_AVE },
{ "3GLRLM_GLV_AVE", Feature3D::GLRLM_GLV_AVE },
{ "3GLRLM_RV_AVE", Feature3D::GLRLM_RV_AVE },
{ "3GLRLM_RE_AVE", Feature3D::GLRLM_RE_AVE },
{ "3GLRLM_LGLRE_AVE", Feature3D::GLRLM_LGLRE_AVE },
{ "3GLRLM_HGLRE_AVE", Feature3D::GLRLM_HGLRE_AVE },
{ "3GLRLM_SRLGLE_AVE", Feature3D::GLRLM_SRLGLE_AVE },
{ "3GLRLM_SRHGLE_AVE", Feature3D::GLRLM_SRHGLE_AVE },
{ "3GLRLM_LRLGLE_AVE", Feature3D::GLRLM_LRLGLE_AVE },
{ "3GLRLM_LRHGLE_AVE", Feature3D::GLRLM_LRHGLE_AVE },
};

std::map <std::string, Fgroup3D> UserFacing3dFeaturegroupNames =
Expand All @@ -790,6 +823,7 @@ namespace Nyxus
{ "*3D_ALL_TEXTURE*", Fgroup3D::FG3_TEXTURE },
{ "*3D_GLCM*", Fgroup3D::FG3_GLCM },
{ "*3D_GLDZM*", Fgroup3D::FG3_GLDZM },
{ "*3D_GLRLM*", Fgroup3D::FG3_GLRLM },
{ "*3D_ALL_NEIGHBOR*", Fgroup3D::FG3_NEIG },
{ "*3D_MOMENTS*", Fgroup3D::FG3_MOMENTS },
};
Expand Down
36 changes: 36 additions & 0 deletions src/nyx/featureset.h
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,41 @@ namespace Nyxus
GLDZM_ZDV, // Zone Distance Variance
GLDZM_ZDE, // Zone Distance Entropy

// GLRLM:
GLRLM_SRE, // Short Run Emphasis
GLRLM_LRE, // Long Run Emphasis
GLRLM_GLN, // Gray Level Non-Uniformity
GLRLM_GLNN, // Gray Level Non-Uniformity Normalized
GLRLM_RLN, // Run Length Non-Uniformity
GLRLM_RLNN, // Run Length Non-Uniformity Normalized
GLRLM_RP, // Run Percentage
GLRLM_GLV, // Gray Level Variance
GLRLM_RV, // Run Variance
GLRLM_RE, // Run Entropy
GLRLM_LGLRE, // Low Gray Level Run Emphasis
GLRLM_HGLRE, // High Gray Level Run Emphasis
GLRLM_SRLGLE, // Short Run Low Gray Level Emphasis
GLRLM_SRHGLE, // Short Run High Gray Level Emphasis
GLRLM_LRLGLE, // Long Run Low Gray Level Emphasis
GLRLM_LRHGLE, // Long Run High Gray Level Emphasis
// -- averages --
GLRLM_SRE_AVE,
GLRLM_LRE_AVE,
GLRLM_GLN_AVE,
GLRLM_GLNN_AVE,
GLRLM_RLN_AVE,
GLRLM_RLNN_AVE,
GLRLM_RP_AVE,
GLRLM_GLV_AVE,
GLRLM_RV_AVE,
GLRLM_RE_AVE,
GLRLM_LGLRE_AVE,
GLRLM_HGLRE_AVE,
GLRLM_SRLGLE_AVE,
GLRLM_SRHGLE_AVE,
GLRLM_LRLGLE_AVE,
GLRLM_LRHGLE_AVE,

_COUNT_
};

Expand Down Expand Up @@ -785,6 +820,7 @@ namespace Nyxus
FG3_TEXTURE, // 3D_GLCM + 3D_GLRLM + 3D_DLSZM + etc
FG3_GLCM,
FG3_GLDZM,
FG3_GLRLM,
FG3_NEIG,
FG3_MOMENTS,
_COUNT_
Expand Down
7 changes: 6 additions & 1 deletion src/nyx/reduce_trivial_rois.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "features/3d_intensity.h"
#include "features/3d_glcm.h"
#include "features/3d_gldzm.h"
#include "features/3d_glrlm.h"
//--future-- #include "features/3d_surface.h"

#include "features/focus_score.h"
Expand Down Expand Up @@ -384,7 +385,11 @@ namespace Nyxus
STOPWATCH("3D GLDZM/3DGLDZM/3DGLDZM/#FFFF00", "\t=");
runParallel (D3_GLDZM_feature::reduce, n_threads, work_per_thread, job_size, &L, &roiData);
}

if (D3_GLRLM_feature::required(theFeatureSet))
{
STOPWATCH("3D GLRLM/3DGLRLM/3DGLRLM/#FFFF00", "\t=");
runParallel(D3_GLRLM_feature::reduce, n_threads, work_per_thread, job_size, &L, &roiData);
}

//==== morphology/surface
//--future--
Expand Down

0 comments on commit 7381ae0

Please sign in to comment.