@@ -65,12 +65,36 @@ public void process( final Spot spot )
6565 intensities .addValue ( val );
6666 }
6767
68- Util .quicksort ( intensities .getArray (), 0 , intensities .size () - 1 );
69- spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( MEAN_INTENSITY , channel ), Double .valueOf ( TMUtils .average ( intensities ) ) );
70- spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( MEDIAN_INTENSITY , channel ), Double .valueOf ( intensities .getArray ()[ intensities .size () / 2 ] ) );
71- spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( MIN_INTENSITY , channel ), Double .valueOf ( intensities .getArray ()[ 0 ] ) );
72- spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( MAX_INTENSITY , channel ), Double .valueOf ( intensities .getArray ()[ intensities .size () - 1 ] ) );
73- spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( TOTAL_INTENSITY , channel ), Double .valueOf ( TMUtils .sum ( intensities ) ) );
74- spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( STD_INTENSITY , channel ), Double .valueOf ( TMUtils .standardDeviation ( intensities ) ) );
68+ final double mean ;
69+ final double median ;
70+ final double max ;
71+ final double min ;
72+ final double sum ;
73+ final double std ;
74+ if ( intensities .isEmpty () )
75+ {
76+ mean = Double .NaN ;
77+ median = Double .NaN ;
78+ max = Double .NaN ;
79+ min = Double .NaN ;
80+ sum = Double .NaN ;
81+ std = Double .NaN ;
82+ }
83+ else
84+ {
85+ Util .quicksort ( intensities .getArray (), 0 , intensities .size () - 1 );
86+ mean = Double .valueOf ( TMUtils .average ( intensities ) );
87+ median = Double .valueOf ( intensities .getArray ()[ intensities .size () / 2 ] );
88+ min = Double .valueOf ( intensities .getArray ()[ 0 ] );
89+ max = Double .valueOf ( intensities .getArray ()[ intensities .size () - 1 ] );
90+ sum = Double .valueOf ( TMUtils .sum ( intensities ) );
91+ std = Double .valueOf ( TMUtils .standardDeviation ( intensities ) );
92+ }
93+ spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( MEAN_INTENSITY , channel ), mean );
94+ spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( MEDIAN_INTENSITY , channel ), median );
95+ spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( MIN_INTENSITY , channel ), min );
96+ spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( MAX_INTENSITY , channel ), max );
97+ spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( TOTAL_INTENSITY , channel ), sum );
98+ spot .putFeature ( SpotIntensityMultiCAnalyzerFactory .makeFeatureKey ( STD_INTENSITY , channel ), std );
7599 }
76100}
0 commit comments