dacapo.experiments.datasplits.datasets.arrays.logical_or_array
Classes
Array that computes the logical OR of the instances in a list of source arrays. |
Module Contents
- class dacapo.experiments.datasplits.datasets.arrays.logical_or_array.LogicalOrArray(array_config)
Array that computes the logical OR of the instances in a list of source arrays.
- name
str The name of the array
- source_array
Array The source array from which to take the logical OR
- axes()
() -> List[str] Get the axes of the array
- dims()
() -> int Get the number of dimensions of the array
- voxel_size()
() -> Coordinate Get the voxel size of the array
- roi()
() -> Roi Get the region of interest of the array
- writable()
() -> bool Get whether the array is writable
- dtype()
() -> type Get the data type of the array
- num_channels()
() -> int Get the number of channels in the array
- data()
() -> np.ndarray Get the data of the array
- attrs()
() -> dict Get the attributes of the array
- __getitem__()
(roi: Roi) -> np.ndarray Get the data of the array in the region of interest
- _can_neuroglance()
() -> bool Get whether the array can be visualized in neuroglance
- _neuroglancer_source()
() -> dict Get the neuroglancer source of the array
- _neuroglancer_layer()
() -> Tuple[neuroglancer.Layer, dict] Get the neuroglancer layer of the array
- _source_name()
() -> str Get the name of the source array
Notes
The LogicalOrArray class is used to create a LogicalOrArray. The LogicalOrArray class is a subclass of the Array class.
- name
- property axes
- Get the axes of the array
- Returns:
The axes of the array
- Return type:
List[str]
- Raises:
ValueError – If the array is not writable
Examples
>>> array_config = MergeInstancesArrayConfig( ... name="logical_or", ... source_array_configs=[ ... ArrayConfig( ... name="mask1", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask1", ... mask_id=1, ... ), ... ), ... ArrayConfig( ... name="mask2", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask2", ... mask_id=2, ... ), ... ), ... ], ... ) >>> array = array_config.create_array() >>> array.axes ['x', 'y', 'z']
Notes
The axes method is used to get the axes of the array. The axes are the dimensions of the array.
- property dims: int
Get the number of dimensions of the array
- Returns:
The number of dimensions of the array
- Return type:
int
- Raises:
ValueError – If the array is not writable
Examples
>>> array_config = MergeInstancesArrayConfig( ... name="logical_or", ... source_array_configs=[ ... ArrayConfig( ... name="mask1", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask1", ... mask_id=1, ... ), ... ), ... ArrayConfig( ... name="mask2", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask2", ... mask_id=2, ... ), ... ), ... ], ... ) >>> array = array_config.create_array() >>> array.dims 3
Notes
The dims method is used to get the number of dimensions of the array. The number of dimensions is the number of axes of the array.
- property voxel_size: funlib.geometry.Coordinate
Get the voxel size of the array
- Returns:
The voxel size of the array
- Return type:
Coordinate
- Raises:
ValueError – If the array is not writable
Examples
>>> array_config = MergeInstancesArrayConfig( ... name="logical_or", ... source_array_configs=[ ... ArrayConfig( ... name="mask1", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask1", ... mask_id=1, ... ), ... ), ... ArrayConfig( ... name="mask2", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask2", ... mask_id=2, ... ), ... ), ... ], ... ) >>> array = array_config.create_array() >>> array.voxel_size Coordinate(x=1.0, y=1.0, z=1.0)
Notes
The voxel_size method is used to get the voxel size of the array. The voxel size is the size of a voxel in the array.
- property roi: funlib.geometry.Roi
Get the region of interest of the array
- Returns:
The region of interest of the array
- Return type:
Roi
- Raises:
ValueError – If the array is not writable
Examples
>>> array_config = MergeInstancesArrayConfig( ... name="logical_or", ... source_array_configs=[ ... ArrayConfig( ... name="mask1", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask1", ... mask_id=1, ... ), ... ), ... ArrayConfig( ... name="mask2", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask2", ... mask_id=2, ... ), ... ), ... ], ... ) >>> array = array_config.create_array() >>> array.roi Roi(offset=(0, 0, 0), shape=(10, 10, 10))
Notes
The roi method is used to get the region of interest of the array. The region of interest is the shape and offset of the array.
- property writable: bool
Get whether the array is writable
- Returns:
Whether the array is writable
- Return type:
bool
- Raises:
ValueError – If the array is not writable
Examples
>>> array_config = MergeInstancesArrayConfig( ... name="logical_or", ... source_array_configs=[ ... ArrayConfig( ... name="mask1", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask1", ... mask_id=1, ... ), ... ), ... ArrayConfig( ... name="mask2", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask2", ... mask_id=2, ... ), ... ), ... ], ... ) >>> array = array_config.create_array() >>> array.writable False
Notes
The writable method is used to get whether the array is writable. An array is writable if it can be modified.
- property dtype
- Get the data type of the array
- Returns:
The data type of the array
- Return type:
type
- Raises:
ValueError – If the array is not writable
Examples
>>> array_config = MergeInstancesArrayConfig( ... name="logical_or", ... source_array_configs=[ ... ArrayConfig( ... name="mask1", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask1", ... mask_id=1, ... ), ... ), ... ArrayConfig( ... name="mask2", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask2", ... mask_id=2, ... ), ... ), ... ], ... ) >>> array = array_config.create_array() >>> array.dtype <class 'numpy.uint8'>
Notes
The dtype method is used to get the data type of the array. The data type is the type of the data in the array.
- property num_channels
- Get the number of channels in the array
- Returns:
The number of channels in the array
- Return type:
int
- Raises:
ValueError – If the array is not writable
Examples
>>> array_config = MergeInstancesArrayConfig( ... name="logical_or", ... source_array_configs=[ ... ArrayConfig( ... name="mask1", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask1", ... mask_id=1, ... ), ... ), ... ArrayConfig( ... name="mask2", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask2", ... mask_id=2, ... ), ... ), ... ], ... ) >>> array = array_config.create_array() >>> array.num_channels 1
Notes
The num_channels method is used to get the number of channels in the array. The number of channels is the number of channels in the array.
- property data
- Get the data of the array
- Returns:
The data of the array
- Return type:
np.ndarray
- Raises:
ValueError – If the array is not writable
Examples
>>> array_config = MergeInstancesArrayConfig( ... name="logical_or", ... source_array_configs=[ ... ArrayConfig( ... name="mask1", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask1", ... mask_id=1, ... ), ... ), ... ArrayConfig( ... name="mask2", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask2", ... mask_id=2, ... ), ... ), ... ], ... ) >>> array = array_config.create_array() >>> array.data array([[[1, 1, 1, ..., 1, 1, 1], [1, 1, 1, ..., 1, 1, 1], [1, 1, 1, ..., 1, 1, 1], ..., [1, 1, 1, ..., 1, 1, 1], [1, 1, 1, ..., 1, 1, 1], [1, 1, 1, ..., 1, 1, 1]]], dtype=uint8)
Notes
The data method is used to get the data of the array. The data is the content of the array.
- property attrs
- Get the attributes of the array
- Returns:
The attributes of the array
- Return type:
dict
- Raises:
ValueError – If the array is not writable
Examples
>>> array_config = MergeInstancesArrayConfig( ... name="logical_or", ... source_array_configs=[ ... ArrayConfig( ... name="mask1", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask1", ... mask_id=1, ... ), ... ), ... ArrayConfig( ... name="mask2", ... array_type=MaskArray, ... source_array_config=MaskArrayConfig( ... name="mask2", ... mask_id=2, ... ), ... ), ... ], ... ) >>> array = array_config.create_array() >>> array.attrs {'name': 'logical_or'}
Notes
The attrs method is used to get the attributes of the array. The attributes are the metadata of the array.