Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use negative crops + better neutoglancer #267

Merged
merged 11 commits into from
Jul 22, 2024
1 change: 1 addition & 0 deletions dacapo/experiments/datasplits/datasets/arrays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@

# nonconfigurable arrays (helpers)
from .numpy_array import NumpyArray # noqa
from .constant_array_config import ConstantArray, ConstantArrayConfig # noqa
79 changes: 79 additions & 0 deletions dacapo/experiments/datasplits/datasets/arrays/concat_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,3 +459,82 @@ def __getitem__(self, roi: Roi) -> np.ndarray:
f"Concatenated array has only one channel: {self.name} {concatenated.shape}"
)
return concatenated

def _can_neuroglance(self):
"""
This method returns True if the source array can be visualized in neuroglance.

Returns:
bool: True if the source array can be visualized in neuroglance.
Raises:
ValueError: If the source array is not writable.
Examples:
>>> binarize_array._can_neuroglance()
Note:
This method is used to return True if the source array can be visualized in neuroglance.
"""
return any(
[
source_array._can_neuroglance()
for source_array in self.source_arrays.values()
]
)

def _neuroglancer_source(self):
"""
This method returns the source array for neuroglancer.

Returns:
neuroglancer.LocalVolume: The source array for neuroglancer.
Raises:
ValueError: If the source array is not writable.
Examples:
>>> binarize_array._neuroglancer_source()
Note:
This method is used to return the source array for neuroglancer.
"""
# return self._source_array._neuroglancer_source()
return [
source_array._neuroglancer_source()
for source_array in self.source_arrays.values()
]

def _neuroglancer_layer(self):
"""
This method returns the neuroglancer layer for the source array.

Returns:
neuroglancer.SegmentationLayer: The neuroglancer layer for the source array.
Raises:
ValueError: If the source array is not writable.
Examples:
>>> binarize_array._neuroglancer_layer()
Note:
This method is used to return the neuroglancer layer for the source array.
"""
# layer = neuroglancer.SegmentationLayer(source=self._neuroglancer_source())
return [
source_array._neuroglancer_layer()
for source_array in self.source_arrays.values()
if source_array._can_neuroglance()
]

def _source_name(self):
"""
This method returns the name of the source array.

Returns:
str: The name of the source array.
Raises:
ValueError: If the source array is not writable.
Examples:
>>> binarize_array._source_name()
Note:
This method is used to return the name of the source array.
"""
# return self._source_array._source_name()
return [
source_array._source_name()
for source_array in self.source_arrays.values()
if source_array._can_neuroglance()
]
Loading
Loading