Attributes module¶
ImageAttributes
dataclass
¶
ImageAttributes(*, uiWidth: int = LV_field(0, UINT32), uiWidthBytes: int = LV_field(0, UINT32), uiHeight: int = LV_field(0, UINT32), uiComp: int = LV_field(0, UINT32), uiBpcInMemory: int = LV_field(0, INT32), uiBpcSignificant: int = LV_field(0, INT32), uiSequenceCount: int = LV_field(0, UINT32), uiTileWidth: int = LV_field(0, UINT32), uiTileHeight: int = LV_field(0, UINT32), eCompression: ImageAttributesCompression = LV_field(ictNone, INT32), dCompressionParam: float = LV_field(0.0, DOUBLE), ePixelType: ImageAttributesPixelType = LV_field(pxtUnsigned, INT32), uiVirtualComponents: int = LV_field(0, UINT32))
Dataclass for ND2 Image attributes chunk, stores mostly information about image width, height, number of components and bit depth of each pixel, as well as information about compression and total number of images.
downsampleLevels
cached
property
¶
Returns list containing levels of downsampled images up to ND2_MIN_DOWNSAMPLED_SIZE.
safe_dtype
property
¶
Returns numpy datatype that will always be big enough to fit pixel component data.
shape
property
¶
Returns shape of the image which can be used with in array (height_pixels, width_pixels, component_count)
strides
property
¶
Returns the strides of the image which can be used in numpy array
calcWidthBytes
staticmethod
¶
Calculates number of bytes per single image row.
create
staticmethod
¶
create(height: int, width: int, component_count: int, bits: int, sequence_count: int) -> ImageAttributes
Warning
This function is used for creating new ImageAttributes instance, usually for creating new .nd2 files with Nd2Writer class.
Do not use this function if you only read .nd2 file.
Create ImageAttributes instance from following arguments (all must be passed as named arguments)
| PARAMETER | DESCRIPTION |
|---|---|
height
|
height in pixels
TYPE:
|
width
|
width in pixels
TYPE:
|
component_count
|
number of components
TYPE:
|
bits
|
number of bits per pixel component
TYPE:
|
sequence_count
|
total number of frames in ND2 file (product of size of each dimension)
TYPE:
|
findDownsampledLevelFor ¶
Returns downsample level for given size.
from_lv
staticmethod
¶
from_lv(data: bytes | memoryview) -> ImageAttributes
Decodes ImageAttributes from ND2 lite variant chunk.
from_var
staticmethod
¶
from_var(data: bytes | memoryview) -> ImageAttributes
Decodes ImageAttributes from ND2 XML chunk.
makeDownsampled ¶
makeDownsampled(downsample_level: int = 1) -> ImageAttributes
Returns ImageAttributes for downsampled image.
downsample_level: int Determines downsampling d = 2^downsample_level that produces lower level frames of size (w // d, h // d).
ImageAttributesCompression ¶
Enum for image compression.
ImageAttributesPixelType ¶
Enum for pixel type.