def test_compute_intensity_features(self):

        expected_feature_list = [
            'Intensity.Min',
            'Intensity.Max',
            'Intensity.Mean',
            'Intensity.Median',
            'Intensity.MeanMedianDiff',
            'Intensity.Std',
            'Intensity.IQR',
            'Intensity.MAD',
            'Intensity.Skewness',
            'Intensity.Kurtosis',
            'Intensity.HistEnergy',
            'Intensity.HistEntropy',
        ]

        fdata = htk_features.compute_intensity_features(
            self.im_nuclei_seg_mask, self.im_nuclei_stain)

        self.check_fdata_sanity(fdata, expected_feature_list)

        self.check_fdata_sanity(self.fdata_nuclei,
                                expected_feature_list,
                                prefix='Nucleus.',
                                match_feature_count=False)

        self.check_fdata_sanity(self.fdata_nuclei,
                                expected_feature_list,
                                prefix='Cytoplasm.',
                                match_feature_count=False)
Exemplo n.º 2
0
    def test_compute_intensity_features(self):

        expected_feature_list = [
            'Intensity.Min',
            'Intensity.Max',
            'Intensity.Mean',
            'Intensity.Median',
            'Intensity.MeanMedianDiff',
            'Intensity.Std',
            'Intensity.IQR',
            'Intensity.MAD',
            'Intensity.Skewness',
            'Intensity.Kurtosis',
            'Intensity.HistEnergy',
            'Intensity.HistEntropy',
        ]

        fdata = htk_features.compute_intensity_features(
            cfg.im_nuclei_seg_mask, cfg.im_nuclei_stain)

        check_fdata_sanity(fdata, expected_feature_list)

        check_fdata_sanity(cfg.fdata_nuclei,
                           expected_feature_list,
                           prefix='Nucleus.',
                           match_feature_count=False)

        check_fdata_sanity(cfg.fdata_nuclei,
                           expected_feature_list,
                           prefix='Cytoplasm.',
                           match_feature_count=False)

        if GENERATE_GROUNDTRUTH:
            fdata.to_csv(os.path.join(tempfile.gettempdir(),
                                      'Easy1_nuclei_intensity_features.csv'),
                         index=False)

        fdata_gtruth = pd.read_csv(
            utilities.getTestFilePath('Easy1_nuclei_intensity_features.csv'),
            index_col=None)

        pd.testing.assert_frame_equal(fdata,
                                      fdata_gtruth,
                                      check_less_precise=2)
Exemplo n.º 3
0
    def test_compute_intensity_features(self):

        expected_feature_list = [
            'Intensity.Min',
            'Intensity.Max',
            'Intensity.Mean',
            'Intensity.Median',
            'Intensity.MeanMedianDiff',
            'Intensity.Std',
            'Intensity.IQR',
            'Intensity.MAD',
            'Intensity.Skewness',
            'Intensity.Kurtosis',
            'Intensity.HistEnergy',
            'Intensity.HistEntropy',
        ]

        fdata = htk_features.compute_intensity_features(
            self.im_nuclei_seg_mask, self.im_nuclei_stain)

        self.check_fdata_sanity(fdata, expected_feature_list)

        self.check_fdata_sanity(self.fdata_nuclei,
                                expected_feature_list,
                                prefix='Nucleus.',
                                match_feature_count=False)

        self.check_fdata_sanity(self.fdata_nuclei,
                                expected_feature_list,
                                prefix='Cytoplasm.',
                                match_feature_count=False)

        # Uncomment to generate ground truth
        # fdata.to_csv(os.path.join(
        #     TEST_DATA_DIR, 'Easy1_nuclei_intensity_features.csv'),
        #     index=False)

        fdata_gtruth = pd.read_csv(os.path.join(
            TEST_DATA_DIR, 'Easy1_nuclei_intensity_features.csv'),
                                   index_col=None)

        pd.testing.assert_frame_equal(fdata, fdata_gtruth)