datalab-platform 0.0.1.dev0__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datalab/__init__.py +35 -2
- datalab/adapters_metadata/__init__.py +31 -0
- datalab/adapters_metadata/base_adapter.py +316 -0
- datalab/adapters_metadata/common.py +422 -0
- datalab/adapters_metadata/geometry_adapter.py +98 -0
- datalab/adapters_metadata/table_adapter.py +84 -0
- datalab/adapters_plotpy/__init__.py +54 -0
- datalab/adapters_plotpy/annotations.py +124 -0
- datalab/adapters_plotpy/base.py +110 -0
- datalab/adapters_plotpy/converters.py +86 -0
- datalab/adapters_plotpy/factories.py +80 -0
- datalab/adapters_plotpy/objects/__init__.py +0 -0
- datalab/adapters_plotpy/objects/base.py +197 -0
- datalab/adapters_plotpy/objects/image.py +157 -0
- datalab/adapters_plotpy/objects/scalar.py +565 -0
- datalab/adapters_plotpy/objects/signal.py +264 -0
- datalab/adapters_plotpy/roi/__init__.py +0 -0
- datalab/adapters_plotpy/roi/base.py +146 -0
- datalab/adapters_plotpy/roi/factory.py +93 -0
- datalab/adapters_plotpy/roi/image.py +207 -0
- datalab/adapters_plotpy/roi/signal.py +72 -0
- datalab/app.py +98 -0
- datalab/config.py +817 -0
- datalab/control/__init__.py +0 -0
- datalab/control/baseproxy.py +776 -0
- datalab/control/proxy.py +343 -0
- datalab/control/remote.py +1005 -0
- datalab/data/doc/DataLab_en.pdf +0 -0
- datalab/data/doc/DataLab_fr.pdf +0 -0
- datalab/data/icons/analysis/delete_results.svg +109 -0
- datalab/data/icons/analysis/fw1e2.svg +156 -0
- datalab/data/icons/analysis/fwhm.svg +156 -0
- datalab/data/icons/analysis/histogram.svg +49 -0
- datalab/data/icons/analysis/peak_detect.svg +160 -0
- datalab/data/icons/analysis/plot_results.svg +151 -0
- datalab/data/icons/analysis/show_results.svg +83 -0
- datalab/data/icons/analysis/stats.svg +49 -0
- datalab/data/icons/analysis.svg +120 -0
- datalab/data/icons/apply.svg +3 -0
- datalab/data/icons/check_all.svg +15 -0
- datalab/data/icons/collapse.svg +44 -0
- datalab/data/icons/collapse_selection.svg +63 -0
- datalab/data/icons/console.svg +101 -0
- datalab/data/icons/create/1d-normal.svg +8 -0
- datalab/data/icons/create/1d-poisson.svg +9 -0
- datalab/data/icons/create/1d-uniform.svg +8 -0
- datalab/data/icons/create/1d-zero.svg +57 -0
- datalab/data/icons/create/2d-gaussian.svg +56 -0
- datalab/data/icons/create/2d-normal.svg +38 -0
- datalab/data/icons/create/2d-poisson.svg +38 -0
- datalab/data/icons/create/2d-ramp.svg +90 -0
- datalab/data/icons/create/2d-sinc.svg +62 -0
- datalab/data/icons/create/2d-uniform.svg +38 -0
- datalab/data/icons/create/2d-zero.svg +13 -0
- datalab/data/icons/create/checkerboard.svg +39 -0
- datalab/data/icons/create/cosine.svg +12 -0
- datalab/data/icons/create/exponential.svg +55 -0
- datalab/data/icons/create/gaussian.svg +12 -0
- datalab/data/icons/create/grating.svg +29 -0
- datalab/data/icons/create/linear_chirp.svg +7 -0
- datalab/data/icons/create/logistic.svg +7 -0
- datalab/data/icons/create/lorentzian.svg +12 -0
- datalab/data/icons/create/planck.svg +12 -0
- datalab/data/icons/create/polynomial.svg +7 -0
- datalab/data/icons/create/pulse.svg +12 -0
- datalab/data/icons/create/ring.svg +18 -0
- datalab/data/icons/create/sawtooth.svg +7 -0
- datalab/data/icons/create/siemens.svg +35 -0
- datalab/data/icons/create/sinc.svg +12 -0
- datalab/data/icons/create/sine.svg +7 -0
- datalab/data/icons/create/square.svg +7 -0
- datalab/data/icons/create/square_pulse.svg +7 -0
- datalab/data/icons/create/step.svg +7 -0
- datalab/data/icons/create/step_pulse.svg +12 -0
- datalab/data/icons/create/triangle.svg +7 -0
- datalab/data/icons/create/voigt.svg +12 -0
- datalab/data/icons/edit/annotations.svg +72 -0
- datalab/data/icons/edit/annotations_copy.svg +114 -0
- datalab/data/icons/edit/annotations_delete.svg +83 -0
- datalab/data/icons/edit/annotations_edit.svg +98 -0
- datalab/data/icons/edit/annotations_export.svg +85 -0
- datalab/data/icons/edit/annotations_import.svg +85 -0
- datalab/data/icons/edit/annotations_paste.svg +100 -0
- datalab/data/icons/edit/copy_titles.svg +109 -0
- datalab/data/icons/edit/delete.svg +84 -0
- datalab/data/icons/edit/delete_all.svg +214 -0
- datalab/data/icons/edit/duplicate.svg +64 -0
- datalab/data/icons/edit/goto_source.svg +60 -0
- datalab/data/icons/edit/metadata.svg +60 -0
- datalab/data/icons/edit/metadata_add.svg +80 -0
- datalab/data/icons/edit/metadata_copy.svg +96 -0
- datalab/data/icons/edit/metadata_delete.svg +62 -0
- datalab/data/icons/edit/metadata_export.svg +68 -0
- datalab/data/icons/edit/metadata_import.svg +68 -0
- datalab/data/icons/edit/metadata_paste.svg +79 -0
- datalab/data/icons/edit/move_down.svg +55 -0
- datalab/data/icons/edit/move_up.svg +54 -0
- datalab/data/icons/edit/new_group.svg +76 -0
- datalab/data/icons/edit/recompute.svg +60 -0
- datalab/data/icons/edit/rename.svg +49 -0
- datalab/data/icons/edit.svg +16 -0
- datalab/data/icons/expand.svg +44 -0
- datalab/data/icons/expand_selection.svg +63 -0
- datalab/data/icons/fit/cdf_fit.svg +56 -0
- datalab/data/icons/fit/exponential_fit.svg +55 -0
- datalab/data/icons/fit/gaussian_fit.svg +62 -0
- datalab/data/icons/fit/interactive_fit.svg +101 -0
- datalab/data/icons/fit/linear_fit.svg +57 -0
- datalab/data/icons/fit/lorentzian_fit.svg +209 -0
- datalab/data/icons/fit/multigaussian_fit.svg +85 -0
- datalab/data/icons/fit/multilorentzian_fit.svg +85 -0
- datalab/data/icons/fit/piecewiseexponential_fit.svg +209 -0
- datalab/data/icons/fit/planckian_fit.svg +62 -0
- datalab/data/icons/fit/polynomial_fit.svg +59 -0
- datalab/data/icons/fit/sigmoid_fit.svg +56 -0
- datalab/data/icons/fit/sinusoidal_fit.svg +72 -0
- datalab/data/icons/fit/twohalfgaussian_fit.svg +63 -0
- datalab/data/icons/fit/voigt_fit.svg +57 -0
- datalab/data/icons/group.svg +56 -0
- datalab/data/icons/h5/h5array.svg +59 -0
- datalab/data/icons/h5/h5attrs.svg +75 -0
- datalab/data/icons/h5/h5browser.svg +133 -0
- datalab/data/icons/h5/h5file.svg +69 -0
- datalab/data/icons/h5/h5group.svg +49 -0
- datalab/data/icons/h5/h5scalar.svg +1 -0
- datalab/data/icons/help_pdf.svg +46 -0
- datalab/data/icons/history.svg +7 -0
- datalab/data/icons/image.svg +135 -0
- datalab/data/icons/io/fileopen_directory.svg +60 -0
- datalab/data/icons/io/fileopen_h5.svg +84 -0
- datalab/data/icons/io/fileopen_ima.svg +187 -0
- datalab/data/icons/io/fileopen_py.svg +123 -0
- datalab/data/icons/io/fileopen_sig.svg +138 -0
- datalab/data/icons/io/filesave_h5.svg +97 -0
- datalab/data/icons/io/filesave_ima.svg +200 -0
- datalab/data/icons/io/filesave_py.svg +136 -0
- datalab/data/icons/io/filesave_sig.svg +151 -0
- datalab/data/icons/io/import_text.svg +144 -0
- datalab/data/icons/io/save_to_directory.svg +134 -0
- datalab/data/icons/io.svg +84 -0
- datalab/data/icons/libre-camera-flash-off.svg +1 -0
- datalab/data/icons/libre-camera-flash-on.svg +1 -0
- datalab/data/icons/libre-gui-about.svg +1 -0
- datalab/data/icons/libre-gui-action-delete.svg +1 -0
- datalab/data/icons/libre-gui-add.svg +1 -0
- datalab/data/icons/libre-gui-arrow-down.svg +1 -0
- datalab/data/icons/libre-gui-arrow-left.svg +1 -0
- datalab/data/icons/libre-gui-arrow-right.svg +1 -0
- datalab/data/icons/libre-gui-arrow-up.svg +1 -0
- datalab/data/icons/libre-gui-close.svg +40 -0
- datalab/data/icons/libre-gui-cogs.svg +1 -0
- datalab/data/icons/libre-gui-globe.svg +1 -0
- datalab/data/icons/libre-gui-help.svg +1 -0
- datalab/data/icons/libre-gui-link.svg +1 -0
- datalab/data/icons/libre-gui-menu.svg +1 -0
- datalab/data/icons/libre-gui-pencil.svg +1 -0
- datalab/data/icons/libre-gui-plugin.svg +1 -0
- datalab/data/icons/libre-gui-questions.svg +1 -0
- datalab/data/icons/libre-gui-settings.svg +1 -0
- datalab/data/icons/libre-gui-unlink.svg +1 -0
- datalab/data/icons/libre-tech-ram.svg +1 -0
- datalab/data/icons/libre-toolbox.svg +1 -0
- datalab/data/icons/logs.svg +1 -0
- datalab/data/icons/markers.svg +74 -0
- datalab/data/icons/menu.svg +13 -0
- datalab/data/icons/new_ima.svg +148 -0
- datalab/data/icons/new_sig.svg +123 -0
- datalab/data/icons/operations/abs.svg +116 -0
- datalab/data/icons/operations/arithmetic.svg +123 -0
- datalab/data/icons/operations/average.svg +124 -0
- datalab/data/icons/operations/complex_from_magnitude_phase.svg +116 -0
- datalab/data/icons/operations/complex_from_real_imag.svg +124 -0
- datalab/data/icons/operations/constant.svg +116 -0
- datalab/data/icons/operations/constant_add.svg +109 -0
- datalab/data/icons/operations/constant_divide.svg +109 -0
- datalab/data/icons/operations/constant_multiply.svg +109 -0
- datalab/data/icons/operations/constant_subtract.svg +109 -0
- datalab/data/icons/operations/convert_dtype.svg +117 -0
- datalab/data/icons/operations/convolution.svg +46 -0
- datalab/data/icons/operations/deconvolution.svg +57 -0
- datalab/data/icons/operations/derivative.svg +127 -0
- datalab/data/icons/operations/difference.svg +52 -0
- datalab/data/icons/operations/division.svg +139 -0
- datalab/data/icons/operations/exp.svg +116 -0
- datalab/data/icons/operations/flip_horizontally.svg +69 -0
- datalab/data/icons/operations/flip_vertically.svg +74 -0
- datalab/data/icons/operations/im.svg +124 -0
- datalab/data/icons/operations/integral.svg +50 -0
- datalab/data/icons/operations/inverse.svg +143 -0
- datalab/data/icons/operations/log10.svg +109 -0
- datalab/data/icons/operations/phase.svg +116 -0
- datalab/data/icons/operations/power.svg +118 -0
- datalab/data/icons/operations/product.svg +124 -0
- datalab/data/icons/operations/profile.svg +379 -0
- datalab/data/icons/operations/profile_average.svg +399 -0
- datalab/data/icons/operations/profile_radial.svg +261 -0
- datalab/data/icons/operations/profile_segment.svg +262 -0
- datalab/data/icons/operations/quadratic_difference.svg +84 -0
- datalab/data/icons/operations/re.svg +124 -0
- datalab/data/icons/operations/rotate_left.svg +72 -0
- datalab/data/icons/operations/rotate_right.svg +72 -0
- datalab/data/icons/operations/signals_to_image.svg +314 -0
- datalab/data/icons/operations/sqrt.svg +110 -0
- datalab/data/icons/operations/std.svg +124 -0
- datalab/data/icons/operations/sum.svg +102 -0
- datalab/data/icons/play_demo.svg +9 -0
- datalab/data/icons/processing/axis_transform.svg +62 -0
- datalab/data/icons/processing/bandpass.svg +79 -0
- datalab/data/icons/processing/bandstop.svg +71 -0
- datalab/data/icons/processing/binning.svg +126 -0
- datalab/data/icons/processing/clip.svg +119 -0
- datalab/data/icons/processing/detrending.svg +173 -0
- datalab/data/icons/processing/distribute_on_grid.svg +769 -0
- datalab/data/icons/processing/edge_detection.svg +46 -0
- datalab/data/icons/processing/erase.svg +1 -0
- datalab/data/icons/processing/exposure.svg +143 -0
- datalab/data/icons/processing/fourier.svg +104 -0
- datalab/data/icons/processing/highpass.svg +59 -0
- datalab/data/icons/processing/interpolation.svg +71 -0
- datalab/data/icons/processing/level_adjustment.svg +70 -0
- datalab/data/icons/processing/lowpass.svg +60 -0
- datalab/data/icons/processing/morphology.svg +49 -0
- datalab/data/icons/processing/noise_addition.svg +114 -0
- datalab/data/icons/processing/noise_reduction.svg +38 -0
- datalab/data/icons/processing/normalize.svg +84 -0
- datalab/data/icons/processing/offset_correction.svg +131 -0
- datalab/data/icons/processing/resampling1d.svg +101 -0
- datalab/data/icons/processing/resampling2d.svg +240 -0
- datalab/data/icons/processing/reset_positions.svg +185 -0
- datalab/data/icons/processing/resize.svg +9 -0
- datalab/data/icons/processing/reverse_signal_x.svg +171 -0
- datalab/data/icons/processing/stability.svg +11 -0
- datalab/data/icons/processing/swap_x_y.svg +65 -0
- datalab/data/icons/processing/thresholding.svg +63 -0
- datalab/data/icons/processing/windowing.svg +45 -0
- datalab/data/icons/properties.svg +26 -0
- datalab/data/icons/reset.svg +9 -0
- datalab/data/icons/restore.svg +40 -0
- datalab/data/icons/roi/roi.svg +76 -0
- datalab/data/icons/roi/roi_coordinate.svg +78 -0
- datalab/data/icons/roi/roi_copy.svg +112 -0
- datalab/data/icons/roi/roi_delete.svg +81 -0
- datalab/data/icons/roi/roi_export.svg +87 -0
- datalab/data/icons/roi/roi_graphical.svg +78 -0
- datalab/data/icons/roi/roi_grid.svg +67 -0
- datalab/data/icons/roi/roi_ima.svg +188 -0
- datalab/data/icons/roi/roi_import.svg +87 -0
- datalab/data/icons/roi/roi_new.svg +81 -0
- datalab/data/icons/roi/roi_new_circle.svg +95 -0
- datalab/data/icons/roi/roi_new_polygon.svg +110 -0
- datalab/data/icons/roi/roi_new_rectangle.svg +70 -0
- datalab/data/icons/roi/roi_paste.svg +98 -0
- datalab/data/icons/roi/roi_sig.svg +124 -0
- datalab/data/icons/shapes.svg +134 -0
- datalab/data/icons/signal.svg +103 -0
- datalab/data/icons/table.svg +85 -0
- datalab/data/icons/table_unavailable.svg +102 -0
- datalab/data/icons/to_signal.svg +124 -0
- datalab/data/icons/tour/next.svg +44 -0
- datalab/data/icons/tour/previous.svg +44 -0
- datalab/data/icons/tour/rewind.svg +51 -0
- datalab/data/icons/tour/stop.svg +47 -0
- datalab/data/icons/tour/tour.svg +16 -0
- datalab/data/icons/uncheck_all.svg +78 -0
- datalab/data/icons/view/curve_antialiasing.svg +50 -0
- datalab/data/icons/view/new_window.svg +98 -0
- datalab/data/icons/view/refresh-auto.svg +57 -0
- datalab/data/icons/view/refresh-manual.svg +51 -0
- datalab/data/icons/view/reset_curve_styles.svg +96 -0
- datalab/data/icons/view/show_first.svg +55 -0
- datalab/data/icons/view/show_titles.svg +46 -0
- datalab/data/icons/visualization.svg +51 -0
- datalab/data/logo/DataLab-Banner-150.png +0 -0
- datalab/data/logo/DataLab-Banner-200.png +0 -0
- datalab/data/logo/DataLab-Banner2-100.png +0 -0
- datalab/data/logo/DataLab-Splash.png +0 -0
- datalab/data/logo/DataLab-watermark.png +0 -0
- datalab/data/logo/DataLab.svg +83 -0
- datalab/data/tests/reordering_test.h5 +0 -0
- datalab/data/tutorials/fabry_perot/fabry-perot1.jpg +0 -0
- datalab/data/tutorials/fabry_perot/fabry-perot2.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_13.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_18.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_23.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_30.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_35.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_40.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_45.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_50.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_55.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_60.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_65.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_70.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_75.jpg +0 -0
- datalab/data/tutorials/laser_beam/TEM00_z_80.jpg +0 -0
- datalab/env.py +542 -0
- datalab/gui/__init__.py +89 -0
- datalab/gui/actionhandler.py +1701 -0
- datalab/gui/docks.py +473 -0
- datalab/gui/h5io.py +150 -0
- datalab/gui/macroeditor.py +310 -0
- datalab/gui/main.py +2081 -0
- datalab/gui/newobject.py +217 -0
- datalab/gui/objectview.py +766 -0
- datalab/gui/panel/__init__.py +48 -0
- datalab/gui/panel/base.py +3254 -0
- datalab/gui/panel/image.py +157 -0
- datalab/gui/panel/macro.py +607 -0
- datalab/gui/panel/signal.py +164 -0
- datalab/gui/plothandler.py +800 -0
- datalab/gui/processor/__init__.py +84 -0
- datalab/gui/processor/base.py +2456 -0
- datalab/gui/processor/catcher.py +75 -0
- datalab/gui/processor/image.py +1214 -0
- datalab/gui/processor/signal.py +755 -0
- datalab/gui/profiledialog.py +333 -0
- datalab/gui/roieditor.py +633 -0
- datalab/gui/roigrideditor.py +208 -0
- datalab/gui/settings.py +612 -0
- datalab/gui/tour.py +908 -0
- datalab/h5/__init__.py +12 -0
- datalab/h5/common.py +314 -0
- datalab/h5/generic.py +580 -0
- datalab/h5/native.py +39 -0
- datalab/h5/utils.py +95 -0
- datalab/objectmodel.py +640 -0
- datalab/plugins/_readme_.txt +9 -0
- datalab/plugins/datalab_imageformats.py +175 -0
- datalab/plugins/datalab_testdata.py +190 -0
- datalab/plugins.py +355 -0
- datalab/tests/__init__.py +199 -0
- datalab/tests/backbone/__init__.py +1 -0
- datalab/tests/backbone/config_unit_test.py +170 -0
- datalab/tests/backbone/config_versioning_unit_test.py +34 -0
- datalab/tests/backbone/dictlistserial_app_test.py +38 -0
- datalab/tests/backbone/errorcatcher_unit_test.py +69 -0
- datalab/tests/backbone/errormsgbox_unit_test.py +50 -0
- datalab/tests/backbone/execenv_unit.py +262 -0
- datalab/tests/backbone/loadtest_gdi.py +147 -0
- datalab/tests/backbone/long_callback.py +96 -0
- datalab/tests/backbone/main_app_test.py +137 -0
- datalab/tests/backbone/memory_leak.py +43 -0
- datalab/tests/backbone/procisolation1_unit.py +128 -0
- datalab/tests/backbone/procisolation2_unit.py +171 -0
- datalab/tests/backbone/procisolation_unit_test.py +22 -0
- datalab/tests/backbone/profiling_app.py +27 -0
- datalab/tests/backbone/strings_unit_test.py +65 -0
- datalab/tests/backbone/title_formatting_unit_test.py +82 -0
- datalab/tests/conftest.py +131 -0
- datalab/tests/features/__init__.py +1 -0
- datalab/tests/features/applauncher/__init__.py +1 -0
- datalab/tests/features/applauncher/launcher1_app_test.py +28 -0
- datalab/tests/features/applauncher/launcher2_app_test.py +30 -0
- datalab/tests/features/common/__init__.py +1 -0
- datalab/tests/features/common/add_metadata_app_test.py +134 -0
- datalab/tests/features/common/add_metadata_unit_test.py +267 -0
- datalab/tests/features/common/annotations_management_unit_test.py +152 -0
- datalab/tests/features/common/auto_analysis_recompute_unit_test.py +240 -0
- datalab/tests/features/common/createobject_unit_test.py +50 -0
- datalab/tests/features/common/geometry_results_app_test.py +135 -0
- datalab/tests/features/common/interactive_processing_test.py +1109 -0
- datalab/tests/features/common/io_app_test.py +75 -0
- datalab/tests/features/common/large_results_app_test.py +187 -0
- datalab/tests/features/common/metadata_all_patterns_test.py +103 -0
- datalab/tests/features/common/metadata_app_test.py +139 -0
- datalab/tests/features/common/metadata_io_unit_test.py +60 -0
- datalab/tests/features/common/misc_app_test.py +236 -0
- datalab/tests/features/common/multiple_geometry_results_unit_test.py +122 -0
- datalab/tests/features/common/multiple_table_results_unit_test.py +64 -0
- datalab/tests/features/common/operation_modes_app_test.py +392 -0
- datalab/tests/features/common/plot_results_app_test.py +278 -0
- datalab/tests/features/common/reorder_app_test.py +75 -0
- datalab/tests/features/common/result_deletion_unit_test.py +96 -0
- datalab/tests/features/common/result_merged_label_unit_test.py +154 -0
- datalab/tests/features/common/result_shape_settings_unit_test.py +223 -0
- datalab/tests/features/common/roi_plotitem_unit_test.py +64 -0
- datalab/tests/features/common/roieditor_unit_test.py +102 -0
- datalab/tests/features/common/save_to_dir_app_test.py +163 -0
- datalab/tests/features/common/save_to_dir_unit_test.py +474 -0
- datalab/tests/features/common/stat_app_test.py +40 -0
- datalab/tests/features/common/stats_tools_unit_test.py +77 -0
- datalab/tests/features/common/table_results_app_test.py +52 -0
- datalab/tests/features/common/textimport_unit_test.py +131 -0
- datalab/tests/features/common/uuid_preservation_test.py +281 -0
- datalab/tests/features/common/worker_unit_test.py +402 -0
- datalab/tests/features/control/__init__.py +1 -0
- datalab/tests/features/control/connect_dialog.py +28 -0
- datalab/tests/features/control/embedded1_unit_test.py +304 -0
- datalab/tests/features/control/embedded2_unit_test.py +52 -0
- datalab/tests/features/control/remoteclient_app_test.py +219 -0
- datalab/tests/features/control/remoteclient_unit.py +75 -0
- datalab/tests/features/control/simpleclient_unit_test.py +321 -0
- datalab/tests/features/hdf5/__init__.py +1 -0
- datalab/tests/features/hdf5/h5browser1_unit_test.py +31 -0
- datalab/tests/features/hdf5/h5browser2_unit.py +55 -0
- datalab/tests/features/hdf5/h5browser_app_test.py +77 -0
- datalab/tests/features/hdf5/h5import_app_test.py +25 -0
- datalab/tests/features/hdf5/h5importer_app_test.py +34 -0
- datalab/tests/features/image/__init__.py +1 -0
- datalab/tests/features/image/annotations_app_test.py +28 -0
- datalab/tests/features/image/annotations_unit_test.py +80 -0
- datalab/tests/features/image/average_app_test.py +46 -0
- datalab/tests/features/image/background_dialog_test.py +70 -0
- datalab/tests/features/image/blobs_app_test.py +50 -0
- datalab/tests/features/image/contour_app_test.py +42 -0
- datalab/tests/features/image/contour_fabryperot_app_test.py +51 -0
- datalab/tests/features/image/denoise_app_test.py +31 -0
- datalab/tests/features/image/distribute_on_grid_app_test.py +95 -0
- datalab/tests/features/image/edges_app_test.py +31 -0
- datalab/tests/features/image/erase_app_test.py +21 -0
- datalab/tests/features/image/fft2d_app_test.py +27 -0
- datalab/tests/features/image/flatfield_app_test.py +40 -0
- datalab/tests/features/image/geometry_transform_unit_test.py +396 -0
- datalab/tests/features/image/imagetools_app_test.py +51 -0
- datalab/tests/features/image/imagetools_unit_test.py +27 -0
- datalab/tests/features/image/load_app_test.py +73 -0
- datalab/tests/features/image/morph_app_test.py +32 -0
- datalab/tests/features/image/offsetcorrection_app_test.py +30 -0
- datalab/tests/features/image/peak2d_app_test.py +53 -0
- datalab/tests/features/image/profile_app_test.py +73 -0
- datalab/tests/features/image/profile_dialog_test.py +56 -0
- datalab/tests/features/image/roi_app_test.py +98 -0
- datalab/tests/features/image/roi_circ_app_test.py +62 -0
- datalab/tests/features/image/roi_manipulation_app_test.py +268 -0
- datalab/tests/features/image/roigrid_unit_test.py +60 -0
- datalab/tests/features/image/side_by_side_app_test.py +52 -0
- datalab/tests/features/macro/__init__.py +1 -0
- datalab/tests/features/macro/macro_app_test.py +28 -0
- datalab/tests/features/macro/macroeditor_unit_test.py +102 -0
- datalab/tests/features/signal/__init__.py +1 -0
- datalab/tests/features/signal/baseline_dialog_test.py +53 -0
- datalab/tests/features/signal/deltax_dialog_unit_test.py +34 -0
- datalab/tests/features/signal/fft1d_app_test.py +26 -0
- datalab/tests/features/signal/filter_app_test.py +44 -0
- datalab/tests/features/signal/fitdialog_unit_test.py +50 -0
- datalab/tests/features/signal/interpolation_app_test.py +110 -0
- datalab/tests/features/signal/loadbigsignal_app_test.py +80 -0
- datalab/tests/features/signal/multiple_rois_unit_test.py +132 -0
- datalab/tests/features/signal/pulse_features_app_test.py +118 -0
- datalab/tests/features/signal/pulse_features_roi_app_test.py +55 -0
- datalab/tests/features/signal/roi_app_test.py +78 -0
- datalab/tests/features/signal/roi_manipulation_app_test.py +261 -0
- datalab/tests/features/signal/select_xy_cursor_unit_test.py +46 -0
- datalab/tests/features/signal/signalpeakdetection_dialog_test.py +33 -0
- datalab/tests/features/signal/signals_to_image_app_test.py +98 -0
- datalab/tests/features/signal/xarray_compat_app_test.py +128 -0
- datalab/tests/features/tour_unit_test.py +22 -0
- datalab/tests/features/utilities/__init__.py +1 -0
- datalab/tests/features/utilities/installconf_unit_test.py +21 -0
- datalab/tests/features/utilities/logview_app_test.py +21 -0
- datalab/tests/features/utilities/logview_error.py +24 -0
- datalab/tests/features/utilities/logview_unit_test.py +21 -0
- datalab/tests/features/utilities/memstatus_app_test.py +42 -0
- datalab/tests/features/utilities/settings_unit_test.py +88 -0
- datalab/tests/scenarios/__init__.py +1 -0
- datalab/tests/scenarios/beautiful_app.py +121 -0
- datalab/tests/scenarios/common.py +463 -0
- datalab/tests/scenarios/demo.py +212 -0
- datalab/tests/scenarios/example_app_test.py +47 -0
- datalab/tests/scenarios/scenario_h5_app_test.py +75 -0
- datalab/tests/scenarios/scenario_ima1_app_test.py +34 -0
- datalab/tests/scenarios/scenario_ima2_app_test.py +34 -0
- datalab/tests/scenarios/scenario_mac_app_test.py +58 -0
- datalab/tests/scenarios/scenario_sig1_app_test.py +36 -0
- datalab/tests/scenarios/scenario_sig2_app_test.py +35 -0
- datalab/utils/__init__.py +1 -0
- datalab/utils/conf.py +304 -0
- datalab/utils/dephash.py +105 -0
- datalab/utils/qthelpers.py +633 -0
- datalab/utils/strings.py +34 -0
- datalab/utils/tests.py +0 -0
- datalab/widgets/__init__.py +1 -0
- datalab/widgets/connection.py +138 -0
- datalab/widgets/filedialog.py +91 -0
- datalab/widgets/fileviewer.py +84 -0
- datalab/widgets/fitdialog.py +788 -0
- datalab/widgets/h5browser.py +1048 -0
- datalab/widgets/imagebackground.py +111 -0
- datalab/widgets/instconfviewer.py +175 -0
- datalab/widgets/logviewer.py +80 -0
- datalab/widgets/signalbaseline.py +90 -0
- datalab/widgets/signalcursor.py +208 -0
- datalab/widgets/signaldeltax.py +151 -0
- datalab/widgets/signalpeak.py +199 -0
- datalab/widgets/status.py +249 -0
- datalab/widgets/textimport.py +786 -0
- datalab/widgets/warningerror.py +223 -0
- datalab/widgets/wizard.py +286 -0
- datalab_platform-1.0.0.dist-info/METADATA +121 -0
- datalab_platform-1.0.0.dist-info/RECORD +494 -0
- datalab_platform-0.0.1.dev0.dist-info/METADATA +0 -67
- datalab_platform-0.0.1.dev0.dist-info/RECORD +0 -7
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.0.dist-info}/WHEEL +0 -0
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.0.dist-info}/entry_points.txt +0 -0
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.0.dist-info}/licenses/LICENSE +0 -0
- {datalab_platform-0.0.1.dev0.dist-info → datalab_platform-1.0.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PlotPy Adapter Signal Module
|
|
5
|
+
----------------------------
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# pylint: disable=invalid-name # Allows short reference names like x, y, ...
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from contextlib import contextmanager
|
|
13
|
+
from typing import Generator
|
|
14
|
+
|
|
15
|
+
import numpy as np
|
|
16
|
+
from guidata.dataset import restore_dataset, update_dataset
|
|
17
|
+
from plotpy.builder import make
|
|
18
|
+
from plotpy.items import CurveItem
|
|
19
|
+
from sigima.objects import SignalObj
|
|
20
|
+
|
|
21
|
+
from datalab.adapters_plotpy.objects.base import (
|
|
22
|
+
BaseObjPlotPyAdapter,
|
|
23
|
+
)
|
|
24
|
+
from datalab.config import Conf
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class CurveStyles:
|
|
28
|
+
"""Object to manage curve styles"""
|
|
29
|
+
|
|
30
|
+
#: Curve colors
|
|
31
|
+
COLORS = (
|
|
32
|
+
"#1f77b4", # muted blue
|
|
33
|
+
"#ff7f0e", # safety orange
|
|
34
|
+
"#2ca02c", # cooked asparagus green
|
|
35
|
+
"#d62728", # brick red
|
|
36
|
+
"#9467bd", # muted purple
|
|
37
|
+
"#8c564b", # chestnut brown
|
|
38
|
+
"#e377c2", # raspberry yogurt pink
|
|
39
|
+
"#7f7f7f", # gray
|
|
40
|
+
"#bcbd22", # curry yellow-green
|
|
41
|
+
"#17becf", # blue-teal
|
|
42
|
+
)
|
|
43
|
+
#: Curve line styles
|
|
44
|
+
LINESTYLES = ("SolidLine", "DashLine", "DashDotLine", "DashDotDotLine")
|
|
45
|
+
|
|
46
|
+
def __init__(self) -> None:
|
|
47
|
+
self.__suspend = False
|
|
48
|
+
self.curve_style = self.style_generator()
|
|
49
|
+
|
|
50
|
+
@staticmethod
|
|
51
|
+
def style_generator() -> Generator[tuple[str, str], None, None]:
|
|
52
|
+
"""Cycling through curve styles"""
|
|
53
|
+
while True:
|
|
54
|
+
for linestyle in CurveStyles.LINESTYLES:
|
|
55
|
+
for color in CurveStyles.COLORS:
|
|
56
|
+
yield (color, linestyle)
|
|
57
|
+
|
|
58
|
+
def apply_style(self, item: CurveItem) -> None:
|
|
59
|
+
"""Apply style to curve
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
item: curve item
|
|
63
|
+
"""
|
|
64
|
+
if self.__suspend:
|
|
65
|
+
# Suspend mode: always apply the first style
|
|
66
|
+
color, linestyle = CurveStyles.COLORS[0], CurveStyles.LINESTYLES[0]
|
|
67
|
+
else:
|
|
68
|
+
color, linestyle = next(self.curve_style)
|
|
69
|
+
item.param.line.color = color
|
|
70
|
+
item.param.line.style = linestyle
|
|
71
|
+
item.param.symbol.marker = "NoSymbol"
|
|
72
|
+
# Note: line width is set separately via apply_line_width()
|
|
73
|
+
# to ensure it's always recalculated based on current data size and settings
|
|
74
|
+
|
|
75
|
+
def reset_styles(self) -> None:
|
|
76
|
+
"""Reset styles"""
|
|
77
|
+
self.curve_style = self.style_generator()
|
|
78
|
+
|
|
79
|
+
@contextmanager
|
|
80
|
+
def alternative(
|
|
81
|
+
self, other_style_generator: Generator[tuple[str, str], None, None]
|
|
82
|
+
) -> Generator[None, None, None]:
|
|
83
|
+
"""Use an alternative style generator"""
|
|
84
|
+
old_style_generator = self.curve_style
|
|
85
|
+
self.curve_style = other_style_generator
|
|
86
|
+
yield
|
|
87
|
+
self.curve_style = old_style_generator
|
|
88
|
+
|
|
89
|
+
@contextmanager
|
|
90
|
+
def suspend(self) -> Generator[None, None, None]:
|
|
91
|
+
"""Suspend style generator"""
|
|
92
|
+
self.__suspend = True
|
|
93
|
+
yield
|
|
94
|
+
self.__suspend = False
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
CURVESTYLES = CurveStyles() # This is the unique instance of the CurveStyles class
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def apply_line_width(item: CurveItem) -> None:
|
|
101
|
+
"""Apply line width to curve item with smart clamping for large datasets
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
item: curve item
|
|
105
|
+
"""
|
|
106
|
+
# Get data size
|
|
107
|
+
data_size = item.get_data()[0].size
|
|
108
|
+
|
|
109
|
+
# Get configured line width
|
|
110
|
+
line_width = Conf.view.sig_linewidth.get()
|
|
111
|
+
|
|
112
|
+
# For large datasets, clamp linewidth to 1.0 for performance
|
|
113
|
+
# (thick lines cause ~10x rendering slowdown due to Qt raster engine)
|
|
114
|
+
threshold = Conf.view.sig_linewidth_perfs_threshold.get()
|
|
115
|
+
if data_size > threshold and line_width > 1.0:
|
|
116
|
+
line_width = 1.0
|
|
117
|
+
|
|
118
|
+
# Apply the line width
|
|
119
|
+
item.param.line.width = line_width
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def apply_downsampling(item: CurveItem, do_not_update: bool = False) -> None:
|
|
123
|
+
"""Apply downsampling to curve item
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
item: curve item
|
|
127
|
+
do_not_update: if True, do not update the item even if the downsampling
|
|
128
|
+
parameters have changed
|
|
129
|
+
"""
|
|
130
|
+
old_use_dsamp = item.param.use_dsamp
|
|
131
|
+
item.param.use_dsamp = False
|
|
132
|
+
if Conf.view.sig_autodownsampling.get():
|
|
133
|
+
nbpoints = item.get_data()[0].size
|
|
134
|
+
maxpoints = Conf.view.sig_autodownsampling_maxpoints.get()
|
|
135
|
+
if nbpoints > 5 * maxpoints:
|
|
136
|
+
item.param.use_dsamp = True
|
|
137
|
+
item.param.dsamp_factor = nbpoints // maxpoints
|
|
138
|
+
if not do_not_update and old_use_dsamp != item.param.use_dsamp:
|
|
139
|
+
item.update_data()
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class SignalObjPlotPyAdapter(BaseObjPlotPyAdapter[SignalObj, CurveItem]):
|
|
143
|
+
"""Signal object plot item adapter class"""
|
|
144
|
+
|
|
145
|
+
CONF_FMT = Conf.view.sig_format
|
|
146
|
+
DEFAULT_FMT = "g"
|
|
147
|
+
|
|
148
|
+
def update_plot_item_parameters(self, item: CurveItem) -> None:
|
|
149
|
+
"""Update plot item parameters from object data/metadata
|
|
150
|
+
|
|
151
|
+
Takes into account a subset of plot item parameters. Those parameters may
|
|
152
|
+
have been overriden by object metadata entries or other object data. The goal
|
|
153
|
+
is to update the plot item accordingly.
|
|
154
|
+
|
|
155
|
+
This is *almost* the inverse operation of `update_metadata_from_plot_item`.
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
item: plot item
|
|
159
|
+
"""
|
|
160
|
+
update_dataset(item.param.line, self.obj.metadata)
|
|
161
|
+
update_dataset(item.param.symbol, self.obj.metadata)
|
|
162
|
+
super().update_plot_item_parameters(item)
|
|
163
|
+
|
|
164
|
+
def update_metadata_from_plot_item(self, item: CurveItem) -> None:
|
|
165
|
+
"""Update metadata from plot item.
|
|
166
|
+
|
|
167
|
+
Takes into account a subset of plot item parameters. Those parameters may
|
|
168
|
+
have been modified by the user through the plot item GUI. The goal is to
|
|
169
|
+
update the metadata accordingly.
|
|
170
|
+
|
|
171
|
+
This is *almost* the inverse operation of `update_plot_item_parameters`.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
item: plot item
|
|
175
|
+
"""
|
|
176
|
+
super().update_metadata_from_plot_item(item)
|
|
177
|
+
restore_dataset(item.param.line, self.obj.metadata)
|
|
178
|
+
restore_dataset(item.param.symbol, self.obj.metadata)
|
|
179
|
+
|
|
180
|
+
def make_item(self, update_from: CurveItem | None = None) -> CurveItem:
|
|
181
|
+
"""Make plot item from data.
|
|
182
|
+
|
|
183
|
+
Args:
|
|
184
|
+
update_from: plot item to update from
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
Plot item
|
|
188
|
+
"""
|
|
189
|
+
o = self.obj
|
|
190
|
+
if len(o.xydata) in (2, 4):
|
|
191
|
+
assert isinstance(o.xydata, np.ndarray)
|
|
192
|
+
if len(o.xydata) == 2: # x, y signal
|
|
193
|
+
x, y = o.xydata
|
|
194
|
+
item = make.mcurve(x.real, y.real, label=o.title)
|
|
195
|
+
else: # x, y, dx, dy error bar signal
|
|
196
|
+
x, y, dx, dy = o.xydata
|
|
197
|
+
if o.dx is None and o.dy is None: # x, y signal with no error
|
|
198
|
+
item = make.mcurve(x.real, y.real, label=o.title)
|
|
199
|
+
elif o.dx is None: # x, y, dy error bar signal with y error
|
|
200
|
+
item = make.merror(x.real, y.real, dy.real, label=o.title)
|
|
201
|
+
else: # x, y, dx, dy error bar signal with x error
|
|
202
|
+
dy = np.zeros_like(y) if dy is None else dy
|
|
203
|
+
item = make.merror(x.real, y.real, dx.real, dy.real, label=o.title)
|
|
204
|
+
# Apply style (without linewidth, will be set separately)
|
|
205
|
+
CURVESTYLES.apply_style(item)
|
|
206
|
+
apply_downsampling(item, do_not_update=True)
|
|
207
|
+
# Apply linewidth with smart clamping based on actual data size
|
|
208
|
+
apply_line_width(item)
|
|
209
|
+
else:
|
|
210
|
+
raise RuntimeError("data not supported")
|
|
211
|
+
if update_from is None:
|
|
212
|
+
self.update_plot_item_parameters(item)
|
|
213
|
+
else:
|
|
214
|
+
update_dataset(item.param, update_from.param)
|
|
215
|
+
item.update_params()
|
|
216
|
+
return item
|
|
217
|
+
|
|
218
|
+
def update_item(self, item: CurveItem, data_changed: bool = True) -> None:
|
|
219
|
+
"""Update plot item from data.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
item: plot item
|
|
223
|
+
data_changed: if True, data has changed
|
|
224
|
+
"""
|
|
225
|
+
o = self.obj
|
|
226
|
+
if data_changed:
|
|
227
|
+
assert isinstance(o.xydata, np.ndarray)
|
|
228
|
+
if len(o.xydata) == 2: # x, y signal
|
|
229
|
+
x, y = o.xydata
|
|
230
|
+
assert isinstance(x, np.ndarray) and isinstance(y, np.ndarray)
|
|
231
|
+
item.set_data(x.real, y.real)
|
|
232
|
+
elif len(o.xydata) == 3: # x, y, dy error bar signal
|
|
233
|
+
x, y, dy = o.xydata
|
|
234
|
+
assert (
|
|
235
|
+
isinstance(x, np.ndarray)
|
|
236
|
+
and isinstance(y, np.ndarray)
|
|
237
|
+
and isinstance(dy, np.ndarray)
|
|
238
|
+
)
|
|
239
|
+
item.set_data(x.real, y.real, dy=dy.real)
|
|
240
|
+
elif len(o.xydata) == 4: # x, y, dx, dy error bar signal
|
|
241
|
+
x, y, dx, dy = o.xydata
|
|
242
|
+
assert (
|
|
243
|
+
isinstance(x, np.ndarray)
|
|
244
|
+
and isinstance(y, np.ndarray)
|
|
245
|
+
and isinstance(dx, np.ndarray)
|
|
246
|
+
and isinstance(dy, np.ndarray)
|
|
247
|
+
)
|
|
248
|
+
item.set_data(x.real, y.real, dx.real, dy.real)
|
|
249
|
+
item.param.label = o.title
|
|
250
|
+
apply_downsampling(item)
|
|
251
|
+
# Reapply linewidth with smart clamping (data size may have changed)
|
|
252
|
+
apply_line_width(item)
|
|
253
|
+
self.update_plot_item_parameters(item)
|
|
254
|
+
|
|
255
|
+
def add_label_with_title(self, title: str | None = None) -> None:
|
|
256
|
+
"""Add label with title annotation
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
title: title (if None, use signal title)
|
|
260
|
+
"""
|
|
261
|
+
title = self.obj.title if title is None else title
|
|
262
|
+
if title:
|
|
263
|
+
label = make.label(title, "TL", (0, 0), "TL")
|
|
264
|
+
self.add_annotations_from_items([label])
|
|
File without changes
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
PlotPy Adapter Base ROI Module
|
|
5
|
+
------------------------------
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import abc
|
|
9
|
+
from typing import TYPE_CHECKING, Generic, Iterator, Literal, TypeVar
|
|
10
|
+
|
|
11
|
+
from plotpy.items import AnnotatedShape
|
|
12
|
+
from sigima.objects.base import (
|
|
13
|
+
BaseROI,
|
|
14
|
+
TypeObj,
|
|
15
|
+
TypeROI,
|
|
16
|
+
TypeROIParam,
|
|
17
|
+
TypeSingleROI,
|
|
18
|
+
get_generic_roi_title,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
from datalab.adapters_plotpy.base import config_annotated_shape
|
|
22
|
+
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from plotpy.items import (
|
|
25
|
+
AnnotatedCircle,
|
|
26
|
+
AnnotatedPolygon,
|
|
27
|
+
AnnotatedRectangle,
|
|
28
|
+
AnnotatedXRange,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
TypeROIItem = TypeVar(
|
|
32
|
+
"TypeROIItem",
|
|
33
|
+
bound="AnnotatedXRange | AnnotatedPolygon | AnnotatedRectangle | AnnotatedCircle",
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class BaseSingleROIPlotPyAdapter(Generic[TypeSingleROI, TypeROIItem], abc.ABC):
|
|
38
|
+
"""Base class for single ROI plot item adapter
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
single_roi: single ROI object
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
def __init__(self, single_roi: TypeSingleROI) -> None:
|
|
45
|
+
self.single_roi = single_roi
|
|
46
|
+
|
|
47
|
+
@abc.abstractmethod
|
|
48
|
+
def to_plot_item(self, obj: TypeObj) -> TypeROIItem:
|
|
49
|
+
"""Make ROI plot item from ROI.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
obj: object (signal/image), for physical-indices coordinates conversion
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
Plot item
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
@abc.abstractmethod
|
|
60
|
+
def from_plot_item(cls, item: TypeROIItem) -> TypeSingleROI:
|
|
61
|
+
"""Create single ROI from plot item
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
item: plot item
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
Single ROI
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def configure_roi_item(
|
|
72
|
+
item: TypeROIItem,
|
|
73
|
+
fmt: str,
|
|
74
|
+
lbl: bool,
|
|
75
|
+
editable: bool,
|
|
76
|
+
option: Literal["s", "i"],
|
|
77
|
+
):
|
|
78
|
+
"""Configure ROI plot item.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
item: plot item
|
|
82
|
+
fmt: numeric format (e.g. "%.3f")
|
|
83
|
+
lbl: if True, show shape labels
|
|
84
|
+
editable: if True, make shape editable
|
|
85
|
+
option: shape style option ("s" for signal, "i" for image)
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
Plot item
|
|
89
|
+
"""
|
|
90
|
+
option += "/" + ("editable" if editable else "readonly")
|
|
91
|
+
if not editable:
|
|
92
|
+
if isinstance(item, AnnotatedShape):
|
|
93
|
+
config_annotated_shape(
|
|
94
|
+
item, fmt, lbl, "roi", option, show_computations=editable
|
|
95
|
+
)
|
|
96
|
+
item.set_movable(False)
|
|
97
|
+
item.set_resizable(False)
|
|
98
|
+
item.set_readonly(True)
|
|
99
|
+
item.set_style("roi", option)
|
|
100
|
+
return item
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class BaseROIPlotPyAdapter(Generic[TypeROI], abc.ABC):
|
|
104
|
+
"""ROI plot item adapter class
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
roi: ROI object
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
def __init__(self, roi: BaseROI[TypeObj, TypeSingleROI, TypeROIParam]) -> None:
|
|
111
|
+
self.roi = roi
|
|
112
|
+
|
|
113
|
+
@abc.abstractmethod
|
|
114
|
+
def to_plot_item(self, single_roi: TypeSingleROI, obj: TypeObj) -> TypeROIItem:
|
|
115
|
+
"""Make ROI plot item from single ROI
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
single_roi: single ROI object
|
|
119
|
+
obj: object (signal/image), for physical-indices coordinates conversion
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
Plot item
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
def iterate_roi_items(
|
|
126
|
+
self, obj: TypeObj, fmt: str, lbl: bool, editable: bool = True
|
|
127
|
+
) -> Iterator[TypeROIItem]:
|
|
128
|
+
"""Iterate over ROI plot items associated to each single ROI composing
|
|
129
|
+
the object.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
obj: object (signal/image), for physical-indices coordinates conversion
|
|
133
|
+
fmt: format string
|
|
134
|
+
lbl: if True, add label
|
|
135
|
+
editable: if True, ROI is editable
|
|
136
|
+
|
|
137
|
+
Yields:
|
|
138
|
+
Plot item
|
|
139
|
+
"""
|
|
140
|
+
for index, single_roi in enumerate(self.roi.single_rois):
|
|
141
|
+
roi_item = self.to_plot_item(single_roi, obj)
|
|
142
|
+
item = configure_roi_item(
|
|
143
|
+
roi_item, fmt, lbl, editable, option=self.roi.PREFIX
|
|
144
|
+
)
|
|
145
|
+
item.setTitle(single_roi.title or get_generic_roi_title(index))
|
|
146
|
+
yield item
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
ROI Adapter Factory
|
|
5
|
+
-------------------
|
|
6
|
+
|
|
7
|
+
Factory functions for creating ROI adapters without circular imports.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import TYPE_CHECKING
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from sigima.objects.base import TypeObj
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def create_roi_adapter(roi):
|
|
19
|
+
"""Create ROI adapter from ROI object
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
roi: ROI object
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
ROI adapter instance
|
|
26
|
+
"""
|
|
27
|
+
# pylint: disable=import-outside-toplevel
|
|
28
|
+
from sigima.objects import (
|
|
29
|
+
CircularROI,
|
|
30
|
+
ImageROI,
|
|
31
|
+
PolygonalROI,
|
|
32
|
+
RectangularROI,
|
|
33
|
+
SegmentROI,
|
|
34
|
+
SignalROI,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
if isinstance(roi, SignalROI):
|
|
38
|
+
from datalab.adapters_plotpy.roi.signal import SignalROIPlotPyAdapter
|
|
39
|
+
|
|
40
|
+
return SignalROIPlotPyAdapter(roi)
|
|
41
|
+
if isinstance(roi, RectangularROI):
|
|
42
|
+
from datalab.adapters_plotpy.roi.image import RectangularROIPlotPyAdapter
|
|
43
|
+
|
|
44
|
+
return RectangularROIPlotPyAdapter(roi)
|
|
45
|
+
if isinstance(roi, CircularROI):
|
|
46
|
+
from datalab.adapters_plotpy.roi.image import CircularROIPlotPyAdapter
|
|
47
|
+
|
|
48
|
+
return CircularROIPlotPyAdapter(roi)
|
|
49
|
+
if isinstance(roi, PolygonalROI):
|
|
50
|
+
from datalab.adapters_plotpy.roi.image import PolygonalROIPlotPyAdapter
|
|
51
|
+
|
|
52
|
+
return PolygonalROIPlotPyAdapter(roi)
|
|
53
|
+
if isinstance(roi, ImageROI):
|
|
54
|
+
from datalab.adapters_plotpy.roi.image import ImageROIPlotPyAdapter
|
|
55
|
+
|
|
56
|
+
return ImageROIPlotPyAdapter(roi)
|
|
57
|
+
if isinstance(roi, SegmentROI):
|
|
58
|
+
from datalab.adapters_plotpy.roi.signal import SegmentROIPlotPyAdapter
|
|
59
|
+
|
|
60
|
+
return SegmentROIPlotPyAdapter(roi)
|
|
61
|
+
raise TypeError(f"Unsupported ROI type: {type(roi)}")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def create_single_roi_plot_item(single_roi, obj: TypeObj):
|
|
65
|
+
"""Create plot item from single ROI
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
single_roi: single ROI object
|
|
69
|
+
obj: object (signal/image), for physical-indices coordinates conversion
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
Plot item
|
|
73
|
+
"""
|
|
74
|
+
# pylint: disable=import-outside-toplevel
|
|
75
|
+
from sigima.objects import (
|
|
76
|
+
CircularROI,
|
|
77
|
+
PolygonalROI,
|
|
78
|
+
RectangularROI,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
if isinstance(single_roi, RectangularROI):
|
|
82
|
+
from datalab.adapters_plotpy.roi.image import RectangularROIPlotPyAdapter
|
|
83
|
+
|
|
84
|
+
return RectangularROIPlotPyAdapter(single_roi).to_plot_item(obj)
|
|
85
|
+
if isinstance(single_roi, CircularROI):
|
|
86
|
+
from datalab.adapters_plotpy.roi.image import CircularROIPlotPyAdapter
|
|
87
|
+
|
|
88
|
+
return CircularROIPlotPyAdapter(single_roi).to_plot_item(obj)
|
|
89
|
+
if isinstance(single_roi, PolygonalROI):
|
|
90
|
+
from datalab.adapters_plotpy.roi.image import PolygonalROIPlotPyAdapter
|
|
91
|
+
|
|
92
|
+
return PolygonalROIPlotPyAdapter(single_roi).to_plot_item(obj)
|
|
93
|
+
raise TypeError(f"Unsupported ROI type: {type(single_roi)}")
|