Skip to content

Commit

Permalink
Bump version to 06 WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
constantinpape committed Jan 1, 2025
1 parent dac6a91 commit 5f0e55b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- "elf/**/*.py" # Trigger on any changes in python files.
branches:
- master # Run the workflow only on pushes to the main branch
- bump-version
workflow_dispatch:

# security: restrict permissions for CI jobs.
Expand Down Expand Up @@ -34,6 +35,10 @@ jobs:
shell: bash -l {0}
run: pip install -e .

- name: Install napari
shell: bash -l {0}
run: pip install napari

- name: Install pdoc
shell: bash -l {0}
run: pip install pdoc
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# elf

This repository implements common functionality for (large-scale) bio-medical image analysis:
This repository implements common functionality for biomedical image analysis:
- **evaluation**: evaluation of partitions via rand index and variation of information
- **io**: common interface for different libraries / formats
- **parallel**: parallel / larger than memory implementation of common numpy functions
Expand All @@ -13,7 +13,7 @@ This repository implements common functionality for (large-scale) bio-medical im
- **wrapper**: volume wrappers for on-the-fly transformations
- **tracking**: graph based tracking algorithms

and more.
and more. See [the documentation]() for how to use elf.

See `examples` for some usage examples. For processing large data on a cluster, check out [cluster_tools](https://github.com/constantinpape/cluster_tools), which uses a lot of `elf` functionality internally.

Expand Down
2 changes: 1 addition & 1 deletion elf/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.2"
__version__ = "0.6.0"
27 changes: 17 additions & 10 deletions test/segmentation/test_stitching.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ def get_tiled_data(self, tile_shape, size=1024, ndim=2):

return labels, original_data # returns the stitched labels and original labels

def _check_result(self, segmentation, expected_segmentation, rtol=1e-2, atol=1e-2):
self.assertEqual(segmentation.shape, expected_segmentation.shape)

# We remove small segments before evaluation, since these may get stitched wrongly.
ids, sizes = np.unique(segmentation, return_counts=True)
filter_ids = ids[sizes < 100]
mask = np.isin(segmentation, filter_ids)
segmentation[mask] = 0
expected_segmentation[mask] = 0

# We allow for some tolerance, because small objects might get stitched incorrectly.
are, _ = rand_index(segmentation, expected_segmentation)
self.assertTrue(np.isclose(are, 0, rtol=rtol, atol=atol))

def test_stitch_segmentation(self):
from elf.segmentation.stitching import stitch_segmentation

Expand All @@ -54,10 +68,7 @@ def _segment(input_, block_id=None):
data = self.get_data()
expected_segmentation = _segment(data)
segmentation = stitch_segmentation(data, _segment, tile_shape, tile_overlap, verbose=False)

are, _ = rand_index(segmentation, expected_segmentation)
# We allow for some tolerance, because small objects might get stitched incorrectly.
self.assertTrue(np.isclose(are, 0, rtol=1e-3, atol=1e-3))
self._check_result(segmentation, expected_segmentation)

def test_stitch_segmentation_3d(self):
from elf.segmentation.stitching import stitch_segmentation
Expand All @@ -72,8 +83,7 @@ def _segment(input_, block_id=None):
data = self.get_data(256, ndim=3)
expected_segmentation = _segment(data)
segmentation = stitch_segmentation(data, _segment, tile_shape, tile_overlap, verbose=False)
are, _ = rand_index(segmentation, expected_segmentation)
self.assertTrue(np.isclose(are, 0, rtol=1e-2, atol=1e-2))
self._check_result(segmentation, expected_segmentation)

def test_stitch_tiled_segmentation(self):
from elf.segmentation.stitching import stitch_tiled_segmentation
Expand All @@ -83,10 +93,7 @@ def test_stitch_tiled_segmentation(self):
# Get the tiled segmentation with unmerged instances at tile interfaces.
labels, original_labels = self.get_tiled_data(tile_shape=tile_shape, size=1000)
stitched_labels = stitch_tiled_segmentation(segmentation=labels, tile_shape=tile_shape, verbose=False)
self.assertEqual(labels.shape, stitched_labels.shape)

are, _ = rand_index(stitched_labels, original_labels)
self.assertTrue(np.isclose(are, 0, rtol=1e-3, atol=1e-3))
self._check_result(stitched_labels, labels)


if __name__ == "__main__":
Expand Down

0 comments on commit 5f0e55b

Please sign in to comment.