dacapo.experiments.datasplits.datasets.arrays.merge_instances_array
Classes
This array merges multiple source arrays into a single array by summing them. This is useful for merging |
Module Contents
- class dacapo.experiments.datasplits.datasets.arrays.merge_instances_array.MergeInstancesArray(array_config)
This array merges multiple source arrays into a single array by summing them. This is useful for merging instance segmentation arrays into a single array. NeuoGlancer will display each instance as a different color.
- name
str The name of the array
- source_array_configs
List[ArrayConfig] A list of source arrays to merge
- __getitem__(roi
Roi) -> np.ndarray Returns a numpy array with the requested region of interest
- _can_neuroglance() bool
Returns True if the array can be visualized in neuroglancer
- _neuroglancer_source() str
Returns the source name for the array in neuroglancer
- _neuroglancer_layer() Tuple[neuroglancer.SegmentationLayer, Dict[str, Any]]
Returns a neuroglancer layer and its configuration
- _source_name() str
Returns the source name for the array
Note
This array is not writable Source arrays must have the same shape.
- name
- property axes
- Returns the axes of the array
- Returns:
The axes of the array
- Return type:
List[str]
- Raises:
ValueError – If the source arrays have different shapes
Example
```python from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArray from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayType from funlib.geometry import Coordinate, Roi array_config = MergeInstancesArrayConfig(
name=”array”, source_array_configs=[
- ArrayConfig(
name=”array1”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array1.h5”,
), ArrayConfig(
name=”array2”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array2.h5”,
),
],
) array = MergeInstancesArray(array_config) axes = array.axes ```
Note
This example shows how to get the axes of the array
- property dims: int
Returns the number of dimensions of the array
- Returns:
The number of dimensions of the array
- Return type:
int
- Raises:
ValueError – If the source arrays have different shapes
Example
```python from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArray from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayType from funlib.geometry import Coordinate, Roi array_config = MergeInstancesArrayConfig(
name=”array”, source_array_configs=[
- ArrayConfig(
name=”array1”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array1.h5”,
), ArrayConfig(
name=”array2”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array2.h5”,
),
],
) array = MergeInstancesArray(array_config) dims = array.dims ```
Note
This example shows how to get the number of dimensions of the array
- property voxel_size: funlib.geometry.Coordinate
Returns the voxel size of the array
- Returns:
The voxel size of the array
- Return type:
Coordinate
- Raises:
ValueError – If the source arrays have different shapes
Example
```python from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArray from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayType from funlib.geometry import Coordinate, Roi array_config = MergeInstancesArrayConfig(
name=”array”, source_array_configs=[
- ArrayConfig(
name=”array1”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array1.h5”,
), ArrayConfig(
name=”array2”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array2.h5”,
),
],
) array = MergeInstancesArray(array_config) voxel_size = array.voxel_size ```
Note
This example shows how to get the voxel size of the array
- property roi: funlib.geometry.Roi
Returns the region of interest of the array
- Returns:
The region of interest of the array
- Return type:
Roi
- Raises:
ValueError – If the source arrays have different shapes
Example
```python from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArray from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayType from funlib.geometry import Coordinate, Roi array_config = MergeInstancesArrayConfig(
name=”array”, source_array_configs=[
- ArrayConfig(
name=”array1”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array1.h5”,
), ArrayConfig(
name=”array2”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array2.h5”,
),
],
) array = MergeInstancesArray(array_config) roi = array.roi ```
Note
This example shows how to get the region of interest of the array
- property writable: bool
Returns True if the array is writable, False otherwise
- Returns:
True if the array is writable, False otherwise
- Return type:
bool
- Raises:
ValueError – If the source arrays have different shapes
Example
```python from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArray from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayType from funlib.geometry import Coordinate, Roi array_config = MergeInstancesArrayConfig(
name=”array”, source_array_configs=[
- ArrayConfig(
name=”array1”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array1.h5”,
), ArrayConfig(
name=”array2”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array2.h5”,
),
],
) array = MergeInstancesArray(array_config) writable = array.writable ```
Note
This example shows how to check if the array is writable
- property dtype
- Returns the data type of the array
- Returns:
The data type of the array
- Return type:
np.dtype
- Raises:
ValueError – If the source arrays have different shapes
Example
```python from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArray from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayType from funlib.geometry import Coordinate, Roi array_config = MergeInstancesArrayConfig(
name=”array”, source_array_configs=[
- ArrayConfig(
name=”array1”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array1.h5”,
), ArrayConfig(
name=”array2”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array2.h5”,
),
],
) array = MergeInstancesArray(array_config) dtype = array.dtype ```
Note
This example shows how to get the data type of the array
- property num_channels
- Returns the number of channels of the array
- Returns:
The number of channels of the array
- Return type:
int
- Raises:
ValueError – If the source arrays have different shapes
Example
```python from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArray from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayType from funlib.geometry import Coordinate, Roi array_config = MergeInstancesArrayConfig(
name=”array”, source_array_configs=[
- ArrayConfig(
name=”array1”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array1.h5”,
), ArrayConfig(
name=”array2”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array2.h5”,
),
],
) array = MergeInstancesArray(array_config) num_channels = array.num_channels ```
Note
This example shows how to get the number of channels of the array
- property data
- Returns the data of the array
- Returns:
The data of the array
- Return type:
np.ndarray
- Raises:
ValueError – If the source arrays have different shapes
Example
```python from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArray from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayType from funlib.geometry import Coordinate, Roi array_config = MergeInstancesArrayConfig(
name=”array”, source_array_configs=[
- ArrayConfig(
name=”array1”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array1.h5”,
), ArrayConfig(
name=”array2”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array2.h5”,
),
],
) array = MergeInstancesArray(array_config) data = array.data ```
Note
This example shows how to get the data of the array
- property attrs
- Returns the attributes of the array
- Returns:
The attributes of the array
- Return type:
Dict[str, Any]
- Raises:
ValueError – If the source arrays have different shapes
Example
```python from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArray from dacapo.experiments.datasplits.datasets.arrays import MergeInstancesArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayConfig from dacapo.experiments.datasplits.datasets.arrays import ArrayType from funlib.geometry import Coordinate, Roi array_config = MergeInstancesArrayConfig(
name=”array”, source_array_configs=[
- ArrayConfig(
name=”array1”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array1.h5”,
), ArrayConfig(
name=”array2”, array_type=ArrayType.INSTANCE_SEGMENTATION, path=”path/to/array2.h5”,
),
],
) array = MergeInstancesArray(array_config) attributes = array.attrs ```
Note
This example shows how to get the attributes of the array