Skip to content

Commit eb33f31

Browse files
authored
[WIP] UI API overhaul + several features/fixes (#17)
* UI refactor + aniso convert + fixed review plots - started cleaning up UI class/functions - fixed incorrect plots when using anisotropy correction - added anisotropy conversion to utils - fixed errors in launching review in new viewer * UI API refactor + aniso conversion + docs * Update cropping_module_guide.rst * Updated docs * Feedback from PR #17 - Improved conversion file path handling - Edit for ambiguous desc. in framework model - Changed training validation dropdown to spinbox * Update requirements to have PyQT by default * Update .gitignore
1 parent c2eb134 commit eb33f31

24 files changed

+951
-587
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ __pycache__/
88

99
# unwanted results files
1010
*.tif
11+
*.tiff
1112
napari_cellseg3d/_tests/res/*.csv
1213
*.pth
14+
*.db
1315

1416
# Distribution / packaging
1517
.Python
@@ -97,4 +99,4 @@ venv/
9799
/napari_cellseg3d/models/saved_weights/
98100
/docs/res/logo/old_logo/
99101
/reqs/
100-
*.db
102+

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ A napari plugin for 3D cell segmentation: training, inference, and data review.
2323

2424
## Installation
2525

26+
Note : we recommend using conda to create a new environment for the plugin.
27+
28+
conda create --name python=3.8 napari-cellseg3d
29+
conda activate napari-cellseg3d
30+
2631
You can install `napari-cellseg3d` via [pip]:
2732

2833
pip install napari-cellseg3d

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
#
7171
# This is also used if you do content translation via gettext catalogs.
7272
# Usually you set "language" from the command line for these cases.
73-
language = None
73+
language = "en"
7474

7575
# There are two options for replacing |today|: either, you set today to some
7676
# non-false value, then it is used:

docs/res/code/interface.rst

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,75 @@
11
interface.py
22
=============
33

4-
Functions
4+
Classes
55
-------------
66

7-
open_url
7+
Button
88
**************************************
9-
.. autofunction:: napari_cellseg3d.interface::open_url
9+
.. autoclass:: napari_cellseg3d.interface::Button
10+
:members: __init__, visibility_condition
1011

12+
DropdownMenu
13+
**************************************
14+
.. autoclass:: napari_cellseg3d.interface::DropdownMenu
15+
:members: __init__
1116

12-
make_scrollable
17+
CheckBox
1318
**************************************
14-
.. autofunction:: napari_cellseg3d.interface::make_scrollable
19+
.. autoclass:: napari_cellseg3d.interface::CheckBox
20+
:members: __init__
1521

22+
AnisotropyWidgets
23+
**************************************
24+
.. autoclass:: napari_cellseg3d.interface::AnisotropyWidgets
25+
:members: __init__, build, get_anisotropy_resolution_xyz, get_anisotropy_resolution_zyx, anisotropy_zoom_factor,is_enabled,toggle_permanent_visibility
1626

17-
make_group
27+
28+
FilePathWidget
1829
**************************************
19-
.. autofunction:: napari_cellseg3d.interface::make_group
30+
.. autoclass:: napari_cellseg3d.interface::FilePathWidget
31+
:members: __init__, build, get_text_field, get_button, check_ready, set_required, update_field_color, set_description
2032

21-
add_to_group
33+
ScrollArea
2234
**************************************
23-
.. autofunction:: napari_cellseg3d.interface::add_to_group
35+
.. autoclass:: napari_cellseg3d.interface::ScrollArea
36+
:members: __init__, make_scrollable
2437

25-
make_container
38+
DoubleIncrementCounter
2639
**************************************
27-
.. autofunction:: napari_cellseg3d.interface::make_container
40+
.. autoclass:: napari_cellseg3d.interface::DoubleIncrementCounter
41+
:members: __init__, set_precision, make_n
42+
43+
IntIncrementCounter
44+
**************************************
45+
.. autoclass:: napari_cellseg3d.interface::IntIncrementCounter
46+
:members: __init__, make_n
2847

2948

30-
make_button
49+
Functions
50+
-------------
51+
52+
open_url
3153
**************************************
32-
.. autofunction:: napari_cellseg3d.interface::make_button
54+
.. autofunction:: napari_cellseg3d.interface::open_url
55+
3356

34-
make_combobox
57+
make_group
3558
**************************************
36-
.. autofunction:: napari_cellseg3d.interface::make_combobox
59+
.. autofunction:: napari_cellseg3d.interface::make_group
3760

38-
make_checkbox
61+
add_to_group
3962
**************************************
40-
.. autofunction:: napari_cellseg3d.interface::make_checkbox
63+
.. autofunction:: napari_cellseg3d.interface::add_to_group
4164

65+
make_container
66+
**************************************
67+
.. autofunction:: napari_cellseg3d.interface::make_container
4268

4369
combine_blocks
4470
**************************************
4571
.. autofunction:: napari_cellseg3d.interface::combine_blocks
4672

47-
4873
add_blank
4974
**************************************
5075
.. autofunction:: napari_cellseg3d.interface::add_blank

docs/res/guides/convert_module_guide.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ You can :
1717
* Remove small objects :
1818
You can specify a size threshold in pixels; all objects smaller than this size will be removed in the image.
1919

20+
* Resize anisotropic images :
21+
Specifiy the resolution of your microscope to remove anisotropy from images.
22+
23+
.. important:: Does not work for instance labels currently.
24+
25+
2026
.. figure:: ../images/converted_labels.png
2127
:scale: 30 %
2228
:align: center

docs/res/guides/cropping_module_guide.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ Folders can be stacks of either .png or .tif files, ideally numbered with the in
2525
You can then choose the size of the cropped volume, which will be constant throughout the process; make sure it is correct beforehand.
2626
Setting a larger size than the size of the image will cause issues.
2727

28+
You can also opt to correct the anisotropy if your image is anisotropic :
29+
simply set the resolution to the one of your microscope.
30+
31+
.. important::
32+
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`
33+
2834
Once you are ready, you can press **Start** to start the review process.
2935

3036

docs/res/guides/review_module_guide.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Launching the review process
1919
.. note::
2020
Only single 3D **.tif** files or 2D stacks of several **.png** or **.tif** in a folder are currently supported.
2121

22+
* Anisotropic data :
23+
This will scale the images to visually remove the anisotropy, so as to make review easier.
24+
25+
.. important::
26+
Results will still be saved as anisotropic images. If you wish to resize your images, see the :doc:`convert_module_guide`
27+
2228
* CSV file name :
2329
You can then provide a model name, which will be used to name the csv file recording the status of each slice.
2430

docs/res/logo/logo_alpha.png

484 KB
Loading

napari_cellseg3d/_tests/test_review.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,21 @@
55

66
def test_launch_review(make_napari_viewer):
77

8-
view = make_napari_viewer()
9-
widget = rev.Reviewer(view)
8+
view = make_napari_viewer()
9+
widget = rev.Reviewer(view)
1010

11-
# widget.filetype_choice.setCurrentIndex(0)
11+
# widget.filetype_choice.setCurrentIndex(0)
1212

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

15-
widget.image_path = im_path
16-
widget.label_path = im_path
17-
18-
print(widget.image_path)
19-
print(widget.label_path)
20-
print(widget.as_folder)
21-
print(widget.filetype)
22-
widget.run_review()
23-
widget._viewer.close()
24-
25-
assert widget._viewer is not None
15+
widget.image_path = im_path
16+
widget.label_path = im_path
2617

18+
print(widget.image_path)
19+
print(widget.label_path)
20+
print(widget.as_folder)
21+
print(widget.filetype)
22+
widget.run_review()
23+
widget._viewer.close()
2724

25+
assert widget._viewer is not None

0 commit comments

Comments
 (0)