Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docs/02_getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ install_requires =
scikit-posthocs
stardist
statsmodels
tensorflow
tensorflow<2.20
toml
torch
torchvision
Expand Down
11 changes: 1 addition & 10 deletions src/brainways/pipeline/cell_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/brainways/utils/_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -51,4 +52,3 @@ def _module_available(module_path: str) -> bool:


NAPARI_AVAILABLE = _module_available("napari")
STARDIST_AVAILABLE = _module_available("stardist")
12 changes: 6 additions & 6 deletions src/brainways/utils/_tests/test_setup.py
Original file line number Diff line number Diff line change
@@ -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()
Loading