navigate.model.metadata_sources.bdv_metadata.BigDataViewerMetadata
- class navigate.model.metadata_sources.bdv_metadata.BigDataViewerMetadata
Bases:
XMLMetadata
Metadata for BigDataViewer files.
Note
XML spec in section 2.3 of https://arxiv.org/abs/1412.0488.
- __init__() → None
Initialize the BigDataViewer metadata object.
Methods
__init__
()Initialize the BigDataViewer metadata object.
Convert affine matrix back into stage positions.
Calculate the BDV rotation transform matrix.
Calculate the shear transform matrix.
bdv_xml_dict
(file_name, views, **kw)Create a BigDataViewer XML dictionary from a list of views.
get_affine_parameters
(configuration)Get the affine transform parameters from the configuration file.
parse_xml
(root)Parse a BigDataViewer XML file into our metadata format.
Set from configuration experiment
set_from_dict
(metadata_config)Set from a dictionary
Set shape from configuration experiment
Set stack order from configuration experiment
stage_positions_to_affine_matrix
(x, y, z, theta)Convert stage positions to an affine matrix.
to_xml
(file_type[, root])Convert stored metadata to XML
write_xml
(file_name, views)Write BigDataViewer XML metadata.
Attributes
Return configuration dictionary
Return per stack
Return shape as XYCZT.
Return voxel size
Shear the data.
Dimension to shear the data.
Angle in degrees to shear the data.
Shear transform matrix.
Rotate the data.
Angle in degrees to rotate the data in X.
Angle in degrees to rotate the data in Y.
Angle in degrees to rotate the data in Z.
Rotation transform matrix.
- affine_matrix_to_stage_positions(mat: Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]) → tuple
Convert affine matrix back into stage positions.
Ignore theta, focus for now.
- Parameters:
mat (npt.ArrayLike) – An affine matrix.
- Returns:
A tuple of stage positions.
- Return type:
tuple
- bdv_rotate_transform()
Calculate the BDV rotation transform matrix.
BDV-specific. Matrix provided is not (4,4), but (3,4).
- bdv_shear_transform()
Calculate the shear transform matrix.
BDV-specific. Matrix provided is not (4,4), but (3,4).
- bdv_xml_dict(file_name: Optional[Union[str, list]], views: list, **kw) → dict
Create a BigDataViewer XML dictionary from a list of views.
- Parameters:
file_name (str) – The file name of the file to be written.
views (list) – A list of dictionaries containing metadata for each view.
**kw – Additional keyword arguments.
- Returns:
A dictionary containing the XML metadata.
- Return type:
dict
- get_affine_parameters(configuration)
Get the affine transform parameters from the configuration file.
- Parameters:
configuration (dict) – Configuration dictionary.
- parse_xml(root: Union[str, Element]) → tuple
Parse a BigDataViewer XML file into our metadata format.
- Parameters:
root (Union[str, ET.Element]) – The root of the XML tree.
- Returns:
A tuple containing the file path, setups, and transforms.
- Return type:
tuple
- set_from_configuration_experiment() → None
Set from configuration experiment
- set_from_dict(metadata_config: dict) → None
Set from a dictionary
- Parameters:
metadata_config (dict) – dictionary of metadata: “c”, “z”, “t”, “p”, “is_dynamic”, “per_stack”
- set_shape_from_configuration_experiment() → None
Set shape from configuration experiment
- set_stack_order_from_configuration_experiment() → None
Set stack order from configuration experiment
- stage_positions_to_affine_matrix(x: float, y: float, z: float, theta: float, f: Optional[float] = None) → Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]
Convert stage positions to an affine matrix.
Ignore theta, focus for now.
- Parameters:
x (float) – The x position of the stage.
y (float) – The y position of the stage.
z (float) – The z position of the stage.
theta (float) – The theta position of the stage.
f (Optional[float]) – The focus position of the stage, by default None
- Returns:
An affine matrix.
- Return type:
npt.ArrayLike
- to_xml(file_type: str, root: Optional[str] = None, **kw) → str
Convert stored metadata to XML
- Parameters:
file_type (str) – File type
root (Optional[str]) – Root, by default None
**kw – Keyword arguments
- Returns:
XML string
- Return type:
str
- write_xml(file_name: str, views: list) → None
Write BigDataViewer XML metadata.
- Parameters:
file_name (str) – The file name of the file to be written.
views (list) – A list of dictionaries containing metadata for each view.
- active_microscope
Active microscope
- Type:
str
- property configuration: Optional[DictProxy]
Return configuration dictionary
- Returns:
configuration – Configuration dictionary
- Return type:
Optional[DictProxy]
- dc
Step size between channels, should always be 1
- Type:
int
- dt
Time displacement (s)
- Type:
float
- dx
Pixel size in x (um) float: Pixel size in y (um) float: Pixel size in z (um)
- Type:
float
- dy
Pixel size in x (um) float: Pixel size in y (um) float: Pixel size in z (um)
- Type:
float
- dz
Pixel size in x (um) float: Pixel size in y (um) float: Pixel size in z (um)
- Type:
float
- property per_stack: bool
Return per stack
- Returns:
True if per stack, False otherwise
- Return type:
bool
- positions
Number of positions
- Type:
int
- rotate_angle_x
Angle in degrees to rotate the data in X.
- Type:
float
- rotate_angle_y
Angle in degrees to rotate the data in Y.
- Type:
float
- rotate_angle_z
Angle in degrees to rotate the data in Z.
- Type:
float
- rotate_data
Rotate the data.
- Type:
bool
- rotate_transform
Rotation transform matrix.
- Type:
npt.NDArray
- property shape: tuple
Return shape as XYCZT.
- Returns:
Shape as XYCZT
- Return type:
tuple
- shape_c
Shape of the data in x int: Shape of the data in y int: Shape of the data in z int: Shape of the data in t int: Shape of the data in c
- Type:
int
- shape_t
Shape of the data in x int: Shape of the data in y int: Shape of the data in z int: Shape of the data in t int: Shape of the data in c
- Type:
int
- shape_x
Shape of the data in x int: Shape of the data in y int: Shape of the data in z int: Shape of the data in t int: Shape of the data in c
- Type:
int
- shape_y
Shape of the data in x int: Shape of the data in y int: Shape of the data in z int: Shape of the data in t int: Shape of the data in c
- Type:
int
- shape_z
Shape of the data in x int: Shape of the data in y int: Shape of the data in z int: Shape of the data in t int: Shape of the data in c
- Type:
int
- shear_angle
Angle in degrees to shear the data.
- Type:
float
- shear_data
Shear the data.
- Type:
bool
- shear_dimension
Dimension to shear the data.
- Type:
str
- shear_transform
Shear transform matrix.
- Type:
npt.NDArray
- property voxel_size: tuple
Return voxel size
- Returns:
Voxel size
- Return type:
tuple