Skip to content

Commit

Permalink
use negative crops + better neutoglancer (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzouink authored Jul 22, 2024
2 parents 33c6f52 + 9e5ca55 commit e806bf4
Show file tree
Hide file tree
Showing 11 changed files with 763 additions and 65 deletions.
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

0 comments on commit e806bf4

Please sign in to comment.