Пример #1
0
    def test_should_create_multi_modality_train_test_datasets(self):
        train_dataset, test_dataset, reconstruction_dataset, = MRBrainSSliceDatasetFactory.create_train_test(
            self.DATA_PATH, [Modality.T1, Modality.T2_FLAIR], 0, 0.2)

        assert_that(train_dataset, instance_of(Dataset))
        assert_that(test_dataset, instance_of(Dataset))
        assert_that(reconstruction_dataset, instance_of(Dataset))
Пример #2
0
    def test_should_create_single_modality_train_valid_test_datasets(self):
        train_dataset, valid_dataset, test_dataset, reconstruction_dataset, = MRBrainSSliceDatasetFactory.create_train_valid_test(
            self.DATA_PATH, Modality.T1, 0, 0.2)

        assert_that(train_dataset, instance_of(Dataset))
        assert_that(valid_dataset, instance_of(Dataset))
        assert_that(test_dataset, instance_of(Dataset))
        assert_that(reconstruction_dataset, instance_of(Dataset))
Пример #3
0
    def test_should_produce_a_single_modality_input_with_one_channel(self):
        train_dataset, valid_dataset, test_dataset, reconstruction_dataset, = MRBrainSSliceDatasetFactory.create_train_valid_test(
            self.DATA_PATH, Modality.T1, 0, 0.2)

        sample = train_dataset[15000]

        assert_that(sample.x.size(), is_(torch.Size([1, 32, 32, 32])))
        plt.imshow(sample.x[0, 16, :, :], cmap="gray")
        plt.show()
        plt.imshow(sample.y[0, 16, :, :], cmap="gray")
        plt.show()
Пример #4
0
    def test_should_produce_a_multimodal_input_with_two_channels(self):
        train_dataset, test_dataset, reconstruction_dataset, = MRBrainSSliceDatasetFactory.create_train_test(
            self.DATA_PATH, [Modality.T1, Modality.T2_FLAIR], 0, 0.2)

        sample = train_dataset[15000]

        assert_that(sample.x.size(), is_(torch.Size([2, 32, 32, 32])))
        plt.imshow(sample.x[0, 16, :, :], cmap="gray")
        plt.show()
        plt.imshow(sample.x[1, 16, :, :], cmap="gray")
        plt.show()
        plt.imshow(sample.y[0, 16, :, :], cmap="gray")
        plt.show()
Пример #5
0
            test_patch_size=dataset_configs["iSEG"].test_patch_size,
            test_step=dataset_configs["iSEG"].test_step,
            data_augmentation_config=data_augmentation_config)
        train_datasets.append(iSEG_train)
        valid_datasets.append(iSEG_valid)
        test_datasets.append(iSEG_test)
        reconstruction_datasets.append(iSEG_reconstruction)

    if dataset_configs.get("MRBrainS", None) is not None:
        MRBrainS_train, MRBrainS_valid, MRBrainS_test, MRBrainS_reconstruction = MRBrainSSliceDatasetFactory.create_train_valid_test(
            source_dir=dataset_configs["MRBrainS"].path,
            modalities=dataset_configs["MRBrainS"].modalities,
            dataset_id=MRBRAINS_ID,
            test_size=dataset_configs["MRBrainS"].validation_split,
            max_subjects=dataset_configs["MRBrainS"].max_subjects,
            max_num_patches=dataset_configs["MRBrainS"].max_num_patches,
            augment=dataset_configs["MRBrainS"].augment,
            patch_size=dataset_configs["MRBrainS"].patch_size,
            step=dataset_configs["MRBrainS"].step,
            test_patch_size=dataset_configs["MRBrainS"].test_patch_size,
            test_step=dataset_configs["MRBrainS"].test_step,
            data_augmentation_config=data_augmentation_config)
        train_datasets.append(MRBrainS_train)
        valid_datasets.append(MRBrainS_valid)
        test_datasets.append(MRBrainS_test)
        reconstruction_datasets.append(MRBrainS_reconstruction)

    if dataset_configs.get("ABIDE", None) is not None:
        ABIDE_train, ABIDE_valid, ABIDE_test, ABIDE_reconstruction = ABIDESliceDatasetFactory.create_train_valid_test(
            source_dir=dataset_configs["ABIDE"].path,
            modalities=dataset_configs["ABIDE"].modalities,