Esempio n. 1
0
    def ukbb_sax_transform(self):

        train_transform = ts.Compose([
            ts.PadNumpy(size=self.scale_size),
            ts.ToTensor(),
            ts.ChannelsFirst(),
            ts.TypeCast(['float', 'float']),
            ts.RandomFlip(h=True, v=True, p=self.random_flip_prob),
            ts.RandomAffine(rotation_range=self.rotate_val,
                            translation_range=self.shift_val,
                            zoom_range=self.scale_val,
                            interp=('bilinear', 'nearest')),
            ts.NormalizeMedicPercentile(norm_flag=(True, False)),
            ts.RandomCrop(size=self.patch_size),
            ts.TypeCast(['float', 'long'])
        ])

        valid_transform = ts.Compose([
            ts.PadNumpy(size=self.scale_size),
            ts.ToTensor(),
            ts.ChannelsFirst(),
            ts.TypeCast(['float', 'float']),
            ts.NormalizeMedicPercentile(norm_flag=(True, False)),
            ts.SpecialCrop(size=self.patch_size, crop_type=0),
            ts.TypeCast(['float', 'long'])
        ])

        return {'train': train_transform, 'valid': valid_transform}
Esempio n. 2
0
    def test_3d_sax_transform(self):
        test_transform = ts.Compose([
            ts.PadFactorNumpy(factor=self.division_factor),
            ts.ToTensor(),
            ts.ChannelsFirst(),
            ts.TypeCast(['float']),
            #ts.NormalizeMedicPercentile(norm_flag=True),
            ts.NormalizeMedic(norm_flag=True),
            ts.ChannelsLast(),
            ts.AddChannel(axis=0),
        ])

        return {'test': test_transform}
Esempio n. 3
0
    def ultrasound_transform(self):

        train_transform = ts.Compose([
            ts.ToTensor(),
            ts.TypeCast(['float']),
            ts.AddChannel(axis=0),
            ts.SpecialCrop(self.patch_size, 0),
            ts.RandomFlip(h=True, v=False, p=self.random_flip_prob),
            ts.RandomAffine(rotation_range=self.rotate_val,
                            translation_range=self.shift_val,
                            zoom_range=self.scale_val,
                            interp=('bilinear')),
            ts.StdNormalize(),
        ])

        valid_transform = ts.Compose([
            ts.ToTensor(),
            ts.TypeCast(['float']),
            ts.AddChannel(axis=0),
            ts.SpecialCrop(self.patch_size, 0),
            ts.StdNormalize(),
        ])

        return {'train': train_transform, 'valid': valid_transform}
Esempio n. 4
0
    def hms_sax_transform(self):

        # Training transformation
        # 2D Stack input - 3D High Resolution output segmentation

        train_transform = []
        valid_transform = []

        # First pad to a fixed size
        # Torch tensor
        # Channels first
        # Joint affine transformation
        # In-plane respiratory motion artefacts (translation and rotation)
        # Random Crop
        # Normalise the intensity range
        train_transform = ts.Compose([])

        return {'train': train_transform, 'valid': valid_transform}