Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertDominguez committed Oct 8, 2024
1 parent cf5d244 commit 070bcc2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
23 changes: 6 additions & 17 deletions docs/source/cli.rst
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
Inference via CLI
-----------------

You can use the CLI to run inference on an image or folder containing several images.
Command Line Interface (CLI)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can use the CLI to run inference on an image or folder containing several images. To do that, you can use the following command

To do that, simply use the following command:
.. code-block:: console
.. code-block::
$ spotiflow predict --input PATH
spotiflow-predict PATH
where PATH can be either an image or a folder.

By default, the command will use the `general` pretrained model. You can specify a different model by using the `-\-pretrained-model` flag or the `-\-model-dir` flag for a model you trained yourself.

Moreover, spots are saved to a subfolder `spotiflow_results` created inside the input folder (this can be changed with the `-\-out-dir` flag).

For more information, please refer to the help message of the CLI:

.. code-block::
spotiflow-predict -h
where ``PATH`` can be either an image or a folder. By default, the command will use the ``general`` pretrained model. You can specify a different model by using the ``--pretrained-model`` flag. Moreover, spots are saved to a subfolder ``spotiflow_results`` created inside the input folder (this can be changed with the ``--out-dir`` flag). For more information, please refer to the help message of the CLI (``spotiflow-predict -h``).
38 changes: 25 additions & 13 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Spotiflow
=========

Spotiflow is a learning-based spot detection method for fluorescence microscopy images. For more information, please refer to our `paper <https://PLACEHOLDER/>`__.
Spotiflow is a learning-based subpixel-accurate spot detection method for 2D and 3D fluorescence microscopy. It is primarily developed for spatial transcriptomics workflows that require transcript detection in large, multiplexed FISH-images, although it can also be used to detect spot-like structures in general fluorescence microscopy images and volumes. For more information, please refer to our `paper <https://doi.org/10.1101/2024.02.01.578426/>`__.

Getting Started
---------------
Expand All @@ -13,36 +13,36 @@ Installation
~~~~~~~~~~~~


First, create and activate a new conda environment.
First, create and activate a fresh ``conda`` environment (we currently support Python 3.9 to 3.12). If you don't have ``conda`` installed, we recommend using `miniforge <https://github.com/conda-forge/miniforge>`__.

.. code-block:: console
(base) $ conda create -n spotiflow python=3.9
(base) $ conda activate spotiflow
$ conda create -n spotiflow python=3.12
$ conda activate spotiflow
**Note (for MacOS users):** if using MacOS, there is a known bug causing the installation of PyTorch with conda to sometimes break OpenMP. You can avoid installing PyTorch with ``conda`` and let install it automatically via pip instead.
Then, install Pytorch using ``conda``/ ``mamba``. Please follow the `official instructions for your system <https://pytorch.org/get-started/locally>`__.

As an example, for MacOS:
As an example, for a Linux system with CUDA (note that you should change the CUDA version to match the one installed on your system):

.. code-block:: console
(spotiflow) $ conda install pytorch::pytorch torchvision -c pytorch
$ conda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia
For a linux system with CUDA (note that you should change the CUDA version to match the one installed on your system):

.. code-block:: console
(spotiflow) $ conda install pytorch torchvision pytorch-cuda=11.8 -c pytorch -c nvidia
**Note (for Windows users):** if using Windows, if using Windows, please install the latest `Build Tools for Visual Studio <https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022>`__ (make sure to select the C++ build tools during installation) before proceeding to install Spotiflow.

Finally, install ``spotiflow`` using ``pip``:

.. code-block:: console
(spotiflow) $ pip install spotiflow
$ pip install spotiflow
Predicting spots in an image
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Python API
^^^^^^^^^^

The snippet below shows how to retrieve the spots from an image using one of the pretrained models:

.. code-block:: python
Expand Down Expand Up @@ -73,8 +73,20 @@ If a custom model is used, simply change the model loadings step to:
# Load a custom model
model = Spotiflow.from_folder("/path/to/model")
Command Line Interface (CLI)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can use the CLI to run inference on an image or folder containing several images. To do that, you can use the following command

.. code-block:: console
$ spotiflow predict --input PATH
where ``PATH`` can be either an image or a folder. By default, the command will use the ``general`` pretrained model. You can specify a different model by using the ``--pretrained-model`` flag. Moreover, spots are saved to a subfolder ``spotiflow_results`` created inside the input folder (this can be changed with the ``--out-dir`` flag). For more information, please refer to the help message of the CLI (``spotiflow-predict -h``).

Napari plugin
^^^^^^^^^^^^^
Spotiflow also can be run easily in a graphical user interface as a `napari <https://napari.org/>`__ plugin. See :ref:`napari:Predicting spots using the napari plugin` for more information.

Contents
--------
Expand Down
3 changes: 2 additions & 1 deletion docs/source/train.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ You can then load it by simply calling:
In the 3D case, you should initialize a :py:mod:`spotiflow.model.config.SpotiflowModelConfig` object and pass it to the `Spotiflow` constructor with the appropriate parameter set (see other options for the configuration at the end of the section):

.. code-block:: python
# Same imports as before
from spotiflow.model import SpotiflowModelConfig
Expand Down Expand Up @@ -117,7 +118,7 @@ You can also pass other parameters relevant for training to the `fit` method. Fo
)
In order to change the model architecture (`e.g.` number of input/output channels, number of layers, variance for the heatmap generation, etc.), you can create a :py:mod:`spotiflow.model.config.SpotiflowModelConfig` object and populate it accordingly. Then you can pass it to the `Spotiflow` constructor (note that this is necessary for 3D). For example, if our image is RGB and we need the network to use 3 input channels, we can do the following:
In order to change the model architecture (`e.g.` number of input channels, number of layers, variance for the heatmap generation, etc.), you can create a :py:mod:`spotiflow.model.config.SpotiflowModelConfig` object and populate it accordingly. Then you can pass it to the `Spotiflow` constructor (note that this is necessary for 3D). For example, if our image is RGB and we need the network to use 3 input channels, we can do the following:

.. code-block:: python
Expand Down

0 comments on commit 070bcc2

Please sign in to comment.