Esempio n. 1
0
            medim_obj = MedImage.create_from_files(scan)
            file_name = medim_obj.name.split("/")[-1]
      
            image, brain_mask = medim_obj.compute_mask("{Brain}", "full", interp=True)
            _, ventricle_mask = medim_obj.compute_mask("{Ventricles}", "full", interp=True)
            _, brain_atlas = medim_obj.compute_mask("{BrainAtlas}", "full", interp=True)
            _, ventricle_atlas = medim_obj.compute_mask("{VentriclesAtlas}", "full", interp=True)

    
            raw_image = copy.deepcopy(image)
            raw_image = helper.z_pad(raw_image)
            raw_image = helper.xy_pad(raw_image)


            image.data = helper.normalize(image.data, brain_mask.data)
            image.data = helper.extract_brain(image.data, brain_mask.data)
            skull_stripped = helper.z_pad(image)
            skull_stripped = helper.xy_pad(skull_stripped)


            ventricle_mask = helper.z_pad(ventricle_mask)
            ventricle_mask = helper.xy_pad(ventricle_mask)

            brain_mask = helper.z_pad(brain_mask)
            brain_mask = helper.xy_pad(brain_mask)

            ventricle_atlas = helper.z_pad(ventricle_atlas)
            ventricle_atlas = helper.xy_pad(ventricle_atlas)

            brain_atlas = helper.z_pad(brain_atlas)
            brain_atlas = helper.xy_pad(brain_atlas)
Esempio n. 2
0
            image, brain_atlas = medim_obj.compute_mask("{Brain}",
                                                        "full",
                                                        interp=True)
            _, ventricle_atlas = medim_obj.compute_mask("{Ventricles}",
                                                        "full",
                                                        interp=True)

            raw_image = copy.deepcopy(image)
            raw_image = helper.z_pad(raw_image)
            raw_image = helper.xy_pad(raw_image)
            np.save(
                "/data/public/Segmentation_Dataset/MR_Dataset_Atlas/train/raw_images/{name}"
                .format(name=file_name), raw_image.data)

            image.data = helper.normalize(image.data, brain_atlas.data)
            image.data = helper.extract_brain(image.data, brain_atlas.data)
            skull_stripped = helper.z_pad(image)
            skull_stripped = helper.xy_pad(skull_stripped)

            np.save(
                "/data/public/Segmentation_Dataset/MR_Dataset_Atlas/train/skull_stripped/{name}"
                .format(name=file_name), skull_stripped.data)

            ventricle_atlas = helper.z_pad(ventricle_atlas)
            ventricle_atlas = helper.xy_pad(ventricle_atlas)

            np.save(
                "/data/public/Segmentation_Dataset/MR_Dataset_Atlas/train/ventricle_atlas/{name}"
                .format(name=file_name), ventricle_atlas.data)

            brain_atlas = helper.z_pad(brain_atlas)