3737#include " features/3d_ngldm.h"
3838#include " features/3d_ngtdm.h"
3939#include " features/3d_gldzm.h"
40+ #include " features/3d_glrlm.h"
4041#include " features/3d_glszm.h"
4142#include " features/roi_radius.h"
4243#include " helpers/helpers.h"
@@ -131,8 +132,8 @@ bool Environment::spellcheck_raw_featurelist(const std::string& comma_separated_
131132
132133 if (dim () == 3 )
133134 {
134- // Is feature found among 2D features?
135- Fgroup3D afg;
135+ // Is feature found among 3D features?
136+ int afg; // signed Fgroup3D
136137 bool gnameExists = theFeatureSet.find_3D_GroupByString (s_uppr, afg);
137138
138139 // Intercept an error: 3D feature group exists but requested in the non-3D mode
@@ -150,7 +151,7 @@ bool Environment::spellcheck_raw_featurelist(const std::string& comma_separated_
150151 continue ;
151152 }
152153
153- Feature3D af;
154+ int af; // signed Feature3D
154155 bool fnameExists = theFeatureSet.find_3D_FeatureByString (s_uppr, af);
155156
156157 // 3D feature group requested on a non-3D mode ?
@@ -353,11 +354,19 @@ bool Environment::expand_2D_featuregroup (const std::string & s)
353354//
354355bool Environment::expand_3D_featuregroup (const std::string& s)
355356{
356- // mutually exclusive groups:
357- if (s == Nyxus::theFeatureSet.findGroupNameByCode (Fgroup3D::FG3_ALL))
357+ int fgcode;
358+ if (!Nyxus::theFeatureSet.find_3D_GroupByString (s, fgcode))
359+ return false ; // 's' is a feature name
360+ bool enable = true ;
361+ if (fgcode < 0 )
358362 {
359- theFeatureSet.enableAll (false );
363+ fgcode = -fgcode;
364+ enable = false ;
365+ }
360366
367+ // mutually exclusive groups:
368+ if ((Fgroup3D)fgcode == Fgroup3D::FG3_ALL)
369+ {
361370 auto F =
362371 {
363372 Feature3D::COV,
@@ -439,172 +448,61 @@ bool Environment::expand_3D_featuregroup (const std::string& s)
439448#endif
440449 };
441450
442- theFeatureSet.enableFeatures (F);
443- theFeatureSet.enableFeatures (D3_GLCM_feature::featureset);
444- theFeatureSet.enableFeatures (D3_GLDZM_feature::featureset);
445- theFeatureSet.enableFeatures (D3_GLSZM_feature::featureset);
451+ theFeatureSet.enableFeatures (F, enable);
452+ theFeatureSet.enableFeatures (D3_GLCM_feature::featureset, enable);
453+ theFeatureSet.enableFeatures (D3_GLDM_feature::featureset, enable);
454+ theFeatureSet.enableFeatures (D3_GLDZM_feature::featureset, enable);
455+ theFeatureSet.enableFeatures (D3_GLRLM_feature::featureset, enable);
456+ theFeatureSet.enableFeatures (D3_GLSZM_feature::featureset, enable);
457+ theFeatureSet.enableFeatures (D3_NGLDM_feature::featureset, enable);
458+ theFeatureSet.enableFeatures (D3_NGTDM_feature::featureset, enable);
446459
447460 return true ;
448461 }
449462
450- if (s == Nyxus::theFeatureSet. findGroupNameByCode ( Fgroup3D::FG3_GLCM) )
463+ if ((Fgroup3D)fgcode == Fgroup3D::FG3_GLCM)
451464 {
452- theFeatureSet.enableAll (false );
453- theFeatureSet.enableFeatures (D3_GLCM_feature::featureset);
465+ theFeatureSet.enableFeatures (D3_GLCM_feature::featureset, enable);
454466 return true ;
455467 }
456468
457- if (s == Nyxus::theFeatureSet. findGroupNameByCode ( Fgroup3D::FG3_GLDM) )
469+ if ((Fgroup3D)fgcode == Fgroup3D::FG3_GLDM)
458470 {
459- theFeatureSet.enableAll (false );
460- theFeatureSet.enableFeatures (D3_GLDM_feature::featureset);
471+ theFeatureSet.enableFeatures (D3_GLDM_feature::featureset, enable);
461472 return true ;
462473 }
463474
464- if (s == Nyxus::theFeatureSet. findGroupNameByCode ( Fgroup3D::FG3_NGLDM) )
475+ if ((Fgroup3D)fgcode == Fgroup3D::FG3_NGLDM)
465476 {
466- theFeatureSet.enableAll (false );
467- theFeatureSet.enableFeatures (D3_NGLDM_feature::featureset);
477+ theFeatureSet.enableFeatures (D3_NGLDM_feature::featureset, enable);
468478 return true ;
469479 }
470480
471- if (s == Nyxus::theFeatureSet. findGroupNameByCode ( Fgroup3D::FG3_NGTDM) )
481+ if ((Fgroup3D)fgcode == Fgroup3D::FG3_NGTDM)
472482 {
473- theFeatureSet.enableAll (false );
474- theFeatureSet.enableFeatures (D3_NGTDM_feature::featureset);
483+ theFeatureSet.enableFeatures (D3_NGTDM_feature::featureset, enable);
475484 return true ;
476485 }
477486
478- if (s == Nyxus::theFeatureSet. findGroupNameByCode ( Fgroup3D::FG3_GLCM) )
487+ if ((Fgroup3D)fgcode == Fgroup3D::FG3_GLDZM )
479488 {
480- theFeatureSet.enableAll (false );
481-
482- auto F =
483- {
484- Nyxus::Feature3D::GLCM_ACOR,
485- Nyxus::Feature3D::GLCM_ASM,
486- Nyxus::Feature3D::GLCM_CLUPROM,
487- Nyxus::Feature3D::GLCM_CLUSHADE,
488- Nyxus::Feature3D::GLCM_CLUTEND,
489- Nyxus::Feature3D::GLCM_CONTRAST,
490- Nyxus::Feature3D::GLCM_CORRELATION,
491- Nyxus::Feature3D::GLCM_DIFAVE,
492- Nyxus::Feature3D::GLCM_DIFENTRO,
493- Nyxus::Feature3D::GLCM_DIFVAR,
494- Nyxus::Feature3D::GLCM_DIS,
495- Nyxus::Feature3D::GLCM_ENERGY,
496- Nyxus::Feature3D::GLCM_ENTROPY,
497- Nyxus::Feature3D::GLCM_HOM1,
498- Nyxus::Feature3D::GLCM_HOM2,
499- Nyxus::Feature3D::GLCM_ID,
500- Nyxus::Feature3D::GLCM_IDN,
501- Nyxus::Feature3D::GLCM_IDM,
502- Nyxus::Feature3D::GLCM_IDMN,
503- Nyxus::Feature3D::GLCM_INFOMEAS1,
504- Nyxus::Feature3D::GLCM_INFOMEAS2,
505- Nyxus::Feature3D::GLCM_IV,
506- Nyxus::Feature3D::GLCM_JAVE,
507- Nyxus::Feature3D::GLCM_JE,
508- Nyxus::Feature3D::GLCM_JMAX,
509- Nyxus::Feature3D::GLCM_JVAR,
510- Nyxus::Feature3D::GLCM_SUMAVERAGE,
511- Nyxus::Feature3D::GLCM_SUMENTROPY,
512- Nyxus::Feature3D::GLCM_SUMVARIANCE,
513- Nyxus::Feature3D::GLCM_VARIANCE,
514- Nyxus::Feature3D::GLCM_ASM_AVE,
515- Nyxus::Feature3D::GLCM_ACOR_AVE,
516- Nyxus::Feature3D::GLCM_CLUPROM_AVE,
517- Nyxus::Feature3D::GLCM_CLUSHADE_AVE,
518- Nyxus::Feature3D::GLCM_CLUTEND_AVE,
519- Nyxus::Feature3D::GLCM_CONTRAST_AVE,
520- Nyxus::Feature3D::GLCM_CORRELATION_AVE,
521- Nyxus::Feature3D::GLCM_DIFAVE_AVE,
522- Nyxus::Feature3D::GLCM_DIFENTRO_AVE,
523- Nyxus::Feature3D::GLCM_DIFVAR_AVE,
524- Nyxus::Feature3D::GLCM_DIS_AVE,
525- Nyxus::Feature3D::GLCM_ENERGY_AVE,
526- Nyxus::Feature3D::GLCM_ENTROPY_AVE,
527- Nyxus::Feature3D::GLCM_HOM1_AVE,
528- Nyxus::Feature3D::GLCM_ID_AVE,
529- Nyxus::Feature3D::GLCM_IDN_AVE,
530- Nyxus::Feature3D::GLCM_IDM_AVE,
531- Nyxus::Feature3D::GLCM_IDMN_AVE,
532- Nyxus::Feature3D::GLCM_IV_AVE,
533- Nyxus::Feature3D::GLCM_JAVE_AVE,
534- Nyxus::Feature3D::GLCM_JE_AVE,
535- Nyxus::Feature3D::GLCM_INFOMEAS1_AVE,
536- Nyxus::Feature3D::GLCM_INFOMEAS2_AVE,
537- Nyxus::Feature3D::GLCM_VARIANCE_AVE,
538- Nyxus::Feature3D::GLCM_JMAX_AVE,
539- Nyxus::Feature3D::GLCM_JVAR_AVE,
540- Nyxus::Feature3D::GLCM_SUMAVERAGE_AVE,
541- Nyxus::Feature3D::GLCM_SUMENTROPY_AVE,
542- Nyxus::Feature3D::GLCM_SUMVARIANCE_AVE
543- };
544-
545- theFeatureSet.enableFeatures (F);
489+ theFeatureSet.enableFeatures (D3_GLDZM_feature::featureset, enable);
546490 return true ;
547491 }
548492
549- if (s == Nyxus::theFeatureSet. findGroupNameByCode ( Fgroup3D::FG3_GLDZM) )
493+ if ((Fgroup3D)fgcode == Fgroup3D::FG3_GLSZM )
550494 {
551- theFeatureSet.enableAll (false );
552- theFeatureSet.enableFeatures (D3_GLDZM_feature::featureset);
553- return true ;
554- }
555-
556- if (s == Nyxus::theFeatureSet.findGroupNameByCode (Fgroup3D::FG3_GLSZM))
557- {
558- theFeatureSet.enableAll (false );
559- theFeatureSet.enableFeatures (D3_GLSZM_feature::featureset);
495+ theFeatureSet.enableFeatures (D3_GLSZM_feature::featureset, enable);
560496 return true ;
561497 }
562498
563- if (s == Nyxus::theFeatureSet. findGroupNameByCode ( Fgroup3D::FG3_GLRLM) )
499+ if ((Fgroup3D)fgcode == Fgroup3D::FG3_GLRLM)
564500 {
565- theFeatureSet.enableAll (false );
566-
567- auto F =
568- {
569- Nyxus::Feature3D::GLRLM_SRE,
570- Nyxus::Feature3D::GLRLM_LRE,
571- Nyxus::Feature3D::GLRLM_GLN,
572- Nyxus::Feature3D::GLRLM_GLNN,
573- Nyxus::Feature3D::GLRLM_RLN,
574- Nyxus::Feature3D::GLRLM_RLNN,
575- Nyxus::Feature3D::GLRLM_RP,
576- Nyxus::Feature3D::GLRLM_GLV,
577- Nyxus::Feature3D::GLRLM_RV,
578- Nyxus::Feature3D::GLRLM_RE,
579- Nyxus::Feature3D::GLRLM_LGLRE,
580- Nyxus::Feature3D::GLRLM_HGLRE,
581- Nyxus::Feature3D::GLRLM_SRLGLE,
582- Nyxus::Feature3D::GLRLM_SRHGLE,
583- Nyxus::Feature3D::GLRLM_LRLGLE,
584- Nyxus::Feature3D::GLRLM_LRHGLE,
585-
586- Nyxus::Feature3D::GLRLM_SRE_AVE,
587- Nyxus::Feature3D::GLRLM_LRE_AVE,
588- Nyxus::Feature3D::GLRLM_GLN_AVE,
589- Nyxus::Feature3D::GLRLM_GLNN_AVE,
590- Nyxus::Feature3D::GLRLM_RLN_AVE,
591- Nyxus::Feature3D::GLRLM_RLNN_AVE,
592- Nyxus::Feature3D::GLRLM_RP_AVE,
593- Nyxus::Feature3D::GLRLM_GLV_AVE,
594- Nyxus::Feature3D::GLRLM_RV_AVE,
595- Nyxus::Feature3D::GLRLM_RE_AVE,
596- Nyxus::Feature3D::GLRLM_LGLRE_AVE,
597- Nyxus::Feature3D::GLRLM_HGLRE_AVE,
598- Nyxus::Feature3D::GLRLM_SRLGLE_AVE,
599- Nyxus::Feature3D::GLRLM_SRHGLE_AVE,
600- Nyxus::Feature3D::GLRLM_LRLGLE_AVE,
601- Nyxus::Feature3D::GLRLM_LRHGLE_AVE
602- };
603-
604- theFeatureSet.enableFeatures (F);
501+ theFeatureSet.enableFeatures (D3_GLRLM_feature::featureset, enable);
605502 return true ;
606503 }
607504
505+ // unrecognized feature group
608506 return false ;
609507}
610508
@@ -643,6 +541,8 @@ void Environment::expand_featuregroups()
643541 continue ;
644542 }
645543
544+ // try to interpret 's' as a group name
545+
646546 if (dim () == 2 )
647547 {
648548 if (expand_2D_featuregroup (s))
@@ -656,24 +556,25 @@ void Environment::expand_featuregroups()
656556 }
657557
658558 // 's' is an individual feature name, not feature group name. Process it now
559+
659560 if (dim () == 2 )
660561 {
661562 int fcode; // signed Feature2D
662- if (!theFeatureSet.find_2D_FeatureByString (s, fcode))
563+ if (!Nyxus:: theFeatureSet.find_2D_FeatureByString (s, fcode))
663564 throw std::invalid_argument (" Error: '" + s + " ' is not a valid 2D feature name \n " );
664565
665- theFeatureSet.enableFeature (fcode);
566+ Nyxus:: theFeatureSet.enableFeature (fcode);
666567
667568 continue ;
668569 }
669570
670571 if (dim () == 3 )
671572 {
672- Feature3D a;
673- if (!theFeatureSet.find_3D_FeatureByString (s, a))
573+ int a; // signed Feature3D
574+ if (!Nyxus:: theFeatureSet.find_3D_FeatureByString (s, a))
674575 throw std::invalid_argument (" Error: '" + s + " ' is not a valid 3D feature name \n " );
675576
676- theFeatureSet.enableFeature (int (a));
577+ Nyxus:: theFeatureSet.enableFeature (int (a));
677578 continue ;
678579 }
679580 }
0 commit comments