Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@lazyattr
def is_lsm(self):
return self.pages[0].is_lsm
@lazyattr
def is_tiled(self):
"""True if page contains tiled image."""
return 'tile_width' in self.tags
@lazyattr
def attachment_directory(self):
"""Return list of all AttachmentEntryA1 in file.
Use AttachmentDirectorySegment if exists, else find AttachmentSegments.
"""
if self.header.attachment_directory_position:
segment = Segment(self._fh,
self.header.attachment_directory_position)
if segment.sid == AttachmentDirectorySegment.SID:
return segment.data().entries
warnings.warn("AttachmentDirectory segment not found")
return list(segment.attachment_entry for segment in
self.segments(AttachmentSegment.SID))
@lazyattr
def pixel_type(self):
return PIXEL_TYPE[self.dtype]
@lazyattr
def is_palette(self):
return all(p.is_palette for p in self.pages)
@lazyattr
def is_fluoview(self):
"""True if page contains FluoView MM_STAMP tag."""
return 'mm_stamp' in self.tags
@lazyattr
def dtype(self):
"""Return numpy dtype of image data in file."""
# subblock data can be of different pixel type
dtype = numpy.dtype(self.filtered_subblock_directory[0].dtype[-2:])
for directory_entry in self.filtered_subblock_directory:
dtype = numpy.promote_types(dtype, directory_entry.dtype[-2:])
return dtype
@lazyattr
def is_ome(self):
return self.pages[0].is_ome
@lazyattr
def is_nih(self):
return self.pages[0].is_nih
@lazyattr
def attachment_directory(self):
"""Return list of all AttachmentEntryA1 in file.
Use AttachmentDirectorySegment if exists, else find AttachmentSegments.
"""
if self.header.attachment_directory_position:
segment = Segment(self._fh,
self.header.attachment_directory_position)
if segment.sid == AttachmentDirectorySegment.SID:
return segment.data().entries
warnings.warn("AttachmentDirectory segment not found")
return list(segment.attachment_entry for segment in
self.segments(AttachmentSegment.SID))