nd2.structures
¶
Dataclasses and other structures used for metadata.
Classes:
-
AnimParam–Parameters of ROI position/shape.
-
Attributes–Primary attributes of an ND2 file.
-
BoxShape–Size of a 3D box.
-
Channel–Structure of a channel in an ND2 file.
-
ChannelMeta–Metadata for a channel in an ND2 file.
-
Color–RGB color with optional alpha channel.
-
Contents–Contents of an ND2 file metadata.
-
CustomLoop–Custom loop in an experiment.
-
ExperimentEvent–An event in an experiment.
-
ExtrudedShape–Shape of an extruded object.
-
FrameChannel–Channel metadata for a frame.
-
FrameMetadata–Metadata of a frame in an ND2 file.
-
InterpType–The role that the ROI plays.
-
LoopIndices–Indices of loops in an channel.
-
LoopType–Type of loop in an experiment.
-
Metadata–Metadata of an ND2 file.
-
Microscope–Microscope metadata.
-
NETimeLoop–The time dimension of an nD experiment.
-
NETimeLoopParams–Parameters associated with a time loop in an nD experiment.
-
Period–A phase in an nD experiment.
-
PeriodDiff–Time difference between periods in a time loop.
-
Position–A position in an XY position loop.
-
ROI–ROI object from NIS Elements.
-
RoiInfo–Info associated with an ROI.
-
RoiShapeType–The type of ROI shape.
-
ScopeType–Scope of an ROI.
-
StagePosition–A position in stage coordinates.
-
StimulationEvent–Stimulation parameters for an experiment event.
-
TextInfo–Structure of
dictreturned byND2File.text_info. -
TimeLoop–The time dimension of an experiment.
-
TimeLoopParams–Parameters associated with a time loop.
-
TimeStamp–Absolute and relative timestamp of a frame.
-
Volume–Volume metadata.
-
XYPoint–XY coordinate.
-
XYPosLoop–A loop over XY positions in an experiment.
-
XYPosLoopParams–Parameters associated with a XY position loop.
-
XYZPoint–XYZ coordinate.
-
ZStackLoop–A loop over Z positions in an experiment.
-
ZStackLoopParams–Parameters associated with a Z stack loop.
Attributes:
-
ExpLoop–Union of loop types in an experiment.
-
LoopParams–Type of parameters associated with a loop in an experiment.
-
ModalityFlags–Flags indicating the modality of a microscope.
ExpLoop
module-attribute
¶
ExpLoop = Union[
TimeLoop, NETimeLoop, XYPosLoop, ZStackLoop, CustomLoop
]
Union of loop types in an experiment.
ND2File.experiment returns a list of these.
LoopParams
module-attribute
¶
LoopParams = Union[
TimeLoopParams,
NETimeLoopParams,
XYPosLoopParams,
ZStackLoopParams,
]
Type of parameters associated with a loop in an experiment.
ModalityFlags
module-attribute
¶
ModalityFlags = Literal[
"aux",
"brightfield",
"camera",
"diContrast",
"dsdConfocal",
"fluorescence",
"gaasp",
"iSIM",
"laserScanConfocal",
"liveSR",
"multiphoton",
"nonDescannedDetector",
"phaseContrast",
"pmt",
"RCM",
"remainder",
"SIM",
"sora",
"spectral",
"spinningDiskConfocal",
"sweptFieldConfocalPinhole",
"sweptFieldConfocalSlit",
"TIRF",
"transmitDetector",
"vaasIF",
"vaasNF",
"VCS",
"virtualFilter",
]
Flags indicating the modality of a microscope.
AnimParam
dataclass
¶
AnimParam(
timeMs: float = 0,
enabled: bool = True,
centerX: float = 0,
centerY: float = 0,
centerZ: float = 0,
rotationZ: float = 0,
boxShape: BoxShape = BoxShape(),
extrudedShape: ExtrudedShape = ExtrudedShape(),
)
Attributes
¶
BoxShape
¶
Size of a 3D box.
Channel
dataclass
¶
Channel(
channel: ChannelMeta,
loops: LoopIndices | None,
microscope: Microscope,
volume: Volume,
)
Structure of a channel in an ND2 file.
ChannelMeta
dataclass
¶
Color
¶
RGB color with optional alpha channel.
Methods:
-
as_abgr_u4–Return color as an unsigned 4-byte (32-bit) integer in ABGR format.
-
as_hex–Return color as a hex string.
-
from_abgr_u4–Create a color from an unsigned 4-byte (32-bit) integer in ABGR format.
as_abgr_u4
¶
as_abgr_u4() -> int
Return color as an unsigned 4-byte (32-bit) integer in ABGR format.
This is the native format of NIS Elements.
Source code in src/nd2/structures.py
338 339 340 341 342 343 344 345 | |
as_hex
¶
as_hex() -> str
Return color as a hex string.
Source code in src/nd2/structures.py
322 323 324 | |
from_abgr_u4
classmethod
¶
Create a color from an unsigned 4-byte (32-bit) integer in ABGR format.
Source code in src/nd2/structures.py
326 327 328 329 330 331 332 333 334 335 336 | |
CustomLoop
dataclass
¶
CustomLoop(
count: int,
nestingLevel: int = 0,
parameters: None = None,
type: Literal["CustomLoop"] = "CustomLoop",
)
Custom loop in an experiment.
ExperimentEvent
dataclass
¶
ExperimentEvent(
id: int = 0,
time: float = 0.0,
time2: float = 0.0,
meaning: EventMeaning = Unspecified,
description: str = "",
data: str = "",
stimulation: StimulationEvent | None = None,
)
An event in an experiment.
ExtrudedShape
¶
Shape of an extruded object.
FrameChannel
dataclass
¶
FrameChannel(
channel: ChannelMeta,
loops: LoopIndices | None,
microscope: Microscope,
volume: Volume,
position: Position,
time: TimeStamp,
)
Channel metadata for a frame.
FrameMetadata
dataclass
¶
FrameMetadata(
contents: Contents, channels: list[FrameChannel]
)
InterpType
¶
The role that the ROI plays.
LoopIndices
dataclass
¶
LoopIndices(
NETimeLoop: int | None = None,
TimeLoop: int | None = None,
XYPosLoop: int | None = None,
ZStackLoop: int | None = None,
CustomLoop: int | None = None,
)
Indices of loops in an channel.
LoopType
¶
Type of loop in an experiment.
Metadata
dataclass
¶
Microscope
dataclass
¶
Microscope(
objectiveMagnification: float | None = None,
objectiveName: str | None = None,
objectiveNumericalAperture: float | None = None,
zoomMagnification: float | None = None,
immersionRefractiveIndex: float | None = None,
projectiveMagnification: float | None = None,
pinholeDiameterUm: float | None = None,
modalityFlags: list[ModalityFlags] = list(),
)
Microscope metadata.
NETimeLoop
dataclass
¶
NETimeLoop(
count: int,
nestingLevel: int,
parameters: NETimeLoopParams,
type: Literal["NETimeLoop"] = "NETimeLoop",
)
The time dimension of an nD experiment.
NETimeLoopParams
dataclass
¶
Parameters associated with a time loop in an nD experiment.
Period
dataclass
¶
Period(
startMs: float,
periodMs: float,
durationMs: float,
periodDiff: PeriodDiff,
count: int,
)
A phase in an nD experiment.
PeriodDiff
dataclass
¶
Time difference between periods in a time loop.
Position
dataclass
¶
Position(
stagePositionUm: StagePosition,
pfsOffset: float | None = None,
name: str | None = None,
)
A position in an XY position loop.
ROI
dataclass
¶
ROI object from NIS Elements.
RoiInfo
dataclass
¶
RoiInfo(
shapeType: RoiShapeType,
interpType: InterpType,
cookie: int = 0,
color: int = 255,
label: str = "",
stimulationGroup: int = 0,
scope: ScopeType = Global,
appData: int = 0,
multiFrame: bool = False,
locked: bool = False,
compCount: int = 2,
bpc: int = 16,
autodetected: bool = False,
gradientStimulation: bool = False,
gradientStimulationBitDepth: int = 0,
gradientStimulationLo: float = 0.0,
gradientStimulationHi: float = 0.0,
)
Info associated with an ROI.
RoiShapeType
¶
The type of ROI shape.
ScopeType
¶
Scope of an ROI.
StagePosition
¶
A position in stage coordinates.
StimulationEvent
dataclass
¶
StimulationEvent(
type: StimulationType = NoStimulation,
loop_index: int = 0,
position: int = 0,
description: str = "",
)
Stimulation parameters for an experiment event.
TextInfo
¶
Structure of dict returned by ND2File.text_info.
TimeLoop
dataclass
¶
TimeLoop(
count: int,
nestingLevel: int,
parameters: TimeLoopParams,
type: Literal["TimeLoop"] = "TimeLoop",
)
The time dimension of an experiment.
TimeLoopParams
dataclass
¶
TimeLoopParams(
startMs: float,
periodMs: float,
durationMs: float,
periodDiff: PeriodDiff,
)
Parameters associated with a time loop.
TimeStamp
dataclass
¶
Absolute and relative timestamp of a frame.
Volume
dataclass
¶
Volume(
axesCalibrated: tuple[bool, bool, bool],
axesCalibration: tuple[float, float, float],
axesInterpretation: tuple[
AxisInterpretation,
AxisInterpretation,
AxisInterpretation,
],
bitsPerComponentInMemory: int,
bitsPerComponentSignificant: int,
cameraTransformationMatrix: tuple[
float, float, float, float
],
componentCount: int,
componentDataType: Literal["unsigned", "float"],
voxelCount: tuple[int, int, int],
componentMaxima: list[float] | None = None,
componentMinima: list[float] | None = None,
pixelToStageTransformationMatrix: tuple[
float, float, float, float, float, float
]
| None = None,
)
Volume metadata.
XYPoint
¶
XY coordinate.
XYPosLoop
dataclass
¶
XYPosLoop(
count: int,
nestingLevel: int,
parameters: XYPosLoopParams,
type: Literal["XYPosLoop"] = "XYPosLoop",
)
A loop over XY positions in an experiment.
XYPosLoopParams
dataclass
¶
Parameters associated with a XY position loop.
XYZPoint
¶
XYZ coordinate.
ZStackLoop
dataclass
¶
ZStackLoop(
count: int,
nestingLevel: int,
parameters: ZStackLoopParams,
type: Literal["ZStackLoop"] = "ZStackLoop",
)
A loop over Z positions in an experiment.