Skip to content

Commit 5d0c758

Browse files
committed
Update screenshots and enhance blob detection scenario in beautiful_app
- Replace outdated screenshot with a new blob detection image. - Modify the beautiful_app scenario to include blob detection on flower images. - Update documentation to reflect the new screenshot and scenario changes.
1 parent 1cf517b commit 5d0c758

6 files changed

Lines changed: 34 additions & 56 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ See [DataLab website](https://datalab-platform.com/) for more details.
1212

1313
ℹ️ Created by [CODRA](https://codra.net/)/[Pierre Raybaut](https://github.com/PierreRaybaut) in 2023, developed and maintained by DataLab Platform Developers.
1414

15-
![DataLab](https://raw.githubusercontent.com/DataLab-Platform/DataLab/main/doc/images/DataLab-Screenshot.png)
15+
![DataLab](https://raw.githubusercontent.com/DataLab-Platform/DataLab/main/doc/images/shots/i_blob_detection_flower.png)
1616

1717
ℹ️ DataLab is powered by [PlotPyStack](https://github.com/PlotPyStack) 🚀.
1818

datalab/tests/scenarios/beautiful_app.py

Lines changed: 31 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
# guitest: show,skip
2222

2323
import sigima.objects
24-
import sigima.params as sigima_param
24+
import sigima.params
2525
from sigima.tests.data import get_test_image
2626

27+
from datalab.config import Conf
2728
from datalab.tests import datalab_test_app_context
2829

2930

@@ -39,7 +40,7 @@ def run_beautiful_scenario(screenshots: bool = False) -> None:
3940
panel.processor.run_feature("wiener")
4041
panel.processor.run_feature("derivative")
4142
panel.processor.run_feature("integral")
42-
panel.processor.run_feature("gaussian_filter", sigima_param.GaussianParam())
43+
panel.processor.run_feature("gaussian_filter", sigima.params.GaussianParam())
4344
panel.processor.run_feature("fft")
4445
panel.processor.run_feature("derivative")
4546
if screenshots:
@@ -51,16 +52,16 @@ def run_beautiful_scenario(screenshots: bool = False) -> None:
5152
ima = sigima.objects.create_image_from_param(param)
5253
ima.set_metadata_option("colormap", "jet")
5354
panel.add_object(ima)
54-
panel.processor.run_feature("equalize_hist", sigima_param.EqualizeHistParam())
55+
panel.processor.run_feature("equalize_hist", sigima.params.EqualizeHistParam())
5556
panel.processor.run_feature(
56-
"equalize_adapthist", sigima_param.EqualizeAdaptHistParam()
57+
"equalize_adapthist", sigima.params.EqualizeAdaptHistParam()
5758
)
58-
panel.processor.run_feature("denoise_tv", sigima_param.DenoiseTVParam())
59+
panel.processor.run_feature("denoise_tv", sigima.params.DenoiseTVParam())
5960
panel.processor.run_feature(
60-
"denoise_wavelet", sigima_param.DenoiseWaveletParam()
61+
"denoise_wavelet", sigima.params.DenoiseWaveletParam()
6162
)
62-
panel.processor.run_feature("white_tophat", sigima_param.MorphologyParam())
63-
panel.processor.run_feature("denoise_tv", sigima_param.DenoiseTVParam())
63+
panel.processor.run_feature("white_tophat", sigima.params.MorphologyParam())
64+
panel.processor.run_feature("denoise_tv", sigima.params.DenoiseTVParam())
6465
n = data_size // 3
6566
roi = sigima.objects.create_image_roi(
6667
"rectangle", [n, n, data_size - 2 * n, data_size - 2 * n]
@@ -71,13 +72,15 @@ def run_beautiful_scenario(screenshots: bool = False) -> None:
7172
win.take_menu_screenshots()
7273

7374

74-
def run_circle_detection_scenario(screenshots: bool = False) -> None:
75+
def run_blob_detection_on_flower_image(screenshots: bool = False) -> None:
7576
"""High-level test scenario for flower image with ROI extraction
7677
7778
This scenario creates:
7879
- A flower test image
7980
- Roberts edge detection filter applied
8081
- A rectangular ROI extraction
82+
- A closing morphological filter to clean up the result
83+
- Blob detection using OpenCV algorithm
8184
"""
8285
with datalab_test_app_context(console=False, exec_loop=not screenshots) as win:
8386
# Create an image panel
@@ -86,59 +89,33 @@ def run_circle_detection_scenario(screenshots: bool = False) -> None:
8689
# Load the flower test image
8790
ima = get_test_image("flower.npy")
8891
ima.title = "Test image 'flower.npy'"
89-
ima.set_metadata_option("colormap", "jet")
9092
panel.add_object(ima)
9193

9294
# Apply Roberts filter for edge detection
9395
panel.processor.run_feature("roberts")
9496

9597
# Extract a rectangular ROI
96-
roi = sigima.objects.create_image_roi("rectangle", [32, 128, 448, 256])
98+
roi = sigima.objects.create_image_roi("rectangle", [32, 64, 448, 384])
9799
panel.processor.compute_roi_extraction(roi)
98100

99-
if screenshots:
100-
win.statusBar().hide()
101-
win.take_screenshot("i_flower_roi")
102-
103-
104-
def test_contour_detection_limits() -> None:
105-
"""Test scenario to verify result truncation limits work correctly
106-
107-
This scenario tests:
108-
- Contour detection on flower.npy (generates many contours)
109-
- Result truncation at max_result_rows limit
110-
- Shape drawing truncation at max_shapes_to_draw limit
111-
- Label display truncation at max_cells_in_label & max_cols_in_label limits
112-
- Warning dialog at max_cells_in_dialog limit
113-
"""
114-
with datalab_test_app_context(console=False, exec_loop=False) as win:
115-
# Create an image panel
116-
panel = win.imagepanel
117-
118-
# Load the flower test image
119-
ima = get_test_image("flower.npy")
120-
ima.title = "Test image 'flower.npy' - Contour Detection Limit Test"
121-
ima.set_metadata_option("colormap", "jet")
122-
panel.add_object(ima)
123-
124-
# Run contour detection which should trigger the limits
125-
# This will detect many contours and test our safety mechanisms
126-
print("\nRunning contour detection on flower.npy...")
127-
print("This should trigger result truncation and shape drawing limits.")
128-
panel.processor.run_feature("contour_shape", sigima_param.ContourShapeParam())
129-
130-
print("\nTest completed successfully!")
131-
print("Expected behavior:")
132-
print(" 1. Results truncated to max_result_rows (default: 1000)")
133-
print(" 2. Only max_shapes_to_draw shapes drawn (default: 50)")
134-
print(" 3. Warning label on plot showing truncation")
135-
print(" 4. Result dialog warning if > max_cells_in_dialog (default: 50000)")
136-
print(" 5. Merged label: max_cells_in_label (100) & max_cols_in_label (15)")
101+
# Apply a closing morphological filter to clean up the result
102+
closing_param = sigima.params.MorphologyParam.create(radius=10)
103+
panel.processor.run_feature("closing", closing_param)
104+
105+
# Detect blobs using OpenCV algorithm
106+
param = sigima.params.BlobOpenCVParam()
107+
param.filter_by_color = False
108+
param.min_area = 400
109+
param.max_area = 1000
110+
param.filter_by_circularity = True
111+
param.min_circularity = 0.7
112+
with Conf.proc.show_result_dialog.temp(False):
113+
with Conf.view.show_result_label.temp(False):
114+
panel.processor.run_feature("blob_opencv", param)
115+
if screenshots:
116+
win.statusBar().hide()
117+
win.take_screenshot("i_blob_detection_flower")
137118

138119

139120
if __name__ == "__main__":
140-
# Uncomment to run the original scenarios:
141-
# run_circle_detection_scenario()
142-
143-
# Run the test for result limits
144-
test_contour_detection_limits()
121+
run_blob_detection_on_flower_image(screenshots=False)

doc/features/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ data analysis and visualization platform.
2424
Overview & Common features
2525
--------------------------
2626

27-
.. figure:: /images/DataLab-Screenshot.png
27+
.. figure:: /images/shots/i_blob_detection_flower.png
2828

2929
DataLab main window
3030

doc/images/DataLab-Screenshot.png

-302 KB
Binary file not shown.
274 KB
Loading

doc/update_screenshots.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
launcher1_app_test.test_launcher1(screenshots=True)
1616
config.reset()
1717
beautiful_app.run_beautiful_scenario(screenshots=True)
18+
beautiful_app.run_blob_detection_on_flower_image(screenshots=True)
1819
settings_unit_test.capture_settings_screenshots()
1920
print("done.")

0 commit comments

Comments
 (0)