Beispiel #1
0
    def get_segmentation_mask_image(self, image_api=None):

        if image_api is None:
            image_api = ImageApi

        segmentation_mask_image_file = self.get_segmentation_mask_image_file()
        pixel_size = self.get_surface_2p_pixel_size_um()
        segmentation_mask_image = mpimg.imread(segmentation_mask_image_file)
        return ImageApi.serialize(segmentation_mask_image, [pixel_size / 1000., pixel_size / 1000.], 'mm')
Beispiel #2
0
    def get_max_projection(self, image_api=None):

        if image_api is None:
            image_api = ImageApi

        maxInt_a13_file = self.get_max_projection_file()
        pixel_size = self.get_surface_2p_pixel_size_um()
        max_projection = mpimg.imread(maxInt_a13_file)
        return ImageApi.serialize(max_projection, [pixel_size / 1000., pixel_size / 1000.], 'mm')
Beispiel #3
0
def get_image(nwbfile: NWBFile, name: str, module: str) -> Image:
    nwb_img = nwbfile.processing[module].get_data_interface('images')[name]
    data = nwb_img.data
    resolution = nwb_img.resolution  # px/cm
    spacing = [resolution * 10, resolution * 10]

    img = ImageApi.serialize(data, spacing, 'mm')
    img = ImageApi.deserialize(img=img)
    return img
Beispiel #4
0
    def get_average_projection(self, image_api=None):

        if image_api is None:
            image_api = ImageApi

        avgint_a1X_file = (
            self.extractor.get_average_intensity_projection_image_file())
        pixel_size = self.extractor.get_surface_2p_pixel_size_um()
        average_image = mpimg.imread(avgint_a1X_file)
        return ImageApi.serialize(average_image, [pixel_size / 1000.,
                                                  pixel_size / 1000.], 'mm')
Beispiel #5
0
    def get_image(self, name, module, image_api=None) -> sitk.Image:

        if image_api is None:
            image_api = ImageApi

        nwb_img = self.nwbfile.modules[module].get_data_interface(
            'images')[name]
        data = nwb_img.data
        resolution = nwb_img.resolution  # px/cm
        spacing = [resolution * 10, resolution * 10]

        return ImageApi.serialize(data, spacing, 'mm')
Beispiel #6
0
 def _from_filepath(filepath: str, pixel_size: float) -> Image:
     """
     :param filepath
         path to image
     :param pixel_size
         pixel size in um
     """
     img = mpimg.imread(filepath)
     img = ImageApi.serialize(img, [pixel_size / 1000., pixel_size / 1000.],
                              'mm')
     img = ImageApi.deserialize(img=img)
     return img
Beispiel #7
0
 def get_max_projection(self):
     return ImageApi.serialize(roi_1 + roi_2, [0.5, 1.], 'mm')
 def get_segmentation_mask_image(self):
     data = roi_1 #useless image data here
     spacing = (1, 1)
     unit = 'index'
     return ImageApi.serialize(data, spacing, unit)