How to use the miscnn.Data_Augmentation function in miscnn

To help you get started, we’ve selected a few miscnn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github frankkramer-lab / MIScnn / tests / test_dataaugmentation.py View on Github external
def test_DATAAUGMENTATION_parameter_gaussiannoise(self):
        data_aug = Data_Augmentation(cycles=1, scaling=False, rotations=False,
                          elastic_deform=False, mirror=False, brightness=False,
                          contrast=False, gamma=False, gaussian_noise=True)
        data_aug.config_p_per_sample = 1
        img_aug, seg_aug = data_aug.run(self.img3D, self.seg3D)
        self.assertFalse(np.array_equal(img_aug, self.img3D))
        self.assertTrue(np.array_equal(seg_aug, self.seg3D))
github frankkramer-lab / MIScnn / tests / test_dataaugmentation.py View on Github external
def test_DATAAUGMENTATION_parameter_edeform(self):
        data_aug = Data_Augmentation(cycles=1, scaling=False, rotations=False,
                          elastic_deform=True, mirror=False, brightness=False,
                          contrast=False, gamma=False, gaussian_noise=False)
        data_aug.config_p_per_sample = 1
        img_aug, seg_aug = data_aug.run(self.img3D, self.seg3D)
        self.assertFalse(np.array_equal(img_aug, self.img3D))
        self.assertFalse(np.array_equal(seg_aug, self.seg3D))
github frankkramer-lab / MIScnn / tests / test_dataaugmentation.py View on Github external
def test_DATAAUGMENTATION_BASE_run3D(self):
        data_aug = Data_Augmentation()
        data_aug.config_p_per_sample = 1
        img_aug, seg_aug = data_aug.run(self.img3D, self.seg3D)
        self.assertEqual(img_aug.shape, self.img3D.shape)
        self.assertFalse(np.array_equal(img_aug, self.img3D))
        self.assertEqual(seg_aug.shape, self.seg3D.shape)
        self.assertFalse(np.array_equal(seg_aug, self.seg3D))
        data_aug = Data_Augmentation(cycles=1, scaling=False, rotations=False,
                          elastic_deform=False, mirror=False, brightness=False,
                          contrast=False, gamma=False, gaussian_noise=False)
        img_aug, seg_aug = data_aug.run(self.img3D, self.seg3D)
        self.assertTrue(np.array_equal(img_aug, self.img3D))
github frankkramer-lab / MIScnn / tests / test_dataaugmentation.py View on Github external
def test_DATAAUGMENTATION_parameter_cropping(self):
        data_aug = Data_Augmentation(cycles=1, scaling=False, rotations=False,
                          elastic_deform=False, mirror=False, brightness=False,
                          contrast=False, gamma=False, gaussian_noise=False)
        data_aug.cropping = True
        data_aug.cropping_patch_shape = (4,4,4)
        img_aug, seg_aug = data_aug.run(self.img3D, self.seg3D)
        self.assertEqual(img_aug.shape, (1,4,4,4,1))
        self.assertEqual(seg_aug.shape, (1,4,4,4,3))
github frankkramer-lab / MIScnn / tests / test_dataaugmentation.py View on Github external
def test_DATAAUGMENTATION_parameter_gamma(self):
        data_aug = Data_Augmentation(cycles=1, scaling=False, rotations=False,
                          elastic_deform=False, mirror=False, brightness=False,
                          contrast=False, gamma=True, gaussian_noise=False)
        data_aug.config_p_per_sample = 1
        img_aug, seg_aug = data_aug.run(self.img3D, self.seg3D)
        self.assertFalse(np.array_equal(img_aug, self.img3D))
        self.assertTrue(np.array_equal(seg_aug, self.seg3D))
github frankkramer-lab / MIScnn / tests / test_dataaugmentation.py View on Github external
def test_DATAAUGMENTATION_BASE_create(self):
        data_Aug = Data_Augmentation()
        self.assertIsInstance(data_Aug, Data_Augmentation)
        Data_Augmentation(cycles=5)
        Data_Augmentation(cycles=1, scaling=True, rotations=True,
                          elastic_deform=False, mirror=False, brightness=True,
                          contrast=True, gamma=True, gaussian_noise=True)
    # Run 2D
github frankkramer-lab / MIScnn / tests / test_dataaugmentation.py View on Github external
def test_DATAAUGMENTATION_BASE_create(self):
        data_Aug = Data_Augmentation()
        self.assertIsInstance(data_Aug, Data_Augmentation)
        Data_Augmentation(cycles=5)
        Data_Augmentation(cycles=1, scaling=True, rotations=True,
                          elastic_deform=False, mirror=False, brightness=True,
                          contrast=True, gamma=True, gaussian_noise=True)
    # Run 2D
github frankkramer-lab / MIScnn / tests / test_dataaugmentation.py View on Github external
def test_DATAAUGMENTATION_parameter_mirror(self):
        data_aug = Data_Augmentation(cycles=1, scaling=False, rotations=False,
                          elastic_deform=False, mirror=True, brightness=False,
                          contrast=False, gamma=False, gaussian_noise=False)
        data_aug.config_p_per_sample = 1
        img_aug, seg_aug = data_aug.run(self.img3D, self.seg3D)
        self.assertFalse(np.array_equal(img_aug, self.img3D))
        self.assertFalse(np.array_equal(seg_aug, self.seg3D))
github frankkramer-lab / MIScnn / tests / test_dataaugmentation.py View on Github external
def test_DATAAUGMENTATION_parameter_classification(self):
        data_aug = Data_Augmentation()
        data_aug.config_p_per_sample = 1
        data_aug.seg_augmentation = False
        img_aug, seg_aug = data_aug.run(self.img3D, self.seg3D)
        self.assertFalse(np.array_equal(img_aug, self.img3D))
        self.assertTrue(np.array_equal(seg_aug, self.seg3D))
github frankkramer-lab / MIScnn / tests / test_dataaugmentation.py View on Github external
def test_DATAAUGMENTATION_parameter_contrast(self):
        data_aug = Data_Augmentation(cycles=1, scaling=False, rotations=False,
                          elastic_deform=False, mirror=False, brightness=False,
                          contrast=True, gamma=False, gaussian_noise=False)
        data_aug.config_p_per_sample = 1
        img_aug, seg_aug = data_aug.run(self.img3D, self.seg3D)
        self.assertFalse(np.array_equal(img_aug, self.img3D))
        self.assertTrue(np.array_equal(seg_aug, self.seg3D))