diff --git a/README.md b/README.md index 45c4ccc3..2a2a9703 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black) [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) -[![Contributions](https://img.shields.io/badge/Contributions-Welcome-brightgreen.svg)](https://docs.brainglobe.info/cellfinder/contributing) +[![Contributions](https://img.shields.io/badge/Contributions-Welcome-brightgreen.svg)](https://brainglobe.info/developers/index.html) [![Twitter](https://img.shields.io/twitter/follow/brain_globe?style=social)](https://twitter.com/brain_globe) # cellfinder-core @@ -76,7 +76,7 @@ detected_cells = cellfinder_run(signal_array,background_array,voxel_sizes) ``` The output is a list of -[imlib Cell objects](https://github.com/adamltyson/imlib/blob/51ec5a8053e738776ceaa8d44e531b3c4b0e29d8/imlib/cells/cells.py#L15). +[brainglobe-utils Cell objects](https://github.com/brainglobe/brainglobe-utils/blob/044a735049c1323466d277f9df1c3abad8b2bb8d/brainglobe_utils/cells/cells.py#L19) Each `Cell` has a centroid coordinate, and a type: ```python @@ -88,7 +88,7 @@ Cell type 2 is a "real" cell, and Cell type 1 is a "rejected" object (i.e. not classified as a cell): ```python -from imlib.cells.cells import Cell +from brainglobe_utils.cells.cells import Cell print(Cell.CELL) # 2 @@ -98,15 +98,15 @@ print(Cell.NO_CELL) #### Saving the results If you want to save the detected cells for use in other BrainGlobe software (e.g. the -[cellfinder napari plugin](https://docs.brainglobe.info/cellfinder-napari/introduction)), +[cellfinder napari plugin](https://brainglobe.info/documentation/cellfinder/user-guide/napari-plugin/index.html)), you can save in the cellfinder XML standard: ```python -from imlib.IO.cells import save_cells +from brainglobe_utils.IO.cells import save_cells save_cells(detected_cells, "/path/to/cells.xml") ``` You can load these back with: ```python -from imlib.IO.cells import get_cells +from brainglobe_utils.IO.cells import get_cells cells = get_cells("/path/to/cells.xml") ``` @@ -210,7 +210,8 @@ if len(cell_candidates) > 0: # Don't run if there's nothing to classify The training data needed are matched pairs (signal & background) of small (usually 50 x 50 x 100um) images centered on the coordinate of candidate cells. These can be generated however you like, but I recommend using the -[Napari plugin](https://docs.brainglobe.info/cellfinder-napari/user-guide/training-data-generation). +[Napari plugin](https://brainglobe. +info/documentation/cellfinder/user-guide/napari-plugin/training-data-generation.html). `cellfinder-core` comes with a 50-layer ResNet trained on ~100,000 data points from serial two-photon microscopy images of mouse brains @@ -296,5 +297,5 @@ If you find this plugin useful, and use it in your research, please cite the pap [https://doi.org/10.1371/journal.pcbi.1009074](https://doi.org/10.1371/journal.pcbi.1009074) **If you use this, or any other tools in the brainglobe suite, please - [let us know](mailto:code@adamltyson.com?subject=cellfinder-core), and + [let us know](mailto:hello@brainglobe.info?subject=cellfinder-core), and we'd be happy to promote your paper/talk etc.** diff --git a/pyproject.toml b/pyproject.toml index f7312065..20cc1cff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ requires-python = ">=3.8" dependencies = [ "dask[array]", "fancylog>=0.0.7", - "imlib>=0.0.26", + "brainglobe-utils", "natsort", "numba", "numpy", @@ -111,7 +111,7 @@ known-first-party = ["cellfinder_core"] [[tool.mypy.overrides]] module = [ "fancylog.*", - "imlib.*", + "brainglobe_utils.*", "natsort.*", "numba.*", "tensorflow.*", diff --git a/src/cellfinder_core/classify/classify.py b/src/cellfinder_core/classify/classify.py index 9f41b2e7..eb51770e 100644 --- a/src/cellfinder_core/classify/classify.py +++ b/src/cellfinder_core/classify/classify.py @@ -2,8 +2,8 @@ from typing import Any, Callable, Dict, List, Optional, Tuple import numpy as np -from imlib.cells.cells import Cell -from imlib.general.system import get_num_processes +from brainglobe_utils.cells.cells import Cell +from brainglobe_utils.general.system import get_num_processes from tensorflow import keras from cellfinder_core import logger, types diff --git a/src/cellfinder_core/classify/cube_generator.py b/src/cellfinder_core/classify/cube_generator.py index eea9a845..e617df88 100644 --- a/src/cellfinder_core/classify/cube_generator.py +++ b/src/cellfinder_core/classify/cube_generator.py @@ -4,8 +4,8 @@ import numpy as np import tensorflow as tf -from imlib.cells.cells import Cell, group_cells_by_z -from imlib.general.numerical import is_even +from brainglobe_utils.cells.cells import Cell, group_cells_by_z +from brainglobe_utils.general.numerical import is_even from scipy.ndimage import zoom from skimage.io import imread from tensorflow.keras.utils import Sequence diff --git a/src/cellfinder_core/detect/detect.py b/src/cellfinder_core/detect/detect.py index e9038ace..4fb2e958 100644 --- a/src/cellfinder_core/detect/detect.py +++ b/src/cellfinder_core/detect/detect.py @@ -20,8 +20,8 @@ from typing import Callable, List, Optional, Sequence, Tuple, TypeVar import numpy as np -from imlib.cells.cells import Cell -from imlib.general.system import get_num_processes +from brainglobe_utils.cells.cells import Cell +from brainglobe_utils.general.system import get_num_processes from cellfinder_core import logger, types from cellfinder_core.detect.filters.plane import TileProcessor diff --git a/src/cellfinder_core/detect/filters/volume/volume_filter.py b/src/cellfinder_core/detect/filters/volume/volume_filter.py index df957001..f92a9585 100644 --- a/src/cellfinder_core/detect/filters/volume/volume_filter.py +++ b/src/cellfinder_core/detect/filters/volume/volume_filter.py @@ -5,7 +5,7 @@ from typing import Any, Callable, List, Optional, Tuple import numpy as np -from imlib.cells.cells import Cell +from brainglobe_utils.cells.cells import Cell from tifffile import tifffile from tqdm import tqdm diff --git a/src/cellfinder_core/download/download.py b/src/cellfinder_core/download/download.py index 0c4b2b9f..3fe4ecf1 100644 --- a/src/cellfinder_core/download/download.py +++ b/src/cellfinder_core/download/download.py @@ -3,8 +3,8 @@ import tarfile import urllib.request -from imlib.general.config import get_config_obj -from imlib.general.system import disk_free_gb +from brainglobe_utils.general.config import get_config_obj +from brainglobe_utils.general.system import disk_free_gb from cellfinder_core.tools.source_files import ( source_config_cellfinder, diff --git a/src/cellfinder_core/main.py b/src/cellfinder_core/main.py index 9c28a2b6..afbbcf1c 100644 --- a/src/cellfinder_core/main.py +++ b/src/cellfinder_core/main.py @@ -6,7 +6,7 @@ from typing import Callable, List, Optional, Tuple import numpy as np -from imlib.general.logging import suppress_specific_logs +from brainglobe_utils.general.logging import suppress_specific_logs from cellfinder_core import logger from cellfinder_core.download.models import model_type diff --git a/src/cellfinder_core/tools/IO.py b/src/cellfinder_core/tools/IO.py index 871c5fb0..84eafdd6 100644 --- a/src/cellfinder_core/tools/IO.py +++ b/src/cellfinder_core/tools/IO.py @@ -3,9 +3,9 @@ from typing import Tuple import numpy as np +from brainglobe_utils.general.system import get_sorted_file_paths from dask import array as da from dask import delayed -from imlib.general.system import get_sorted_file_paths from tifffile import TiffFile, imread diff --git a/src/cellfinder_core/tools/image_processing.py b/src/cellfinder_core/tools/image_processing.py index 2e7252ad..742220d6 100644 --- a/src/cellfinder_core/tools/image_processing.py +++ b/src/cellfinder_core/tools/image_processing.py @@ -1,5 +1,5 @@ import numpy as np -from imlib.general.numerical import is_even +from brainglobe_utils.general.numerical import is_even def crop_center_2d(img, crop_x=None, crop_y=None): diff --git a/src/cellfinder_core/tools/prep.py b/src/cellfinder_core/tools/prep.py index 538304ee..d9637144 100644 --- a/src/cellfinder_core/tools/prep.py +++ b/src/cellfinder_core/tools/prep.py @@ -7,8 +7,8 @@ from pathlib import Path from typing import Optional -from imlib.general.config import get_config_obj -from imlib.general.system import get_num_processes +from brainglobe_utils.general.config import get_config_obj +from brainglobe_utils.general.system import get_num_processes import cellfinder_core.tools.tf as tf_tools from cellfinder_core import logger diff --git a/src/cellfinder_core/tools/system.py b/src/cellfinder_core/tools/system.py index 4deafe1e..612ad4da 100644 --- a/src/cellfinder_core/tools/system.py +++ b/src/cellfinder_core/tools/system.py @@ -1,6 +1,6 @@ from pathlib import Path -from imlib.general.exceptions import CommandLineInputError +from brainglobe_utils.general.exceptions import CommandLineInputError def get_subdirectories(directory, names_only=False): diff --git a/src/cellfinder_core/tools/tiff.py b/src/cellfinder_core/tools/tiff.py index 385a9bc2..a2813ce8 100644 --- a/src/cellfinder_core/tools/tiff.py +++ b/src/cellfinder_core/tools/tiff.py @@ -2,7 +2,7 @@ from os.path import isfile, join import natsort -from imlib.cells.cells import Cell, UntypedCell +from brainglobe_utils.cells.cells import Cell, UntypedCell class TiffList(object): diff --git a/src/cellfinder_core/train/train_yml.py b/src/cellfinder_core/train/train_yml.py index 4ab019f8..47f3ec53 100644 --- a/src/cellfinder_core/train/train_yml.py +++ b/src/cellfinder_core/train/train_yml.py @@ -18,11 +18,14 @@ from pathlib import Path from typing import Dict, Literal +from brainglobe_utils.general.numerical import ( + check_positive_float, + check_positive_int, +) +from brainglobe_utils.general.system import ensure_directory_exists +from brainglobe_utils.IO.cells import find_relevant_tiffs +from brainglobe_utils.IO.yaml import read_yaml_section from fancylog import fancylog -from imlib.general.numerical import check_positive_float, check_positive_int -from imlib.general.system import ensure_directory_exists -from imlib.IO.cells import find_relevant_tiffs -from imlib.IO.yaml import read_yaml_section from sklearn.model_selection import train_test_split import cellfinder_core as program_for_log diff --git a/tests/tests/test_integration/test_detection.py b/tests/tests/test_integration/test_detection.py index 4293e3cd..52a01c93 100644 --- a/tests/tests/test_integration/test_detection.py +++ b/tests/tests/test_integration/test_detection.py @@ -1,10 +1,10 @@ import os from math import isclose -import imlib.IO.cells as cell_io +import brainglobe_utils.IO.cells as cell_io import numpy as np import pytest -from imlib.general.system import get_num_processes +from brainglobe_utils.general.system import get_num_processes from cellfinder_core.main import main from cellfinder_core.tools.IO import read_with_dask diff --git a/tests/tests/test_unit/test_tools/test_system.py b/tests/tests/test_unit/test_tools/test_system.py index 363d6145..567f6555 100644 --- a/tests/tests/test_unit/test_tools/test_system.py +++ b/tests/tests/test_unit/test_tools/test_system.py @@ -3,8 +3,8 @@ from pathlib import Path import pytest -from imlib.general.exceptions import CommandLineInputError -from imlib.general.system import ensure_directory_exists +from brainglobe_utils.general.exceptions import CommandLineInputError +from brainglobe_utils.general.system import ensure_directory_exists import cellfinder_core.tools.system as system