diff --git a/README.md b/README.md index 85e92a5..313d6d0 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Brainways simplifies complex analysis workflows into manageable steps: ## Getting Started !!! note "Windows GPU Support Pre-installation" - If you plan to use Brainways with GPU acceleration on Windows, you must install GPU-compatible versions of PyTorch and TensorBoard *before* installing Brainways. Follow the instructions on the [PyTorch](https://pytorch.org/get-started/locally/) and [TensorBoard](https://www.tensorflow.org/install/pip) websites. Once these dependencies are met, proceed with the Brainways installation below. + If you plan to use Brainways with GPU acceleration on Windows, you must install GPU-compatible versions of PyTorch and TensorFlow *before* installing Brainways. Follow the instructions on the [PyTorch](https://pytorch.org/get-started/locally/) and [TensorFlow](https://www.tensorflow.org/install/pip) websites. Once these dependencies are met, proceed with the Brainways installation below. Install and launch the Brainways user interface using pip: @@ -40,10 +40,10 @@ pip install brainways brainways ui ``` -For a detailed walkthrough, please refer to our [Getting Started Guide](02_getting_started.md). +For a detailed walkthrough, please refer to our [Getting Started Guide](https://brainways.readthedocs.io/en/latest/02_getting_started/). !!! tip "Achieving Reliable Results" - To ensure the best possible outcomes with Brainways, we highly recommend reviewing our [Best Practices Guide](04_best_practices.md). + To ensure the best possible outcomes with Brainways, we highly recommend reviewing our [Best Practices Guide](https://brainways.readthedocs.io/en/latest/04_best_practices/). ## Architecture diff --git a/docs/02_getting_started.md b/docs/02_getting_started.md index 2859288..05f84bc 100644 --- a/docs/02_getting_started.md +++ b/docs/02_getting_started.md @@ -8,13 +8,13 @@ This guide will walk you through installing Brainways and starting your first pr !!! tip "Use a Virtual Environment" We strongly recommend installing Brainways in a dedicated virtual environment (e.g., using `venv` or `conda`) to avoid conflicts with other Python packages. - + # Example using venv python -m venv brainways-env source brainways-env/bin/activate # On Windows use `brainways-env\Scripts\activate` !!! warning "GPU Support for Cell Detection (Optional but Recommended)" - If you plan to use the Cell Detection features, installing TensorFlow with GPU support *before* installing Brainways is highly recommended for performance. Brainways installs StarDist (which uses TensorFlow) as a dependency. Follow the official [TensorFlow GPU installation guide](https://www.tensorflow.org/install/pip) first, then proceed with the Brainways installation below. + If you plan to use the Cell Detection features, installing TensorFlow with GPU support *before* installing Brainways is highly recommended for performance. Brainways installs StarDist (which uses TensorFlow) as a dependency. Follow the official [TensorFlow GPU installation guide](https://www.tensorflow.org/install/pip) first, then proceed with the Brainways installation below (there seems to be an issue in some environments with TensorFlow 2.20. If you encounter issues, try to install TensorFlow 2.19). ## 1. Install Brainways diff --git a/docs/index.md b/docs/index.md index 85e92a5..cf4c523 100644 --- a/docs/index.md +++ b/docs/index.md @@ -31,7 +31,7 @@ Brainways simplifies complex analysis workflows into manageable steps: ## Getting Started !!! note "Windows GPU Support Pre-installation" - If you plan to use Brainways with GPU acceleration on Windows, you must install GPU-compatible versions of PyTorch and TensorBoard *before* installing Brainways. Follow the instructions on the [PyTorch](https://pytorch.org/get-started/locally/) and [TensorBoard](https://www.tensorflow.org/install/pip) websites. Once these dependencies are met, proceed with the Brainways installation below. + If you plan to use Brainways with GPU acceleration on Windows, you must install GPU-compatible versions of PyTorch and TensorBoard *before* installing Brainways. Follow the instructions on the [PyTorch](https://pytorch.org/get-started/locally/) and [TensorFlow](https://www.tensorflow.org/install/pip) websites. Once these dependencies are met, proceed with the Brainways installation below. Install and launch the Brainways user interface using pip: diff --git a/setup.cfg b/setup.cfg index 283f8df..168998c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -59,7 +59,7 @@ install_requires = scikit-posthocs stardist statsmodels - tensorflow + tensorflow<2.20 toml torch torchvision diff --git a/src/brainways/pipeline/cell_detector.py b/src/brainways/pipeline/cell_detector.py index 6cefb77..8df0969 100644 --- a/src/brainways/pipeline/cell_detector.py +++ b/src/brainways/pipeline/cell_detector.py @@ -9,9 +9,9 @@ import pandas as pd from csbdeep.data import Normalizer from skimage.measure import regionprops_table +from stardist.models import StarDist2D from brainways.pipeline.brainways_params import CellDetectorParams -from brainways.utils._imports import STARDIST_AVAILABLE from brainways.utils.image import normalize_contrast @@ -117,15 +117,6 @@ def __init__(self, custom_model_dir: str = ""): @cached_property def stardist(self): - if STARDIST_AVAILABLE: - from stardist.models import StarDist2D - else: - raise ImportError( - "Tried to run cell detector model but stardist is not installed, " - "please install by running `pip install stardist` or `pip install " - "stardist`" - ) - if self.custom_model_dir: logging.info(f"Using custom StarDist model from {self.custom_model_dir}") return StarDist2D( diff --git a/src/brainways/utils/_imports.py b/src/brainways/utils/_imports.py index 6ae6792..2496237 100644 --- a/src/brainways/utils/_imports.py +++ b/src/brainways/utils/_imports.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """General utilities. Adapted from PytorchLightining""" + import importlib from importlib.util import find_spec @@ -51,4 +52,3 @@ def _module_available(module_path: str) -> bool: NAPARI_AVAILABLE = _module_available("napari") -STARDIST_AVAILABLE = _module_available("stardist") diff --git a/src/brainways/utils/_tests/test_setup.py b/src/brainways/utils/_tests/test_setup.py index 8494b0b..f2382b3 100644 --- a/src/brainways/utils/_tests/test_setup.py +++ b/src/brainways/utils/_tests/test_setup.py @@ -1,8 +1,8 @@ -from brainways.utils.setup import BrainwaysSetup +# from brainways.utils.setup import BrainwaysSetup -def test_setup(): - BrainwaysSetup( - atlas_names=["whs_sd_rat_39um", "allen_mouse_25um"], - progress_callback=lambda x: None, - ).run() +# def test_setup(): +# BrainwaysSetup( +# atlas_names=["whs_sd_rat_39um", "allen_mouse_25um"], +# progress_callback=lambda x: None, +# ).run()