コード例 #1
0
 def test_warn_random_but_has_no_invertible(self):
     transforms = Compose(
         [AddChanneld("image"), RandFlipd("image", prob=1.0), RandScaleIntensityd("image", 0.1, prob=1.0)]
     )
     with self.assertWarns(UserWarning):
         tta = TestTimeAugmentation(transforms, 5, 0, orig_key="image")
         tta(self.get_data(1, (20, 20), data_type=np.float32))
コード例 #2
0
 def test_single_transform(self):
     transforms = RandFlipd(["image", "label"])
     tta = TestTimeAugmentation(transforms,
                                batch_size=5,
                                num_workers=0,
                                inferrer_fn=lambda x: x)
     tta(self.get_data(1, (20, 20)))
コード例 #3
0
 def test_single_transform(self):
     for p in TEST_NDARRAYS:
         transforms = RandFlipd(["image", "label"], prob=1.0)
         tta = TestTimeAugmentation(transforms,
                                    batch_size=5,
                                    num_workers=0,
                                    inferrer_fn=lambda x: x)
         tta(self.get_data(1, (20, 20), data_type=p))
コード例 #4
0
 def test_image_no_label(self):
     transforms = RandFlipd(["image"], prob=1.0)
     tta = TestTimeAugmentation(transforms,
                                batch_size=5,
                                num_workers=0,
                                inferrer_fn=lambda x: x,
                                orig_key="image")
     tta(self.get_data(1, (20, 20), include_label=False))
コード例 #5
0
 def test_requires_meta_dict(self):
     transforms = Compose([RandFlipd("image"), Spacingd("image", (1, 1))])
     tta = TestTimeAugmentation(transforms,
                                batch_size=5,
                                num_workers=0,
                                inferrer_fn=lambda x: x,
                                label_key="image")
     tta(self.get_data(1, (20, 20), include_label=False))