def get_image(self, coordinate): index = 0 zslice = coordinate.zslice if self.has_multi_images and self.multi_image == self.MULTIIMAGE_USE_ZSLICE: index = zslice - 1 zslice = None filename_rel = self.dimension_lookup[coordinate.position][coordinate.time][coordinate.channel][zslice] filename_abs = os.path.join(self.path, filename_rel) # make sure no back-slashes are left in the path filename_abs = filename_abs.replace("\\", "/") if self.meta_data.pixel_type == PixelType.name(PixelType.Uint8): image = ccore.readImage(filename_abs, index) elif self.meta_data.pixel_type == PixelType.name(PixelType.Uint16): image = ccore.readImageUInt16(filename_abs, index) else: image = ccore.readImageUInt16(filename_abs, index) return image
def set_image_info(self, info): self.dim_x = info.width self.dim_y = info.height self.real_image_width = info.width self.real_image_height = info.height # ccore returns upper case type names, numpy is lower case ptype = info.pixel_type.lower() if not PixelType.is_valid(ptype): raise TypeError('Pixel type is not understood') self.pixel_type = ptype
def get_image(self, coordinate): index = 0 zslice = coordinate.zslice if (self.has_multi_images and self.multi_image == self.MULTIIMAGE_USE_ZSLICE): index = zslice - 1 zslice = None filename_rel = self.dimension_lookup[coordinate.position] \ [coordinate.time] \ [coordinate.channel] \ [zslice] filename_abs = os.path.join(self.path, filename_rel) # make sure no back-slashes are left in the path filename_abs = filename_abs.replace('\\', '/') if self.meta_data.pixel_type == PixelType.name(PixelType.Uint8): image = ccore.readImage(filename_abs, index) elif self.meta_data.pixel_type == PixelType.name(PixelType.Uint16): image = ccore.readImageUInt16(filename_abs, index) else: image = ccore.readImageUInt16(filename_abs, index) return image
def pixel_range(self): return PixelType.range(self.pixel_type)