Beispiel #1
0
    def test_custom_default_name(self, small_cont: ImageContainer):
        custom_features = small_cont.features_custom(np.mean, layer="image", channels=[0])
        summary_features = small_cont.features_summary("image", feature_name="summary", channels=[0])

        assert len(custom_features) == 1
        assert f"{np.mean.__name__}_0" in custom_features
        assert custom_features[f"{np.mean.__name__}_0"] == summary_features["summary_ch-0_mean"]
Beispiel #2
0
    def test_custom_returns_iterable(self, small_cont: ImageContainer):
        def dummy(_: np.ndarray) -> Tuple[int, int]:
            return 0, 1

        features = small_cont.features_custom(dummy, layer="image", feature_name="foo")

        assert len(features) == 2
        assert features["foo_0"] == 0
        assert features["foo_1"] == 1