Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…lSeg3d into v0.0.1rc3
  • Loading branch information
MMathisLab committed Jul 17, 2022
2 parents b6eb303 + eb33f31 commit 7ac4ccc
Show file tree
Hide file tree
Showing 26 changed files with 964 additions and 590 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ __pycache__/

# unwanted results files
*.tif
*.tiff
napari_cellseg3d/_tests/res/*.csv
*.pth
*.db

# Distribution / packaging
.Python
Expand Down Expand Up @@ -97,3 +99,4 @@ venv/
/napari_cellseg3d/models/saved_weights/
/docs/res/logo/old_logo/
/reqs/

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ A napari plugin for 3D cell segmentation: training, inference, and data review.

## Installation

Note : we recommend using conda to create a new environment for the plugin.

conda create --name python=3.8 napari-cellseg3d
conda activate napari-cellseg3d

You can install `napari-cellseg3d` via [pip]:

pip install napari-cellseg3d
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down
61 changes: 43 additions & 18 deletions docs/res/code/interface.rst
Original file line number Diff line number Diff line change
@@ -1,50 +1,75 @@
interface.py
=============

Functions
Classes
-------------

open_url
Button
**************************************
.. autofunction:: napari_cellseg3d.interface::open_url
.. autoclass:: napari_cellseg3d.interface::Button
:members: __init__, visibility_condition

DropdownMenu
**************************************
.. autoclass:: napari_cellseg3d.interface::DropdownMenu
:members: __init__

make_scrollable
CheckBox
**************************************
.. autofunction:: napari_cellseg3d.interface::make_scrollable
.. autoclass:: napari_cellseg3d.interface::CheckBox
:members: __init__

AnisotropyWidgets
**************************************
.. autoclass:: napari_cellseg3d.interface::AnisotropyWidgets
:members: __init__, build, get_anisotropy_resolution_xyz, get_anisotropy_resolution_zyx, anisotropy_zoom_factor,is_enabled,toggle_permanent_visibility

make_group

FilePathWidget
**************************************
.. autofunction:: napari_cellseg3d.interface::make_group
.. autoclass:: napari_cellseg3d.interface::FilePathWidget
:members: __init__, build, get_text_field, get_button, check_ready, set_required, update_field_color, set_description

add_to_group
ScrollArea
**************************************
.. autofunction:: napari_cellseg3d.interface::add_to_group
.. autoclass:: napari_cellseg3d.interface::ScrollArea
:members: __init__, make_scrollable

make_container
DoubleIncrementCounter
**************************************
.. autofunction:: napari_cellseg3d.interface::make_container
.. autoclass:: napari_cellseg3d.interface::DoubleIncrementCounter
:members: __init__, set_precision, make_n

IntIncrementCounter
**************************************
.. autoclass:: napari_cellseg3d.interface::IntIncrementCounter
:members: __init__, make_n


make_button
Functions
-------------

open_url
**************************************
.. autofunction:: napari_cellseg3d.interface::make_button
.. autofunction:: napari_cellseg3d.interface::open_url


make_combobox
make_group
**************************************
.. autofunction:: napari_cellseg3d.interface::make_combobox
.. autofunction:: napari_cellseg3d.interface::make_group

make_checkbox
add_to_group
**************************************
.. autofunction:: napari_cellseg3d.interface::make_checkbox
.. autofunction:: napari_cellseg3d.interface::add_to_group

make_container
**************************************
.. autofunction:: napari_cellseg3d.interface::make_container

combine_blocks
**************************************
.. autofunction:: napari_cellseg3d.interface::combine_blocks


add_blank
**************************************
.. autofunction:: napari_cellseg3d.interface::add_blank
Expand Down
6 changes: 6 additions & 0 deletions docs/res/guides/convert_module_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ You can :
* Remove small objects :
You can specify a size threshold in pixels; all objects smaller than this size will be removed in the image.

* Resize anisotropic images :
Specifiy the resolution of your microscope to remove anisotropy from images.

.. important:: Does not work for instance labels currently.


.. figure:: ../images/converted_labels.png
:scale: 30 %
:align: center
Expand Down
6 changes: 6 additions & 0 deletions docs/res/guides/cropping_module_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Folders can be stacks of either .png or .tif files, ideally numbered with the in
You can then choose the size of the cropped volume, which will be constant throughout the process; make sure it is correct beforehand.
Setting a larger size than the size of the image will cause issues.

You can also opt to correct the anisotropy if your image is anisotropic :
simply set the resolution to the one of your microscope.

.. important::
This will simply scale the image in the viewer, but saved images will **still be anisotropic.** To resize your image, see :doc:`convert_module_guide`

Once you are ready, you can press **Start** to start the review process.


Expand Down
8 changes: 6 additions & 2 deletions docs/res/guides/inference_module_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
Inference module guide
=================================

This module allows you to use pre-trained segmentation algorithms (written in Pytorch) on volumes
This module allows you to use pre-trained segmentation algorithms (written in Pytorch) on 3D volumes
to automatically label cells.

.. important::
Currently, only inference on **3D volumes is supported**. Your image and label folders should both contain a set of
**3D image files**, currently either **.tif** or **.tiff**. Loading a folder of 2D images as a stack is not supported as of yet.

Currently, the following pre-trained models are available :

============== ================================================================================================
Expand All @@ -31,7 +35,7 @@ Interface and functionalities

* **Loading data** :

| When launching the module, you will be asked to provide an **image folder** containing all the volumes you'd like to be labeled.
| When launching the module, you will be asked to provide an **image folder** containing all the 3D volumes you'd like to be labeled.
| All images with the chosen extension (**.tif** or **.tiff** currently supported) in this folder will be labeled.
| You can then choose an **output folder**, where all the results will be saved.
Expand Down
6 changes: 6 additions & 0 deletions docs/res/guides/review_module_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ Launching the review process
.. note::
Only single 3D **.tif** files or 2D stacks of several **.png** or **.tif** in a folder are currently supported.

* Anisotropic data :
This will scale the images to visually remove the anisotropy, so as to make review easier.

.. important::
Results will still be saved as anisotropic images. If you wish to resize your images, see the :doc:`convert_module_guide`

* CSV file name :
You can then provide a model name, which will be used to name the csv file recording the status of each slice.

Expand Down
9 changes: 7 additions & 2 deletions docs/res/guides/training_module_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Training module guide
This module allows you to train pre-defined Pytorch models for cell segmentation.
Pre-defined models are stored in napari-cellseg-3d/models.

.. important::
Currently, only inference on **3D volumes is supported**. Your image and label folders should both contain a set of
**3D image files**, currently either **.tif** or **.tiff**. Loading a folder of 2D images as a stack is not supported as of yet.


Currently, the following pre-defined models are available :

============== ================================================================================================
Expand All @@ -31,8 +36,8 @@ The training module is comprised of several tabs.

1) The first one, **Data**, will let you set :

* The path to the images folder
* The path to the labels folder
* The path to the images folder (3D image files)
* The path to the labels folder (3D image files)
* The path to the results folder

* Whether to copy results to a zip file (for easier transferability)
Expand Down
Binary file added docs/res/logo/logo_alpha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 13 additions & 15 deletions napari_cellseg3d/_tests/test_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@

def test_launch_review(make_napari_viewer):

view = make_napari_viewer()
widget = rev.Reviewer(view)
view = make_napari_viewer()
widget = rev.Reviewer(view)

# widget.filetype_choice.setCurrentIndex(0)
# widget.filetype_choice.setCurrentIndex(0)

im_path = os.path.dirname(os.path.realpath(__file__)) + "/res/test.tif"
im_path = os.path.dirname(os.path.realpath(__file__)) + "/res/test.tif"

widget.image_path = im_path
widget.label_path = im_path

print(widget.image_path)
print(widget.label_path)
print(widget.as_folder)
print(widget.filetype)
widget.run_review()
widget._viewer.close()

assert widget._viewer is not None
widget.image_path = im_path
widget.label_path = im_path

print(widget.image_path)
print(widget.label_path)
print(widget.as_folder)
print(widget.filetype)
widget.run_review()
widget._viewer.close()

assert widget._viewer is not None
Loading

0 comments on commit 7ac4ccc

Please sign in to comment.