PaIRS-UniNa 0.2.10__cp313-cp313-macosx_11_0_universal2.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.
- PaIRS_UniNa/Calibration_Tab.py +347 -0
- PaIRS_UniNa/Changes.txt +174 -0
- PaIRS_UniNa/Custom_Top.py +303 -0
- PaIRS_UniNa/Explorer.py +3322 -0
- PaIRS_UniNa/FolderLoop.py +562 -0
- PaIRS_UniNa/Input_Tab.py +829 -0
- PaIRS_UniNa/Input_Tab_CalVi.py +787 -0
- PaIRS_UniNa/Input_Tab_tools.py +3026 -0
- PaIRS_UniNa/Log_Tab.py +110 -0
- PaIRS_UniNa/Output_Tab.py +922 -0
- PaIRS_UniNa/PaIRS.py +18 -0
- PaIRS_UniNa/PaIRS_PIV.py +873 -0
- PaIRS_UniNa/PaIRS_pypacks.py +1374 -0
- PaIRS_UniNa/Process_Tab.py +1761 -0
- PaIRS_UniNa/Process_Tab_CalVi.py +313 -0
- PaIRS_UniNa/Process_Tab_Disp.py +170 -0
- PaIRS_UniNa/Process_Tab_Min.py +120 -0
- PaIRS_UniNa/ResizePopup.py +55 -0
- PaIRS_UniNa/SPIVCalHelp.py +155 -0
- PaIRS_UniNa/Saving_tools.py +298 -0
- PaIRS_UniNa/TabTools.py +1413 -0
- PaIRS_UniNa/Vis_Tab.py +2176 -0
- PaIRS_UniNa/Vis_Tab_CalVi.py +982 -0
- PaIRS_UniNa/Whatsnew.py +130 -0
- PaIRS_UniNa/_PaIRS_PIV.so +0 -0
- PaIRS_UniNa/__init__.py +6 -0
- PaIRS_UniNa/__main__.py +45 -0
- PaIRS_UniNa/addwidgets_ps.py +1633 -0
- PaIRS_UniNa/calib.py +1488 -0
- PaIRS_UniNa/calibView.py +833 -0
- PaIRS_UniNa/gPaIRS.py +3957 -0
- PaIRS_UniNa/gPalette.py +189 -0
- PaIRS_UniNa/icons/abort.png +0 -0
- PaIRS_UniNa/icons/about.png +0 -0
- PaIRS_UniNa/icons/align_all.png +0 -0
- PaIRS_UniNa/icons/announcement.png +0 -0
- PaIRS_UniNa/icons/automatic_levels_off.png +0 -0
- PaIRS_UniNa/icons/automatic_levels_on.png +0 -0
- PaIRS_UniNa/icons/automatic_off.png +0 -0
- PaIRS_UniNa/icons/automatic_on.png +0 -0
- PaIRS_UniNa/icons/automatic_size_off.png +0 -0
- PaIRS_UniNa/icons/automatic_size_on.png +0 -0
- PaIRS_UniNa/icons/axes.png +0 -0
- PaIRS_UniNa/icons/background.png +0 -0
- PaIRS_UniNa/icons/background_vectors.png +0 -0
- PaIRS_UniNa/icons/bin_off.png +0 -0
- PaIRS_UniNa/icons/bin_on.png +0 -0
- PaIRS_UniNa/icons/browse_file_c.png +0 -0
- PaIRS_UniNa/icons/browse_folder_c.png +0 -0
- PaIRS_UniNa/icons/brush_cursor.png +0 -0
- PaIRS_UniNa/icons/bugfix.png +0 -0
- PaIRS_UniNa/icons/cal_proc.png +0 -0
- PaIRS_UniNa/icons/cal_proc_off.png +0 -0
- PaIRS_UniNa/icons/cal_step.png +0 -0
- PaIRS_UniNa/icons/cal_step_off.png +0 -0
- PaIRS_UniNa/icons/calibrate.png +0 -0
- PaIRS_UniNa/icons/calibration_logo.png +0 -0
- PaIRS_UniNa/icons/change_folder.png +0 -0
- PaIRS_UniNa/icons/change_folder_off.png +0 -0
- PaIRS_UniNa/icons/checklist.png +0 -0
- PaIRS_UniNa/icons/clean.png +0 -0
- PaIRS_UniNa/icons/clean_run.png +0 -0
- PaIRS_UniNa/icons/close.png +0 -0
- PaIRS_UniNa/icons/close_all.png +0 -0
- PaIRS_UniNa/icons/close_project.png +0 -0
- PaIRS_UniNa/icons/close_workspace.png +0 -0
- PaIRS_UniNa/icons/colormap.png +0 -0
- PaIRS_UniNa/icons/colormaps/Accent.png +0 -0
- PaIRS_UniNa/icons/colormaps/BrBG.png +0 -0
- PaIRS_UniNa/icons/colormaps/Dark2.png +0 -0
- PaIRS_UniNa/icons/colormaps/PRGn.png +0 -0
- PaIRS_UniNa/icons/colormaps/Paired.png +0 -0
- PaIRS_UniNa/icons/colormaps/Pastel1.png +0 -0
- PaIRS_UniNa/icons/colormaps/Pastel2.png +0 -0
- PaIRS_UniNa/icons/colormaps/PiYG.png +0 -0
- PaIRS_UniNa/icons/colormaps/PuOr.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdBu.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdGy.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdYlBu.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdYlGn.png +0 -0
- PaIRS_UniNa/icons/colormaps/Set1.png +0 -0
- PaIRS_UniNa/icons/colormaps/Set2.png +0 -0
- PaIRS_UniNa/icons/colormaps/Set3.png +0 -0
- PaIRS_UniNa/icons/colormaps/Spectral.png +0 -0
- PaIRS_UniNa/icons/colormaps/Wistia.png +0 -0
- PaIRS_UniNa/icons/colormaps/afmhot.png +0 -0
- PaIRS_UniNa/icons/colormaps/autumn.png +0 -0
- PaIRS_UniNa/icons/colormaps/binary.png +0 -0
- PaIRS_UniNa/icons/colormaps/blackVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/blueVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/bone.png +0 -0
- PaIRS_UniNa/icons/colormaps/brg.png +0 -0
- PaIRS_UniNa/icons/colormaps/bwr.png +0 -0
- PaIRS_UniNa/icons/colormaps/cividis.png +0 -0
- PaIRS_UniNa/icons/colormaps/cool.png +0 -0
- PaIRS_UniNa/icons/colormaps/coolwarm.png +0 -0
- PaIRS_UniNa/icons/colormaps/copper.png +0 -0
- PaIRS_UniNa/icons/colormaps/cubehelix.png +0 -0
- PaIRS_UniNa/icons/colormaps/cyanVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/flag.png +0 -0
- PaIRS_UniNa/icons/colormaps/gist_heat.png +0 -0
- PaIRS_UniNa/icons/colormaps/gray.png +0 -0
- PaIRS_UniNa/icons/colormaps/greenVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/hot.png +0 -0
- PaIRS_UniNa/icons/colormaps/hsv.png +0 -0
- PaIRS_UniNa/icons/colormaps/inferno.png +0 -0
- PaIRS_UniNa/icons/colormaps/jet.png +0 -0
- PaIRS_UniNa/icons/colormaps/magentaVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/magma.png +0 -0
- PaIRS_UniNa/icons/colormaps/ocean.png +0 -0
- PaIRS_UniNa/icons/colormaps/pink.png +0 -0
- PaIRS_UniNa/icons/colormaps/plasma.png +0 -0
- PaIRS_UniNa/icons/colormaps/prism.png +0 -0
- PaIRS_UniNa/icons/colormaps/rainbow.png +0 -0
- PaIRS_UniNa/icons/colormaps/redVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/seismic.png +0 -0
- PaIRS_UniNa/icons/colormaps/spring.png +0 -0
- PaIRS_UniNa/icons/colormaps/summer.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab10.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab20.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab20b.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab20c.png +0 -0
- PaIRS_UniNa/icons/colormaps/terrain.png +0 -0
- PaIRS_UniNa/icons/colormaps/twilight.png +0 -0
- PaIRS_UniNa/icons/colormaps/viridis.png +0 -0
- PaIRS_UniNa/icons/colormaps/whiteVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/winter.png +0 -0
- PaIRS_UniNa/icons/colormaps/yellowVector.png +0 -0
- PaIRS_UniNa/icons/common_region.png +0 -0
- PaIRS_UniNa/icons/common_region_off.png +0 -0
- PaIRS_UniNa/icons/completed.png +0 -0
- PaIRS_UniNa/icons/contourf_off.png +0 -0
- PaIRS_UniNa/icons/contourf_on.png +0 -0
- PaIRS_UniNa/icons/copy.png +0 -0
- PaIRS_UniNa/icons/copy_process.png +0 -0
- PaIRS_UniNa/icons/copy_process_off.png +0 -0
- PaIRS_UniNa/icons/copygrid.png +0 -0
- PaIRS_UniNa/icons/cursor_lamp.png +0 -0
- PaIRS_UniNa/icons/cut.png +0 -0
- PaIRS_UniNa/icons/cut_warnings.png +0 -0
- PaIRS_UniNa/icons/darkmode.png +0 -0
- PaIRS_UniNa/icons/debug_run.png +0 -0
- PaIRS_UniNa/icons/delete.png +0 -0
- PaIRS_UniNa/icons/deleteErr.png +0 -0
- PaIRS_UniNa/icons/disp_step.png +0 -0
- PaIRS_UniNa/icons/disp_step_off.png +0 -0
- PaIRS_UniNa/icons/down.png +0 -0
- PaIRS_UniNa/icons/edit_list.png +0 -0
- PaIRS_UniNa/icons/editing.png +0 -0
- PaIRS_UniNa/icons/example_list.png +0 -0
- PaIRS_UniNa/icons/find_all_planes.png +0 -0
- PaIRS_UniNa/icons/find_plane.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_beta.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_download.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_download_warning.png +0 -0
- PaIRS_UniNa/icons/flip_y_off.png +0 -0
- PaIRS_UniNa/icons/flip_y_on.png +0 -0
- PaIRS_UniNa/icons/focusErrr.png +0 -0
- PaIRS_UniNa/icons/folder_loop_cleanup.png +0 -0
- PaIRS_UniNa/icons/folder_loop_cleanup_off.png +0 -0
- PaIRS_UniNa/icons/gear.gif +0 -0
- PaIRS_UniNa/icons/gear.png +0 -0
- PaIRS_UniNa/icons/ger.png +0 -0
- PaIRS_UniNa/icons/greenv.png +0 -0
- PaIRS_UniNa/icons/guide.png +0 -0
- PaIRS_UniNa/icons/icon_CalVi.png +0 -0
- PaIRS_UniNa/icons/icon_PaIRS.png +0 -0
- PaIRS_UniNa/icons/import.png +0 -0
- PaIRS_UniNa/icons/import_set.png +0 -0
- PaIRS_UniNa/icons/information.png +0 -0
- PaIRS_UniNa/icons/information2.png +0 -0
- PaIRS_UniNa/icons/input_logo.png +0 -0
- PaIRS_UniNa/icons/issue.png +0 -0
- PaIRS_UniNa/icons/laser_NTR.png +0 -0
- PaIRS_UniNa/icons/laser_TR_double.png +0 -0
- PaIRS_UniNa/icons/laser_TR_single.png +0 -0
- PaIRS_UniNa/icons/link.png +0 -0
- PaIRS_UniNa/icons/linked.png +0 -0
- PaIRS_UniNa/icons/loaded.png +0 -0
- PaIRS_UniNa/icons/loading_2.gif +0 -0
- PaIRS_UniNa/icons/log_logo.png +0 -0
- PaIRS_UniNa/icons/logo_CalVi.png +0 -0
- PaIRS_UniNa/icons/logo_CalVi_completo.png +0 -0
- PaIRS_UniNa/icons/logo_CalVi_party.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_completo.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_download.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_party_rect.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_rect.png +0 -0
- PaIRS_UniNa/icons/logo_opaco.png +0 -0
- PaIRS_UniNa/icons/mask.png +0 -0
- PaIRS_UniNa/icons/measure.png +0 -0
- PaIRS_UniNa/icons/measure_off.png +0 -0
- PaIRS_UniNa/icons/min_proc.png +0 -0
- PaIRS_UniNa/icons/min_proc_off.png +0 -0
- PaIRS_UniNa/icons/min_step.png +0 -0
- PaIRS_UniNa/icons/min_step_off.png +0 -0
- PaIRS_UniNa/icons/minus.png +0 -0
- PaIRS_UniNa/icons/mirror_u.png +0 -0
- PaIRS_UniNa/icons/mirror_v.png +0 -0
- PaIRS_UniNa/icons/mirror_x.png +0 -0
- PaIRS_UniNa/icons/mirror_y.png +0 -0
- PaIRS_UniNa/icons/mtplt.png +0 -0
- PaIRS_UniNa/icons/new.png +0 -0
- PaIRS_UniNa/icons/new_workspace.png +0 -0
- PaIRS_UniNa/icons/news.png +0 -0
- PaIRS_UniNa/icons/normal_run.png +0 -0
- PaIRS_UniNa/icons/open.png +0 -0
- PaIRS_UniNa/icons/open_image.png +0 -0
- PaIRS_UniNa/icons/open_new_window.png +0 -0
- PaIRS_UniNa/icons/open_result.png +0 -0
- PaIRS_UniNa/icons/open_workspace.png +0 -0
- PaIRS_UniNa/icons/output_logo.png +0 -0
- PaIRS_UniNa/icons/paste_above.png +0 -0
- PaIRS_UniNa/icons/paste_below.png +0 -0
- PaIRS_UniNa/icons/pause.png +0 -0
- PaIRS_UniNa/icons/paused.png +0 -0
- PaIRS_UniNa/icons/pencil_bw.png +0 -0
- PaIRS_UniNa/icons/piv_proc.png +0 -0
- PaIRS_UniNa/icons/piv_proc_off.png +0 -0
- PaIRS_UniNa/icons/piv_step.png +0 -0
- PaIRS_UniNa/icons/piv_step_off.png +0 -0
- PaIRS_UniNa/icons/plane.png +0 -0
- PaIRS_UniNa/icons/play.png +0 -0
- PaIRS_UniNa/icons/plus.png +0 -0
- PaIRS_UniNa/icons/process_logo.png +0 -0
- PaIRS_UniNa/icons/process_loop.png +0 -0
- PaIRS_UniNa/icons/project.png +0 -0
- PaIRS_UniNa/icons/pylog.png +0 -0
- PaIRS_UniNa/icons/python_warning.png +0 -0
- PaIRS_UniNa/icons/queue.png +0 -0
- PaIRS_UniNa/icons/quit.png +0 -0
- PaIRS_UniNa/icons/read.png +0 -0
- PaIRS_UniNa/icons/read_list.png +0 -0
- PaIRS_UniNa/icons/redo.png +0 -0
- PaIRS_UniNa/icons/redx.png +0 -0
- PaIRS_UniNa/icons/reset.png +0 -0
- PaIRS_UniNa/icons/reset_levels.png +0 -0
- PaIRS_UniNa/icons/resize_icon.png +0 -0
- PaIRS_UniNa/icons/restore.png +0 -0
- PaIRS_UniNa/icons/restore_undo.png +0 -0
- PaIRS_UniNa/icons/rotate_clock.png +0 -0
- PaIRS_UniNa/icons/rotate_counter.png +0 -0
- PaIRS_UniNa/icons/rotate_v_clock.png +0 -0
- PaIRS_UniNa/icons/rotate_v_counter.png +0 -0
- PaIRS_UniNa/icons/running.gif +0 -0
- PaIRS_UniNa/icons/running.png +0 -0
- PaIRS_UniNa/icons/running_warn.png +0 -0
- PaIRS_UniNa/icons/sandglass.png +0 -0
- PaIRS_UniNa/icons/save.png +0 -0
- PaIRS_UniNa/icons/save_and_stop.png +0 -0
- PaIRS_UniNa/icons/save_cfg.png +0 -0
- PaIRS_UniNa/icons/saveas.png +0 -0
- PaIRS_UniNa/icons/saveas_workspace.png +0 -0
- PaIRS_UniNa/icons/scale_all.png +0 -0
- PaIRS_UniNa/icons/scale_down.png +0 -0
- PaIRS_UniNa/icons/scale_up.png +0 -0
- PaIRS_UniNa/icons/scan_list.png +0 -0
- PaIRS_UniNa/icons/scan_path.png +0 -0
- PaIRS_UniNa/icons/scan_path_loop.png +0 -0
- PaIRS_UniNa/icons/scan_path_loop_off.png +0 -0
- PaIRS_UniNa/icons/search.png +0 -0
- PaIRS_UniNa/icons/showIW_off.png +0 -0
- PaIRS_UniNa/icons/showIW_on.png +0 -0
- PaIRS_UniNa/icons/show_all.png +0 -0
- PaIRS_UniNa/icons/sort.png +0 -0
- PaIRS_UniNa/icons/sort_reversed.png +0 -0
- PaIRS_UniNa/icons/spiv_proc.png +0 -0
- PaIRS_UniNa/icons/spiv_proc_off.png +0 -0
- PaIRS_UniNa/icons/spiv_setup_no.png +0 -0
- PaIRS_UniNa/icons/spiv_setup_ok.png +0 -0
- PaIRS_UniNa/icons/star.png +0 -0
- PaIRS_UniNa/icons/step_inheritance.png +0 -0
- PaIRS_UniNa/icons/subMIN_off.png +0 -0
- PaIRS_UniNa/icons/subMIN_on.png +0 -0
- PaIRS_UniNa/icons/tom.png +0 -0
- PaIRS_UniNa/icons/trash.png +0 -0
- PaIRS_UniNa/icons/undo.png +0 -0
- PaIRS_UniNa/icons/unedited.png +0 -0
- PaIRS_UniNa/icons/unina_dii.png +0 -0
- PaIRS_UniNa/icons/uninitialized.png +0 -0
- PaIRS_UniNa/icons/unlink.png +0 -0
- PaIRS_UniNa/icons/unwrap_items.png +0 -0
- PaIRS_UniNa/icons/up.png +0 -0
- PaIRS_UniNa/icons/updating_import.gif +0 -0
- PaIRS_UniNa/icons/updating_pairs.gif +0 -0
- PaIRS_UniNa/icons/vectorColor.png +0 -0
- PaIRS_UniNa/icons/vettore.png +0 -0
- PaIRS_UniNa/icons/view.png +0 -0
- PaIRS_UniNa/icons/view_off.png +0 -0
- PaIRS_UniNa/icons/vis_logo.png +0 -0
- PaIRS_UniNa/icons/waiting_circle.png +0 -0
- PaIRS_UniNa/icons/warning.png +0 -0
- PaIRS_UniNa/icons/warning_circle.png +0 -0
- PaIRS_UniNa/icons/window.png +0 -0
- PaIRS_UniNa/icons/workspace.png +0 -0
- PaIRS_UniNa/icons/wrap_items.png +0 -0
- PaIRS_UniNa/icons/write_list.png +0 -0
- PaIRS_UniNa/listLib.py +303 -0
- PaIRS_UniNa/mtfPIV.py +256 -0
- PaIRS_UniNa/parForMulti.py +435 -0
- PaIRS_UniNa/parForWorkers.py +593 -0
- PaIRS_UniNa/pivParFor.py +235 -0
- PaIRS_UniNa/plt_util.py +141 -0
- PaIRS_UniNa/preProcParFor.py +155 -0
- PaIRS_UniNa/procTools.py +1439 -0
- PaIRS_UniNa/readcfg.py +52 -0
- PaIRS_UniNa/rqrdpckgs.txt +9 -0
- PaIRS_UniNa/stereoPivParFor.py +227 -0
- PaIRS_UniNa/tAVarie.py +215 -0
- PaIRS_UniNa/tabSplitter.py +612 -0
- PaIRS_UniNa/ui_Calibration_Tab.py +578 -0
- PaIRS_UniNa/ui_Custom_Top.py +296 -0
- PaIRS_UniNa/ui_Input_Tab.py +1101 -0
- PaIRS_UniNa/ui_Input_Tab_CalVi.py +1283 -0
- PaIRS_UniNa/ui_Log_Tab.py +263 -0
- PaIRS_UniNa/ui_Output_Tab.py +2362 -0
- PaIRS_UniNa/ui_Process_Tab.py +3810 -0
- PaIRS_UniNa/ui_Process_Tab_CalVi.py +1549 -0
- PaIRS_UniNa/ui_Process_Tab_Disp.py +1141 -0
- PaIRS_UniNa/ui_Process_Tab_Min.py +437 -0
- PaIRS_UniNa/ui_ResizePopup.py +204 -0
- PaIRS_UniNa/ui_Vis_Tab.py +1628 -0
- PaIRS_UniNa/ui_Vis_Tab_CalVi.py +1251 -0
- PaIRS_UniNa/ui_Whatsnew.py +132 -0
- PaIRS_UniNa/ui_gPairs.py +877 -0
- PaIRS_UniNa/ui_infoPaIRS.py +551 -0
- PaIRS_UniNa/whatsnew.txt +4 -0
- pairs_unina-0.2.10.dist-info/METADATA +159 -0
- pairs_unina-0.2.10.dist-info/RECORD +333 -0
- pairs_unina-0.2.10.dist-info/WHEEL +5 -0
- pairs_unina-0.2.10.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,982 @@
|
|
|
1
|
+
from .ui_Vis_Tab_CalVi import*
|
|
2
|
+
from .TabTools import*
|
|
3
|
+
from .calib import Calib, CalibTasks, calibTasksText, CalibFunctions, calibFunctionsText
|
|
4
|
+
from .calibView import CalibView
|
|
5
|
+
from .Input_Tab_CalVi import INPpar_CalVi
|
|
6
|
+
from .Process_Tab_CalVi import PROpar_CalVi
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
bufferSizeLimit=2000*1e6 #bytes
|
|
10
|
+
if __name__ == "__main__":
|
|
11
|
+
cfgName='../../img/calib/NewCam0.cfg'
|
|
12
|
+
cfgName='../../img/calib/NewCam0_Mod.cfg'
|
|
13
|
+
FlagRunning=True
|
|
14
|
+
else:
|
|
15
|
+
cfgName=''
|
|
16
|
+
FlagRunning=False
|
|
17
|
+
|
|
18
|
+
spin_tips={
|
|
19
|
+
'plane' : 'Plane number',
|
|
20
|
+
'cam' : 'Camera number',
|
|
21
|
+
'LMin' : 'Minimum intensity level',
|
|
22
|
+
'LMax' : 'Maximum intensity level',
|
|
23
|
+
'yOriOff' : 'Origin y shift',
|
|
24
|
+
'xOriOff' : 'Origin x shift',
|
|
25
|
+
'yp' : 'Maximum y limit',
|
|
26
|
+
'ym' : 'Minimum y limit',
|
|
27
|
+
'xp' : 'Maximum x limit',
|
|
28
|
+
'xm' : 'Minimum x limit',
|
|
29
|
+
}
|
|
30
|
+
check_tips={}
|
|
31
|
+
radio_tips={
|
|
32
|
+
'ShowMask' : 'Show mask',
|
|
33
|
+
}
|
|
34
|
+
line_edit_tips={}
|
|
35
|
+
button_tips={
|
|
36
|
+
'findAll' : 'Find points in all planes',
|
|
37
|
+
'find' : 'Find points in current plane',
|
|
38
|
+
'copyGrid' : 'Copy grid limits to all planes',
|
|
39
|
+
'saveCoord' : 'Save point coordinates',
|
|
40
|
+
'calibrate' : 'Calibration',
|
|
41
|
+
'focusErr' : 'Focus on max. error point',
|
|
42
|
+
'deleteErr' : 'Deletion of max. error point',
|
|
43
|
+
'zoom_minus': 'Zoom out',
|
|
44
|
+
'zoom_equal': 'Reset zoom',
|
|
45
|
+
'zoom_plus' : 'Zoom in',
|
|
46
|
+
'restore' : 'Restore intensity levels',
|
|
47
|
+
'PlotMask' : 'Plot mask',
|
|
48
|
+
}
|
|
49
|
+
combo_tips={}
|
|
50
|
+
|
|
51
|
+
class VISpar_CalVi(TABpar):
|
|
52
|
+
FlagVis=True
|
|
53
|
+
|
|
54
|
+
def __init__(self,Process=ProcessTypes.null,Step=StepTypes.null):
|
|
55
|
+
self.setup(Process,Step)
|
|
56
|
+
super().__init__('VISpar_CalVi','Vis_CalVi')
|
|
57
|
+
self.unchecked_fields+=[]
|
|
58
|
+
|
|
59
|
+
def setup(self,Process,Step):
|
|
60
|
+
self.Process = Process
|
|
61
|
+
self.Step = Step
|
|
62
|
+
|
|
63
|
+
self.cfgName = cfgName
|
|
64
|
+
self.FlagRunning = FlagRunning
|
|
65
|
+
|
|
66
|
+
self.nPlane = 0
|
|
67
|
+
self.plane = 1
|
|
68
|
+
self.nCam = 0
|
|
69
|
+
self.cam = 1
|
|
70
|
+
self.defaultScaleFactor = 1.0
|
|
71
|
+
self.scaleFactor = 1.0
|
|
72
|
+
self.scrollBarValues = [0,0]
|
|
73
|
+
self.LLim = 0
|
|
74
|
+
self.LMin = 0
|
|
75
|
+
self.LMax = 1
|
|
76
|
+
|
|
77
|
+
self.MaskType = 0
|
|
78
|
+
self.DotDiam = 0
|
|
79
|
+
self.FlagShowMask = True
|
|
80
|
+
self.FlagPlotMask = False
|
|
81
|
+
|
|
82
|
+
#self.xOriOff = 0
|
|
83
|
+
#self.yOriOff = 0
|
|
84
|
+
#self.xm = 0
|
|
85
|
+
#self.xp = 0
|
|
86
|
+
#self.ym = 0
|
|
87
|
+
#self.yp = 0
|
|
88
|
+
|
|
89
|
+
self.orPosAndShift = []
|
|
90
|
+
self.angAndMask = []
|
|
91
|
+
self.spotDistAndRemoval = []
|
|
92
|
+
|
|
93
|
+
self.imList = []
|
|
94
|
+
self.imEx = []
|
|
95
|
+
self.splitterSizes = [ ]
|
|
96
|
+
|
|
97
|
+
self.FlagResetLevels = True
|
|
98
|
+
self.FlagResetZoom = True
|
|
99
|
+
|
|
100
|
+
self.errorMessage=''
|
|
101
|
+
|
|
102
|
+
class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
103
|
+
class VIS_Tab_Signals(gPaIRS_Tab.Tab_Signals):
|
|
104
|
+
run=Signal(bool)
|
|
105
|
+
pass
|
|
106
|
+
|
|
107
|
+
def showEvent(self, event: QShowEvent) -> None:
|
|
108
|
+
super().showEvent(event)
|
|
109
|
+
if not self.FlagInitVIS:
|
|
110
|
+
self.FlagInitVIS=True
|
|
111
|
+
S=self.scrollArea.size()
|
|
112
|
+
s=self.calibView.pixmap().size()
|
|
113
|
+
self.VISpar.scaleFactor = self.calibView.scaleFactor =min([S.width()/s.width() if s.width() else S.width(), S.height()/s.height() if s.height() else S.height()])
|
|
114
|
+
self.calibView.resize(self.VISpar.scaleFactor * self.calibView.pixmap().size())
|
|
115
|
+
return
|
|
116
|
+
|
|
117
|
+
def closeEvent(self,event):
|
|
118
|
+
''' called when closing
|
|
119
|
+
I had to add this to be sure that calib was destroyed'''
|
|
120
|
+
|
|
121
|
+
#self.calibView.imageViewerThreadpool.clear()
|
|
122
|
+
pri.Info.white("Vis_Tab_CalVi closeEvent")
|
|
123
|
+
del self.calibView
|
|
124
|
+
|
|
125
|
+
def resizeEvent(self,event):
|
|
126
|
+
super().resizeEvent(event)
|
|
127
|
+
self.setZoom()
|
|
128
|
+
|
|
129
|
+
def __init__(self,parent: QWidget =None, flagInit= __name__ == "__main__"):
|
|
130
|
+
super().__init__(parent,Ui_VisTab_CalVi,VISpar_CalVi)
|
|
131
|
+
self.signals=self.VIS_Tab_Signals(self)
|
|
132
|
+
|
|
133
|
+
#------------------------------------- Graphical interface: widgets
|
|
134
|
+
self.TABname='Vis_CalVi'
|
|
135
|
+
self.ui: Ui_VisTab_CalVi
|
|
136
|
+
|
|
137
|
+
#necessary to change the name and the order of the items
|
|
138
|
+
for g in list(globals()):
|
|
139
|
+
if '_items' in g or '_ord' in g or '_tips' in g:
|
|
140
|
+
#pri.Info.blue(f'Adding {g} to {self.name_tab}')
|
|
141
|
+
setattr(self,g,eval(g))
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
#introducing CalibView
|
|
145
|
+
self.scrollArea = QtWidgets.QScrollArea(self)
|
|
146
|
+
self.scrollArea.setObjectName('scroll_area_Vis_CalVi')
|
|
147
|
+
self.scrollArea.setBackgroundRole(QtGui.QPalette.Dark)
|
|
148
|
+
self.calibView=CalibView(self.scrollArea,self.outFromCalibView,self.outToStatusBarFromCalibView,self.textFromCalib,self.workerCompleted)
|
|
149
|
+
self.scrollArea.setWidget(self.calibView)
|
|
150
|
+
self.ui.Vis_CalVi_splitter.insertWidget(0,self.scrollArea)
|
|
151
|
+
if __name__ == "__main__":
|
|
152
|
+
self.app=app
|
|
153
|
+
setAppGuiPalette(self)
|
|
154
|
+
|
|
155
|
+
#------------------------------------- Graphical interface: miscellanea
|
|
156
|
+
self.ui.status_L.setText('')
|
|
157
|
+
self.ui.status_R.setText('')
|
|
158
|
+
self.FlagFirstShow=False
|
|
159
|
+
self.setLogFont(fontPixelSize-dfontLog)
|
|
160
|
+
|
|
161
|
+
#------------------------------------- Declaration of parameters
|
|
162
|
+
self.VISpar_base=VISpar_CalVi()
|
|
163
|
+
self.VISpar:VISpar_CalVi=self.TABpar
|
|
164
|
+
self.VISpar_old:VISpar_CalVi=self.TABpar_old
|
|
165
|
+
|
|
166
|
+
#------------------------------------- Callbacks
|
|
167
|
+
self.FlagInitVIS=False
|
|
168
|
+
self.defineWidgets()
|
|
169
|
+
self.setupWid() #---------------- IMPORTANT
|
|
170
|
+
|
|
171
|
+
self.defineCallbacks()
|
|
172
|
+
self.spins_valueChanged=[self.ui.spin_plane,self.ui.spin_cam,
|
|
173
|
+
self.ui.spin_xOriOff,self.ui.spin_yOriOff,
|
|
174
|
+
self.ui.spin_ym,self.ui.spin_yp,
|
|
175
|
+
self.ui.spin_xm,self.ui.spin_xp]
|
|
176
|
+
self.connectCallbacks()
|
|
177
|
+
self.defineFurtherCallbacks()
|
|
178
|
+
|
|
179
|
+
self.defineSettings()
|
|
180
|
+
|
|
181
|
+
self.adjustTABpar=self.adjustVISpar
|
|
182
|
+
self.setTABlayout=self.setVISlayout
|
|
183
|
+
|
|
184
|
+
self.FlagAddPrev=False
|
|
185
|
+
|
|
186
|
+
self.calibView.flagCurrentTask=CalibTasks.stop #todo GP per me si deve cancellare è stato già fatto nell'init di CalibView
|
|
187
|
+
|
|
188
|
+
self.bufferImg={}
|
|
189
|
+
self.bufferSize=[]
|
|
190
|
+
self.setRunButtonText=lambda: None
|
|
191
|
+
|
|
192
|
+
self.FlagResume=0
|
|
193
|
+
self.FlagInitData=False
|
|
194
|
+
|
|
195
|
+
#------------------------------------- Initializing
|
|
196
|
+
if flagInit:
|
|
197
|
+
self.initialize()
|
|
198
|
+
|
|
199
|
+
def initialize(self):
|
|
200
|
+
pri.Info.yellow(f'{"*"*20} VIS initialization {"*"*20}')
|
|
201
|
+
|
|
202
|
+
if self.VISpar.cfgName:
|
|
203
|
+
self.calibView.calib.cfgName=self.VISpar.cfgName
|
|
204
|
+
flagOp=self.calibView.calib.readCfg()
|
|
205
|
+
self.calibView.calib.readImgs() #todo verificare eventuali errori e dimensioni delle immagini in questo momento non da errore e l'img viene tagliata
|
|
206
|
+
|
|
207
|
+
self.nullCallback('CalVi process')
|
|
208
|
+
#self.adjustTABparInd()
|
|
209
|
+
self.runCalVi('_Mod' in self.VISpar.cfgName)
|
|
210
|
+
|
|
211
|
+
@Slot(bool)
|
|
212
|
+
def runCalVi(self,flagMod=False):
|
|
213
|
+
self.FlagBridge=False
|
|
214
|
+
self.calibView.flagFirstTask=CalibTasks.findPlanesFromOrigin if flagMod else CalibTasks.findAllPlanes
|
|
215
|
+
self.VISpar.plane=self.VISpar.cam=1
|
|
216
|
+
self.VISpar.FlagPlotMask=False
|
|
217
|
+
if flagMod: self.ui.log.setText('')
|
|
218
|
+
self.setTABlayout()
|
|
219
|
+
if self.calibView.executeCalibTask(self.calibView.flagFirstTask):
|
|
220
|
+
self.setTaskButtonsText()
|
|
221
|
+
#self.resetScaleFactor()
|
|
222
|
+
|
|
223
|
+
def stopCalVi(self):
|
|
224
|
+
self.calibView.executeCalibTask(CalibTasks.stop)
|
|
225
|
+
self.setTaskButtonsText()
|
|
226
|
+
self.gui.ui.button_Run_CalVi.setVisible(True)
|
|
227
|
+
self.setTABlayout()
|
|
228
|
+
self.FlagBridge=True
|
|
229
|
+
self.adjustTABparInd()
|
|
230
|
+
|
|
231
|
+
def show(self):
|
|
232
|
+
super().show()
|
|
233
|
+
if not self.FlagFirstShow:
|
|
234
|
+
self.FlagFirstShow=True
|
|
235
|
+
self.resetScaleFactor()
|
|
236
|
+
self.setVISlayout()
|
|
237
|
+
|
|
238
|
+
def defineFurtherCallbacks(self):
|
|
239
|
+
self.ui.Vis_CalVi_splitter.addfuncout['setScrollAreaWidth']=self.wrappedCallback('Splitter sizes',self.splitterMoved)
|
|
240
|
+
|
|
241
|
+
self.taskButtons=[self.ui.button_findAll,
|
|
242
|
+
self.ui.button_find,
|
|
243
|
+
self.ui.button_calibrate,
|
|
244
|
+
self.ui.button_saveCoord,
|
|
245
|
+
]
|
|
246
|
+
self.taskButtons_actions=[]
|
|
247
|
+
def create_taskButton_action(ind,k):
|
|
248
|
+
def taskButton_action(ind,k):
|
|
249
|
+
FlagSettingPar=TABpar.FlagSettingPar
|
|
250
|
+
TABpar.FlagSettingPar=True
|
|
251
|
+
self.taskButtonPressed(CalibTasks(ind),k!=3)
|
|
252
|
+
TABpar.FlagSettingPar=FlagSettingPar
|
|
253
|
+
return self.wrappedCallback('CalVi task',lambda: taskButton_action(ind,k))
|
|
254
|
+
for k,ind in enumerate([f.value for f in CalibTasks if f.value>0]):
|
|
255
|
+
self.taskButtons_actions.append(create_taskButton_action(ind,k))
|
|
256
|
+
self.taskButtons[k].clicked.connect(self.taskButtons_actions[k])
|
|
257
|
+
|
|
258
|
+
self.buttonsToDisableNotCalibrated=[] #used to gray buttons if not calibrated
|
|
259
|
+
self.functionButtons=[
|
|
260
|
+
self.ui.button_deleteErr,
|
|
261
|
+
self.ui.button_focusErr,
|
|
262
|
+
self.ui.button_copyGrid,
|
|
263
|
+
]
|
|
264
|
+
self.functionButtons_actions=[]
|
|
265
|
+
def create_functionButton_action(ind):
|
|
266
|
+
def functionButton_action(ind):
|
|
267
|
+
FlagSettingPar=TABpar.FlagSettingPar
|
|
268
|
+
TABpar.FlagSettingPar=True
|
|
269
|
+
self.functionButtonPressed(CalibFunctions(ind),True)
|
|
270
|
+
TABpar.FlagSettingPar=FlagSettingPar
|
|
271
|
+
return self.wrappedCallback('CalVi function',lambda: functionButton_action(ind))
|
|
272
|
+
for k,ind in enumerate([f.value for f in CalibFunctions if f.value>0]):
|
|
273
|
+
self.functionButtons_actions.append(create_functionButton_action(ind))
|
|
274
|
+
self.functionButtons[k].clicked.connect(self.functionButtons_actions[k])
|
|
275
|
+
self.buttonsToDisableNotCalibrated.append(self.functionButtons[k])
|
|
276
|
+
|
|
277
|
+
functionButtons_insert=[0,0,0]
|
|
278
|
+
for k,ind in enumerate([f.value for f in CalibFunctions]):
|
|
279
|
+
action=QAction(self.functionButtons[k].icn,calibFunctionsText[abs(ind)],self)
|
|
280
|
+
self.calibView.contextMenuActions.insert(functionButtons_insert[k],action)
|
|
281
|
+
action.triggered.connect(create_functionButton_action(ind))
|
|
282
|
+
if ind>0:
|
|
283
|
+
self.buttonsToDisableNotCalibrated.append(action)
|
|
284
|
+
|
|
285
|
+
self.originOffbox=self.ui.g_OriOff
|
|
286
|
+
self.remPoinsBox=self.ui.g_GriLim
|
|
287
|
+
self.buttonsToDisable=[
|
|
288
|
+
self.ui.spin_plane,
|
|
289
|
+
self.originOffbox,
|
|
290
|
+
self.remPoinsBox,
|
|
291
|
+
] #used to gray buttons when calibrating
|
|
292
|
+
|
|
293
|
+
def setLogFont(self,fPixSize):
|
|
294
|
+
logfont=self.ui.log.font()
|
|
295
|
+
logfont.setFamily('Courier New')
|
|
296
|
+
logfont.setPixelSize(fPixSize)
|
|
297
|
+
self.ui.log.setFont(logfont)
|
|
298
|
+
|
|
299
|
+
#********************************************* Adjusting parameters
|
|
300
|
+
def adjustVISpar(self):
|
|
301
|
+
self.calibView.hide()
|
|
302
|
+
|
|
303
|
+
FlagNewRun=self.VISpar.isDifferentFrom(self.VISpar_old,fields=['FlagRunning'])
|
|
304
|
+
if FlagNewRun:
|
|
305
|
+
self.defaultSplitterSize()
|
|
306
|
+
|
|
307
|
+
FlagNewSet=False
|
|
308
|
+
INP_CalVi:INPpar_CalVi = self.gui.w_Input_CalVi.TABpar
|
|
309
|
+
PRO_CalVi:PROpar_CalVi = self.gui.w_Process_CalVi.TABpar
|
|
310
|
+
if PRO_CalVi.isDifferentFrom(self.gui.w_Process_CalVi.PROpar_old,exceptions=['ind']) or INP_CalVi.isDifferentFrom(self.gui.w_Input_CalVi.INPpar_old,exceptions=['ind']) or not self.FlagInitData:
|
|
311
|
+
FlagNewSet=True
|
|
312
|
+
self.gui.initDataAndSetImgFromGui(INP_CalVi,PRO_CalVi)
|
|
313
|
+
|
|
314
|
+
#***Data
|
|
315
|
+
c=self.calibView.calib
|
|
316
|
+
self.VISpar.nPlane=c.nPlanesPerCam
|
|
317
|
+
self.VISpar.nCam=c.nCams
|
|
318
|
+
if self.VISpar.plane and not self.VISpar.nPlane: self.VISpar.plane=0
|
|
319
|
+
elif not self.VISpar.plane and self.VISpar.nPlane: self.VISpar.plane=self.VISpar.nPlane
|
|
320
|
+
if self.VISpar.cam and not self.VISpar.nCam: self.VISpar.cam=0
|
|
321
|
+
elif not self.VISpar.cam and self.VISpar.nCam: self.VISpar.cam=self.VISpar.nCam
|
|
322
|
+
|
|
323
|
+
self.VISpar.MaskType=abs(self.calibView.calib.cal.data.FlagPos)
|
|
324
|
+
if self.VISpar.MaskType in (2,3):
|
|
325
|
+
#self.VISpar.FlagShowMask=False
|
|
326
|
+
self.VISpar.FlagPlotMask=False
|
|
327
|
+
#if not self.VISpar.FlagShowMask: self.VISpar.FlagPlotMask=False
|
|
328
|
+
self.VISpar.DotDiam=abs(self.calibView.calib.cal.data.raggioInizialeRicerca)
|
|
329
|
+
self.calibView.calib.flagShowMask=self.VISpar.FlagShowMask
|
|
330
|
+
self.calibView.calib.flagPlotMask=self.VISpar.FlagPlotMask
|
|
331
|
+
|
|
332
|
+
#***Levels
|
|
333
|
+
FlagPlot=False
|
|
334
|
+
FlagPlotMask=self.VISpar.isDifferentFrom(self.VISpar_old,fields=['FlagPlotMask'])
|
|
335
|
+
if FlagPlotMask:
|
|
336
|
+
FlagPlot=True
|
|
337
|
+
self.plotPlane()
|
|
338
|
+
if self.VISpar.FlagResetLevels or FlagNewRun or FlagNewSet: #or FlagPlotMask:
|
|
339
|
+
if not FlagPlot:
|
|
340
|
+
FlagPlot=True
|
|
341
|
+
self.plotPlane()
|
|
342
|
+
self.restoreLevels()
|
|
343
|
+
#self.VISpar.FlagResetLevels=False
|
|
344
|
+
self.VISpar.LLim=c.LLim
|
|
345
|
+
if self.VISpar.FlagResetLevels:
|
|
346
|
+
self.VISpar.LMin=c.LMin
|
|
347
|
+
self.VISpar.LMax=c.LMax
|
|
348
|
+
else:
|
|
349
|
+
self.VISpar.LMax=c.LMax if self.VISpar.LMax>c.LLim else self.VISpar.LMax
|
|
350
|
+
self.VISpar.LMin=self.VISpar.LMax-1 if self.VISpar.LMin >self.VISpar.LMax-1 else self.VISpar.LMin
|
|
351
|
+
self.calibView.calib.LMin=self.VISpar.LMin
|
|
352
|
+
self.calibView.calib.LMax=self.VISpar.LMax
|
|
353
|
+
self.VISpar.FlagResetLevels=False
|
|
354
|
+
|
|
355
|
+
#***Zoom
|
|
356
|
+
if self.VISpar.FlagResetZoom or FlagNewRun or FlagPlotMask or FlagNewSet:
|
|
357
|
+
if not FlagPlot:
|
|
358
|
+
FlagPlot=True
|
|
359
|
+
self.plotPlane()
|
|
360
|
+
self.resetScaleFactor()
|
|
361
|
+
self.calibView.scaleFactor=self.VISpar.scaleFactor
|
|
362
|
+
self.VISpar.FlagResetZoom=False
|
|
363
|
+
|
|
364
|
+
def defaultSplitterSize(self):
|
|
365
|
+
self.VISpar.splitterSizes=[self.width()-self.ui.w_Commands.minimumWidth(),self.ui.w_Commands.minimumWidth()]
|
|
366
|
+
|
|
367
|
+
#********************************************* Layout
|
|
368
|
+
def setVISlayout(self):
|
|
369
|
+
self.calibView.hide()
|
|
370
|
+
|
|
371
|
+
FlagImg=len(self.calibView.calib.imgs)>0
|
|
372
|
+
self.ui.g_Image.setEnabled(FlagImg)
|
|
373
|
+
self.ui.spin_plane.setEnabled(FlagImg and self.VISpar.nPlane>1)
|
|
374
|
+
self.ui.spin_cam.setEnabled(FlagImg and self.VISpar.nCam>1)
|
|
375
|
+
|
|
376
|
+
FlagMask=self.VISpar.MaskType not in (2,3) and len(self.calibView.calib.ccMask)>0
|
|
377
|
+
self.ui.g_Mask.setVisible(FlagMask)
|
|
378
|
+
|
|
379
|
+
FlagZoomLevels=FlagImg or FlagMask
|
|
380
|
+
self.ui.g_Zoom.setEnabled(FlagZoomLevels)
|
|
381
|
+
self.ui.g_Levels.setEnabled(FlagZoomLevels)
|
|
382
|
+
|
|
383
|
+
self.ui.button_PlotMask.setEnabled(self.VISpar.MaskType not in (2,3))
|
|
384
|
+
|
|
385
|
+
self.ui.w_Commands.setVisible(self.VISpar.FlagRunning)
|
|
386
|
+
if self.VISpar.FlagRunning:
|
|
387
|
+
self.calibView.contextMenu = QtWidgets.QMenu(self)
|
|
388
|
+
self.calibView.contextMenu.setStyleSheet(self.gui.ui.menu.styleSheet())
|
|
389
|
+
for a in self.calibView.contextMenuActions:
|
|
390
|
+
self.calibView.contextMenu.addAction(a)
|
|
391
|
+
self.calibView.contextMenu.insertSeparator(self.calibView.contextMenuActions[1])
|
|
392
|
+
else:
|
|
393
|
+
self.calibView.contextMenu =None
|
|
394
|
+
|
|
395
|
+
self.setSpinMaxMin()
|
|
396
|
+
self.ui.Vis_CalVi_splitter.setSizes(self.VISpar.splitterSizes)
|
|
397
|
+
|
|
398
|
+
self.calibView.scaleFactor=self.VISpar.scaleFactor
|
|
399
|
+
self.calibView.calib.LMin=self.VISpar.LMin
|
|
400
|
+
self.calibView.calib.LMax=self.VISpar.LMax
|
|
401
|
+
self.calibView.calib.flagShowMask=self.VISpar.FlagShowMask
|
|
402
|
+
self.calibView.calib.flagPlotMask=self.VISpar.FlagPlotMask
|
|
403
|
+
|
|
404
|
+
FlagNoImage=True
|
|
405
|
+
if self.VISpar.cam>0 and self.VISpar.plane>0:
|
|
406
|
+
if self.VISpar.nCam==len(self.VISpar.imEx):
|
|
407
|
+
TargetType=self.gui.w_Process_CalVi.PROpar.TargetType
|
|
408
|
+
nPlane=self.VISpar.nPlane/(1+TargetType)
|
|
409
|
+
if nPlane==len(self.VISpar.imEx[0]):
|
|
410
|
+
plane=int( (self.VISpar.plane+TargetType)/(1+TargetType) )
|
|
411
|
+
if self.VISpar.imEx[self.VISpar.cam-1][plane-1]:
|
|
412
|
+
FlagNoImage=False
|
|
413
|
+
if FlagNoImage:
|
|
414
|
+
self.ui.status_R.setText('')
|
|
415
|
+
self.ui.status_L.setText('')
|
|
416
|
+
self.calibView.hide()
|
|
417
|
+
else:
|
|
418
|
+
if self.VISpar_old.FlagRunning!=self.VISpar.FlagRunning or (self.VISpar.nPlane>0 and self.VISpar_old.nPlane==0):
|
|
419
|
+
self.plotPlane()
|
|
420
|
+
self.button_zoom_equal_action()
|
|
421
|
+
self.setZoom()
|
|
422
|
+
self.plotPlane()
|
|
423
|
+
self.calibView.show()
|
|
424
|
+
if not self.VISpar.FlagInit:
|
|
425
|
+
self.button_zoom_equal_action()
|
|
426
|
+
self.setRunButtonText()
|
|
427
|
+
return
|
|
428
|
+
|
|
429
|
+
def setSpinMaxMin(self):
|
|
430
|
+
self.ui.spin_plane.setMinimum(1*bool(self.VISpar.nPlane))
|
|
431
|
+
self.ui.spin_plane.setMaximum(self.VISpar.nPlane)
|
|
432
|
+
self.ui.spin_cam.setMinimum(1*bool(self.VISpar.nCam))
|
|
433
|
+
self.ui.spin_cam.setMaximum(self.VISpar.nCam)
|
|
434
|
+
|
|
435
|
+
self.ui.spin_LMin.setMinimum(-self.VISpar.LLim)
|
|
436
|
+
self.ui.spin_LMin.setMaximum(self.VISpar.LMax-1)
|
|
437
|
+
self.ui.spin_LMax.setMinimum(self.VISpar.LMin+1)
|
|
438
|
+
self.ui.spin_LMax.setMaximum(self.VISpar.LLim)
|
|
439
|
+
|
|
440
|
+
#********************************************* Zoom
|
|
441
|
+
#******************** Actions
|
|
442
|
+
def button_zoom_minus_action(self):
|
|
443
|
+
self.zoom(0.8)
|
|
444
|
+
return
|
|
445
|
+
|
|
446
|
+
def button_zoom_equal_action(self):
|
|
447
|
+
self.resetScaleFactor()
|
|
448
|
+
self.zoom(1.0)
|
|
449
|
+
return
|
|
450
|
+
|
|
451
|
+
def button_zoom_plus_action(self):
|
|
452
|
+
self.zoom(1.25)
|
|
453
|
+
return
|
|
454
|
+
|
|
455
|
+
def zoom(self,zoom):
|
|
456
|
+
''' zooms f a factor zoom if negative reset to no zoom '''
|
|
457
|
+
if zoom<=0:
|
|
458
|
+
zoom = self.calibView.scaleFactor = 1.0
|
|
459
|
+
self.zoomImage(zoom)
|
|
460
|
+
|
|
461
|
+
def zoomImage(self, zoom):
|
|
462
|
+
''' zooms the image of self.CalibView.scaleFactor times a factor zoom
|
|
463
|
+
adjust also the scrollBars'''
|
|
464
|
+
self.calibView.scaleFactor *= zoom
|
|
465
|
+
self.VISpar.scaleFactor=self.calibView.scaleFactor
|
|
466
|
+
self.VISpar.scrollBarValues[0]=self.adjustedScrollBarValue(self.scrollArea.horizontalScrollBar(), zoom)
|
|
467
|
+
self.VISpar.scrollBarValues[1]=self.adjustedScrollBarValue(self.scrollArea.verticalScrollBar(), zoom)
|
|
468
|
+
|
|
469
|
+
def adjustedScrollBarValue(self, scrollBar:QScrollBar, factor):
|
|
470
|
+
''' adjust the position when zooming in or out '''
|
|
471
|
+
return int(factor * scrollBar.value() + ((factor - 1) * scrollBar.pageStep()/2))
|
|
472
|
+
|
|
473
|
+
def splitterMoved(self):
|
|
474
|
+
self.calibView.resetScaleFactor(self.scrollArea.size())
|
|
475
|
+
self.VISpar.defaultScaleFactor=self.calibView.scaleFactor
|
|
476
|
+
self.VISpar.splitterSizes=self.ui.Vis_CalVi_splitter.sizes()
|
|
477
|
+
|
|
478
|
+
#******************** Settings
|
|
479
|
+
def setZoom(self):
|
|
480
|
+
#self.calibView.show()
|
|
481
|
+
self.calibView.resize(self.VISpar.scaleFactor * self.calibView.pixmap().size())
|
|
482
|
+
self.scrollArea.horizontalScrollBar().setValue(self.VISpar.scrollBarValues[0])
|
|
483
|
+
self.scrollArea.verticalScrollBar().setValue(self.VISpar.scrollBarValues[1])
|
|
484
|
+
|
|
485
|
+
#******************** Adjusting
|
|
486
|
+
def resetScaleFactor(self):
|
|
487
|
+
''' reset the scale factor so that the image perfectly feet the window'''
|
|
488
|
+
self.calibView.resetScaleFactor(self.scrollArea.size())
|
|
489
|
+
self.VISpar.defaultScaleFactor=self.VISpar.scaleFactor=self.calibView.scaleFactor
|
|
490
|
+
self.VISpar.scrollBarValues=[0,0]
|
|
491
|
+
|
|
492
|
+
#********************************************* Levels
|
|
493
|
+
#******************** Actions
|
|
494
|
+
def button_restore_action(self):
|
|
495
|
+
self.VISpar.FlagResetLevels=True
|
|
496
|
+
|
|
497
|
+
#******************** Adjusting
|
|
498
|
+
def restoreLevels(self):
|
|
499
|
+
pc=self.VISpar.plane-1
|
|
500
|
+
c=self.VISpar.cam-1
|
|
501
|
+
p=pc+c*self.calibView.calib.nPlanesPerCam
|
|
502
|
+
c=self.calibView.calib
|
|
503
|
+
c.setLMinMax(p)
|
|
504
|
+
|
|
505
|
+
#********************************************* Mask
|
|
506
|
+
#******************** Actions
|
|
507
|
+
def button_PlotMask_action(self):
|
|
508
|
+
self.VISpar.FlagPlotMask=self.ui.button_PlotMask.isChecked()
|
|
509
|
+
|
|
510
|
+
#******************** Settings
|
|
511
|
+
def button_PlotMask_set(self):
|
|
512
|
+
self.ui.button_PlotMask.setChecked(self.VISpar.FlagPlotMask)
|
|
513
|
+
|
|
514
|
+
#********************************************* Plot
|
|
515
|
+
#******************** Layout
|
|
516
|
+
def plotPlane(self):
|
|
517
|
+
pc=self.VISpar.plane-1
|
|
518
|
+
c=self.VISpar.cam-1
|
|
519
|
+
p=pc+c*self.calibView.calib.nPlanesPerCam
|
|
520
|
+
self.calibView.plotPlane(p)
|
|
521
|
+
|
|
522
|
+
#********************************************* Parameters
|
|
523
|
+
#******************** Actions
|
|
524
|
+
def spin_OriOff_action(self,spin:QSpinBox,flagX):
|
|
525
|
+
self.focusOnTarget()
|
|
526
|
+
Off=spin.value()
|
|
527
|
+
if spin.hasFocus():
|
|
528
|
+
self.calibView.spinOriginChanged(Off,spin,flagX,flagPlot=False)
|
|
529
|
+
|
|
530
|
+
def spin_xOriOff_action(self):
|
|
531
|
+
self.spin_OriOff_action(self.ui.spin_xOriOff,True)
|
|
532
|
+
|
|
533
|
+
def spin_yOriOff_action(self):
|
|
534
|
+
self.spin_OriOff_action(self.ui.spin_yOriOff,False)
|
|
535
|
+
|
|
536
|
+
def spin_remPoi_action(self,spin:QSpinBox,flagX,flagPos):
|
|
537
|
+
self.focusOnTarget()
|
|
538
|
+
Off=spin.value()
|
|
539
|
+
if spin.hasFocus():
|
|
540
|
+
self.calibView.spinRemPoints(Off,spin,flagX,flagPos)
|
|
541
|
+
|
|
542
|
+
def spin_ym_action(self):
|
|
543
|
+
self.spin_remPoi_action(self.ui.spin_ym,flagX=False,flagPos=False)
|
|
544
|
+
|
|
545
|
+
def spin_yp_action(self):
|
|
546
|
+
self.spin_remPoi_action(self.ui.spin_yp,flagX=False,flagPos=True)
|
|
547
|
+
|
|
548
|
+
def spin_xm_action(self):
|
|
549
|
+
self.spin_remPoi_action(self.ui.spin_xm,flagX=True,flagPos=False)
|
|
550
|
+
|
|
551
|
+
def spin_xp_action(self):
|
|
552
|
+
self.spin_remPoi_action(self.ui.spin_xp,flagX=True,flagPos=True)
|
|
553
|
+
|
|
554
|
+
def button_copyGrid_action(self):
|
|
555
|
+
self.focusOnTarget()
|
|
556
|
+
self.calibView.copyRemPoints()
|
|
557
|
+
|
|
558
|
+
def focusOnTarget(self):
|
|
559
|
+
self.VISpar.FlagPlotMask=False
|
|
560
|
+
|
|
561
|
+
#********************************************* CalibView function
|
|
562
|
+
def outFromCalibView(self,out:str):
|
|
563
|
+
''' output From CalibView called from plotImg'''
|
|
564
|
+
calib=self.calibView.calib
|
|
565
|
+
da=calib.cal.vect
|
|
566
|
+
p=calib.plane
|
|
567
|
+
c=int(p/calib.nPlanesPerCam)
|
|
568
|
+
pc=p-c*calib.nPlanesPerCam
|
|
569
|
+
|
|
570
|
+
FlagSettingPar=TABpar.FlagSettingPar
|
|
571
|
+
TABpar.FlagSettingPar=True
|
|
572
|
+
self.VISpar.plane=pc+1
|
|
573
|
+
self.VISpar.cam=c+1
|
|
574
|
+
self.ui.spin_cam.setValue(c+1)
|
|
575
|
+
self.ui.spin_plane.setValue(pc+1)
|
|
576
|
+
|
|
577
|
+
self.ui.spin_xOriOff.setValue(da.xOrShift[p])
|
|
578
|
+
self.ui.spin_yOriOff.setValue(da.yOrShift[p])
|
|
579
|
+
|
|
580
|
+
self.ui.spin_xm.setValue(da.remPointsLe[p])
|
|
581
|
+
self.ui.spin_xp.setValue(da.remPointsRi[p])
|
|
582
|
+
self.ui.spin_ym.setValue(da.remPointsDo[p])
|
|
583
|
+
self.ui.spin_yp.setValue(da.remPointsUp[p])
|
|
584
|
+
TABpar.FlagSettingPar=FlagSettingPar
|
|
585
|
+
|
|
586
|
+
if self.VISpar.FlagPlotMask:
|
|
587
|
+
out2=' [CC mask]'
|
|
588
|
+
else:
|
|
589
|
+
out2=' [target image]'
|
|
590
|
+
self.ui.status_R.setText(out+out2)
|
|
591
|
+
self.calibView.setStatusTip(out+out2)
|
|
592
|
+
|
|
593
|
+
def outToStatusBarFromCalibView(self,out:str):
|
|
594
|
+
''' output to status bar From CalibView '''
|
|
595
|
+
self.ui.status_L.setText(out)
|
|
596
|
+
#self.calibView.setToolTip(out)
|
|
597
|
+
|
|
598
|
+
Slot(str)
|
|
599
|
+
def textFromCalib(self,out:str):
|
|
600
|
+
''' set single line text from calib'''
|
|
601
|
+
|
|
602
|
+
#print(f'textFromCalib {out}')
|
|
603
|
+
self.ui.log.setText(out)
|
|
604
|
+
|
|
605
|
+
def workerCompleted(self,flagError):
|
|
606
|
+
''' called when worker has completed '''
|
|
607
|
+
if flagError:
|
|
608
|
+
warningDialog(self,'An error occurred during calibration!\n\nPlease, restart the procedure manually.')
|
|
609
|
+
if not self.calibView.flagCurrentTask is CalibTasks.stop:# pylint: disable=unneeded-not
|
|
610
|
+
if self.calibView.executeCalibTask(CalibTasks.stop):
|
|
611
|
+
self.setTaskButtonsText()
|
|
612
|
+
|
|
613
|
+
def setTaskButtonsText(self):
|
|
614
|
+
''' set all the button texts and enable/disable them '''
|
|
615
|
+
flagEnab=True if (self.calibView.flagCurrentTask==CalibTasks.stop) else False
|
|
616
|
+
for f in [f for f in CalibTasks if f.value>0]:
|
|
617
|
+
if flagEnab: # stop the process -> enable all buttons and restore text
|
|
618
|
+
self.taskButtons [f.value-1].setText(calibTasksText[f.value])
|
|
619
|
+
self.taskButtons [f.value-1].setEnabled(True)
|
|
620
|
+
else:
|
|
621
|
+
if self.calibView.flagCurrentTask is f:
|
|
622
|
+
self.taskButtons [f.value-1].setText(calibTasksText[0])
|
|
623
|
+
else:
|
|
624
|
+
self.taskButtons [f.value-1].setEnabled(False)
|
|
625
|
+
for b in self.buttonsToDisable:
|
|
626
|
+
b.setEnabled(flagEnab)
|
|
627
|
+
for b in self.buttonsToDisableNotCalibrated:
|
|
628
|
+
b.setEnabled(self.calibView.calib.cal.flagCalibrated)
|
|
629
|
+
self.setRunCalViButtonLayout()
|
|
630
|
+
#for b in self.functionButtons: b.setEnabled(flagEnab)
|
|
631
|
+
#pri.Callback.green('-----abcde----- TaskButtonsText -----abcde-----')
|
|
632
|
+
|
|
633
|
+
def taskButtonPressed(self,flag:CalibTasks,flagFocus):
|
|
634
|
+
''' one of the button has been pressed '''
|
|
635
|
+
if flagFocus: self.focusOnTarget()
|
|
636
|
+
if self.calibView.executeCalibTask(flag):
|
|
637
|
+
self.setTaskButtonsText()
|
|
638
|
+
#pri.Callback.green('-----xxxxx----- taskButtonPressed -----xxxxx-----')
|
|
639
|
+
|
|
640
|
+
def functionButtonPressed(self,flag:CalibTasks,flagFocus):
|
|
641
|
+
''' one of the button has been pressed '''
|
|
642
|
+
if flagFocus: self.focusOnTarget()
|
|
643
|
+
self.calibView.executeCalibFunction(flag)
|
|
644
|
+
#pri.Callback.green('-----|||||----- functionButtonPressed -----|||||-----')
|
|
645
|
+
|
|
646
|
+
#********************************************* Spin callbacks
|
|
647
|
+
def setImgFromGui(self):
|
|
648
|
+
inddel=[]
|
|
649
|
+
calib=self.calibView.calib
|
|
650
|
+
calib.imgs=[]
|
|
651
|
+
calib.ccMask=[]
|
|
652
|
+
flagFirstImage=True
|
|
653
|
+
npType=np.uint16
|
|
654
|
+
|
|
655
|
+
data=calib.cal.data
|
|
656
|
+
Him=data.ImgH
|
|
657
|
+
Wim=data.ImgW
|
|
658
|
+
if self.VISpar.imList: #only used to read the first image and fix the img dimensions
|
|
659
|
+
for imListc,imExc in zip(self.VISpar.imList,self.VISpar.imEx):
|
|
660
|
+
for k,f in enumerate(imListc):
|
|
661
|
+
ex=imExc[k]=os.path.exists(f)
|
|
662
|
+
if ex:
|
|
663
|
+
if f not in self.bufferImg:
|
|
664
|
+
try:
|
|
665
|
+
im=Image.open(f)
|
|
666
|
+
da=np.array(im,dtype=npType)
|
|
667
|
+
if len(da.shape)!=2:
|
|
668
|
+
self.bufferImg[f]=da=None
|
|
669
|
+
raise(f'Error: the image file: {f} seems not to be grayscale!')
|
|
670
|
+
else:
|
|
671
|
+
self.bufferImg[f]=da
|
|
672
|
+
except:
|
|
673
|
+
pri.Error.red(f'Error while opening the image file: {f}.\n{traceback.format_exc()}\n')
|
|
674
|
+
self.bufferImg[f]=da=None
|
|
675
|
+
else:
|
|
676
|
+
da=self.bufferImg[f]
|
|
677
|
+
if flagFirstImage and da is not None:
|
|
678
|
+
Him,Wim=da.shape
|
|
679
|
+
flagFirstImage=False
|
|
680
|
+
break
|
|
681
|
+
if not flagFirstImage: break
|
|
682
|
+
if self.VISpar.imList: #reading the images
|
|
683
|
+
for imListc,imExc in zip(self.VISpar.imList,self.VISpar.imEx):
|
|
684
|
+
k=-1
|
|
685
|
+
for f,ex in zip(imListc,imExc):
|
|
686
|
+
k+=1
|
|
687
|
+
if f not in self.bufferImg:
|
|
688
|
+
if ex:
|
|
689
|
+
try:
|
|
690
|
+
im=Image.open(f)
|
|
691
|
+
da=np.array(im,dtype=npType)
|
|
692
|
+
if len(da.shape)!=2:
|
|
693
|
+
da=None
|
|
694
|
+
raise(f'Error: the image file: {f} seems not to be grayscale!')
|
|
695
|
+
except:
|
|
696
|
+
pri.Error.red(f'Error while opening the image file: {f}.\n{traceback.format_exc()}\n')
|
|
697
|
+
da=None
|
|
698
|
+
else:
|
|
699
|
+
da=np.zeros((Him,Wim),dtype=npType)
|
|
700
|
+
self.bufferImg[f]=da
|
|
701
|
+
else:
|
|
702
|
+
da=self.bufferImg[f]
|
|
703
|
+
if da is None:
|
|
704
|
+
inddel.append(k)
|
|
705
|
+
continue
|
|
706
|
+
h,w=da.shape
|
|
707
|
+
if (Wim,Him)!=(w,h):
|
|
708
|
+
inddel.append(k)
|
|
709
|
+
calib.imgs.append(np.ascontiguousarray(da[data.RigaPart:data.RigaPart+data.ImgH,data.ColPart:data.ColPart+data.ImgW],dtype=npType))
|
|
710
|
+
if data.TipoTarget:
|
|
711
|
+
calib.imgs.append(np.ascontiguousarray(da[data.RigaPart:data.RigaPart+data.ImgH,data.ColPart:data.ColPart+data.ImgW],dtype=npType))
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
self.bufferSize=0
|
|
715
|
+
for f in self.bufferImg:#deleting buffer if to big
|
|
716
|
+
a:np.ndarray=self.bufferImg[f]
|
|
717
|
+
if a is not None:
|
|
718
|
+
self.bufferSize+=a.size*a.itemsize
|
|
719
|
+
if self.bufferSize>bufferSizeLimit:
|
|
720
|
+
imgList=list(self.bufferImg)
|
|
721
|
+
k=0
|
|
722
|
+
while self.bufferSize>bufferSizeLimit and len(imgList) and imgList[k] not in self.VISpar.imList:
|
|
723
|
+
f=imgList[k]
|
|
724
|
+
a=self.bufferImg[f]
|
|
725
|
+
self.bufferSize-=a.size*a.itemsize
|
|
726
|
+
self.bufferImg.pop(f)
|
|
727
|
+
imgList.pop(k)
|
|
728
|
+
|
|
729
|
+
if calib.imgs:
|
|
730
|
+
calib.cal.setImgs(calib.imgs)
|
|
731
|
+
calib.ccMask=calib.cal.getMask()
|
|
732
|
+
pass
|
|
733
|
+
return inddel
|
|
734
|
+
|
|
735
|
+
def initDataFromGui(self,INP:INPpar_CalVi,PRO:PROpar_CalVi):
|
|
736
|
+
#FlagNewImages=self.VISpar.imList!=INP.imList or self.VISpar.imEx!=INP.imEx
|
|
737
|
+
#if not FlagNewImages: return FlagNewImages
|
|
738
|
+
self.VISpar.imList=copy.deepcopy(INP.imList)
|
|
739
|
+
self.VISpar.imEx=copy.deepcopy(INP.imEx)
|
|
740
|
+
calib=self.calibView.calib
|
|
741
|
+
calib.cal.DefaultValues()
|
|
742
|
+
calib.FlagCalibration=False
|
|
743
|
+
|
|
744
|
+
self.FlagResume=0
|
|
745
|
+
#-------------------------------------- %
|
|
746
|
+
# Not in cfg %
|
|
747
|
+
# --------------------------------------%
|
|
748
|
+
|
|
749
|
+
data=calib.cal.data
|
|
750
|
+
calVect=calib.cal.vect
|
|
751
|
+
data.PercErrMax = 0.1 # 0.10 Percentuale massima per errore in posizioneTom da modificare
|
|
752
|
+
# InitParOptCalVi(&dati->POC); #todo
|
|
753
|
+
|
|
754
|
+
#-------------------------------------- %
|
|
755
|
+
# Input and Output parameters %
|
|
756
|
+
# --------------------------------------%
|
|
757
|
+
data.percorso = INP.path #percorso file di input
|
|
758
|
+
data.EstensioneIn = INP.ext #estensione in (b16 o tif)
|
|
759
|
+
data.FlagCam=0 if INP.FlagCam else 1
|
|
760
|
+
data.percorsoOut = INP.path_out # percorso file di output
|
|
761
|
+
data.NomeFileOut = INP.root_out # nome file di output
|
|
762
|
+
|
|
763
|
+
camString=''
|
|
764
|
+
cams=INP.cams
|
|
765
|
+
if INP.FlagCam:
|
|
766
|
+
if len(cams)==1: camString=f'_cam{cams[0]}'
|
|
767
|
+
else:
|
|
768
|
+
cams=[-1]
|
|
769
|
+
calib.cfgName=f'{data.percorsoOut}{data.NomeFileOut}{camString}.cfg'
|
|
770
|
+
data.NCam = len(cams) if INP.FlagCam else 1 # Numero di elementi nel vettore cam (numero di camere da calibrare)
|
|
771
|
+
|
|
772
|
+
if self.VISpar.FlagRunning:
|
|
773
|
+
varName=f'{data.percorsoOut}{data.NomeFileOut}{camString}{outExt.calvi}'
|
|
774
|
+
if os.path.exists(varName):
|
|
775
|
+
try:
|
|
776
|
+
with open(varName, 'rb') as file:
|
|
777
|
+
try:
|
|
778
|
+
var=pickle.load(file)
|
|
779
|
+
except:
|
|
780
|
+
self.FlagResume=-1
|
|
781
|
+
else:
|
|
782
|
+
self.FlagResume=1 if INP.isEqualTo(var[0],exceptions=TABpar().fields,fields=['cams','filenames','x','y','w','h','W','H']) else -1
|
|
783
|
+
INP.printDifferences(var[0])
|
|
784
|
+
#PRO.printDifferences(var[1])
|
|
785
|
+
if self.FlagResume>0:
|
|
786
|
+
self.VISpar.copyfrom(var[2],TABpar().fields+['FlagRunning'])
|
|
787
|
+
except:
|
|
788
|
+
self.FlagResume=-1
|
|
789
|
+
pri.Error.red(f'Error while restoring the previous calibration process file: {varName}.\n{traceback.format_exc()}\n')
|
|
790
|
+
|
|
791
|
+
#-------------------------------------- %
|
|
792
|
+
# Distance between spots %
|
|
793
|
+
# --------------------------------------%
|
|
794
|
+
data.pasX = PRO.DotDx # passo della griglia lungo X
|
|
795
|
+
data.pasY = PRO.DotDy # passo della griglia lungo Y
|
|
796
|
+
|
|
797
|
+
#-------------------------------------- %
|
|
798
|
+
# Calibration parameters %
|
|
799
|
+
# --------------------------------------%
|
|
800
|
+
data.Threshold = PRO.DotThresh # valore percentuale della soglia
|
|
801
|
+
data.FlagPos = (2*bool(PRO.DotColor)-1)*([0,3,4,5,1,2][PRO.DotTypeSearch]+1) # Tipo ricerca pallino 1 CC 2 Interp 3 geom Positivi pallini bianchi negativi pallini neri 4 e 5 TopHat piu gaussiana 6 gaussiana
|
|
802
|
+
#Cal = (TipoCal >> CalFlags.SHIFT) & CalFlags.MASK;
|
|
803
|
+
#Cyl = (TipoCal >> CalFlags.SHIFT_CYL) & CalFlags.MASK;
|
|
804
|
+
data.raggioInizialeRicerca=int(PRO.DotDiam*2.5)
|
|
805
|
+
calType=PRO.CalibProcType
|
|
806
|
+
F_Ph=int(PRO.FlagPinhole)
|
|
807
|
+
F_Pl=int(PRO.FlagPlane)
|
|
808
|
+
F_Sa=int(PRO.FlagSaveLOS)
|
|
809
|
+
P_Cyl=PRO.CorrMod_Cyl
|
|
810
|
+
P_Ph=0
|
|
811
|
+
data.TipoCal=calib.toTipoCal(calType,F_Ph,F_Pl,F_Sa,P_Cyl,P_Ph) # Calibration type [Type F_Ph F_Pl F_Sa P_Cyl P_Ph]
|
|
812
|
+
|
|
813
|
+
#-------------------------------------- %
|
|
814
|
+
# Image Parameters %
|
|
815
|
+
# --------------------------------------%
|
|
816
|
+
data.ImgW=INP.w
|
|
817
|
+
data.ImgH=INP.h
|
|
818
|
+
data.ColPart=INP.x
|
|
819
|
+
data.RigaPart=INP.y
|
|
820
|
+
|
|
821
|
+
#-------------------------------------- %
|
|
822
|
+
# Target parameters %
|
|
823
|
+
# --------------------------------------%
|
|
824
|
+
data.TipoTarget = PRO.TargetType # Tipo di target 0 normale singolo piano 1 doppio piano con dx dy sfalsato al 50%)
|
|
825
|
+
data.dx = PRO.OriginXShift # TipoTarget==1 sfasamento fra i piani target altirmenti non utlizzato
|
|
826
|
+
data.dy = PRO.OriginYShift # TipoTarget==1 sfasamento fra i piani target altirmenti non utlizzato
|
|
827
|
+
data.dz = PRO.OriginZShift # TipoTarget==1 distanza fra i piani target altirmenti non utlizzato
|
|
828
|
+
if data.TipoTarget==0: data.dx = data.dy = data.dz = 0
|
|
829
|
+
data.Numpiani_PerCam=len(INP.filenames)*(data.TipoTarget+1) # numero di piani da calibrare per camera in caso di target doppio piano inserire 2 * numero di spostamenti target
|
|
830
|
+
data.Numpiani = data.NCam * data.Numpiani_PerCam
|
|
831
|
+
|
|
832
|
+
if len(INP.filenames) <1 : #when initializing the filenames are not known
|
|
833
|
+
calib.nCams=0
|
|
834
|
+
calib.cams=[]
|
|
835
|
+
calib.nPlanes=0
|
|
836
|
+
calib.nPlanesPerCam=0
|
|
837
|
+
self.VISpar.nPlane=calib.nPlanesPerCam
|
|
838
|
+
self.VISpar.nCam=calib.nCams
|
|
839
|
+
return
|
|
840
|
+
|
|
841
|
+
CamModType=[1,2,3,10,30][PRO.CamMod]
|
|
842
|
+
if CamModType in (1,2,3):
|
|
843
|
+
modPar=[PRO.XDeg,PRO.YDeg,PRO.ZDeg]
|
|
844
|
+
elif CamModType==10:
|
|
845
|
+
CamModType+=[0,2,4][PRO.CorrMod]
|
|
846
|
+
modPar=[PRO.PixAR,PRO.PixPitch]
|
|
847
|
+
elif CamModType==30:
|
|
848
|
+
CamModType+=[0,2,4,5,6,7,8][PRO.CorrMod]
|
|
849
|
+
modPar=[PRO.PixAR,PRO.PixPitch,PRO.CylRad,PRO.CylThick,PRO.CylNRatio]
|
|
850
|
+
additionalPar=[CamModType]+modPar # Calibration type and parameters (12)
|
|
851
|
+
|
|
852
|
+
calib.cal.allocAndinit(additionalPar,0)
|
|
853
|
+
for i,c in enumerate (cams):
|
|
854
|
+
calVect.cam[i]=c
|
|
855
|
+
|
|
856
|
+
# -------------------------------------- %
|
|
857
|
+
# Plane img name and coordinates %
|
|
858
|
+
# -------------------------------------- %
|
|
859
|
+
imgRoot=[]
|
|
860
|
+
for f in INP.filenames:
|
|
861
|
+
if data.FlagCam==0:
|
|
862
|
+
imgRoot.append(os.path.splitext(f)[0].replace('_cam*',''))
|
|
863
|
+
else:
|
|
864
|
+
imgRoot.append(os.path.splitext(f)[0])
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
if calType:
|
|
868
|
+
z=[0.0]*len(INP.plapar)
|
|
869
|
+
costPlanes=INP.plapar
|
|
870
|
+
else:
|
|
871
|
+
z=[p[-1] for p in INP.plapar]
|
|
872
|
+
costPlanes=[[0.0]*5+[zk] for zk in z]
|
|
873
|
+
if data.TipoTarget==1:
|
|
874
|
+
for k in range(len(INP.filenames)):
|
|
875
|
+
k2=k*2+1
|
|
876
|
+
imgRootk=imgRoot[2*k]
|
|
877
|
+
imgRoot.insert(k2,imgRootk)
|
|
878
|
+
zk=z[2*k]
|
|
879
|
+
z.insert(k2,zk+data.dz)
|
|
880
|
+
cP=costPlanes[2*k]
|
|
881
|
+
cP2=[c for c in cP]
|
|
882
|
+
cP2[-1]+=data.dz
|
|
883
|
+
costPlanes.insert(k2,cP2)
|
|
884
|
+
pass
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
for p1 in range(data.Numpiani_PerCam):
|
|
888
|
+
for c in range(data.NCam):
|
|
889
|
+
p=p1+c*data.Numpiani_PerCam
|
|
890
|
+
calib.cal.setImgRoot(p,imgRoot[p1])
|
|
891
|
+
calVect.z[p] = z[p1]
|
|
892
|
+
|
|
893
|
+
if self.FlagResume<=0:
|
|
894
|
+
calVect.XOr[p] = calVect.YOr[p] = calVect.angCol[p] = calVect.angRow[p] = calVect.xOrShift[p] = calVect.yOrShift[p] = 0
|
|
895
|
+
calib.cal.setPuTrovaCC([0,0,0,0],p)
|
|
896
|
+
calVect.dColPix[p] =calVect.dRigPix[p] = 10000 #not really important but has to be big
|
|
897
|
+
calVect.remPointsUp[p] = calVect.remPointsDo[p] = calVect.remPointsLe[p] = calVect.remPointsRi[p] = 0
|
|
898
|
+
else:
|
|
899
|
+
calVect.XOr[p] = self.VISpar.orPosAndShift[p][0] + data.ColPart
|
|
900
|
+
calVect.YOr[p] = self.VISpar.orPosAndShift[p][1] + data.RigaPart
|
|
901
|
+
calVect.angCol[p] = self.VISpar.angAndMask[p][0]
|
|
902
|
+
calVect.angRow[p] = self.VISpar.angAndMask[p][1]
|
|
903
|
+
|
|
904
|
+
calVect.xOrShift[p] = round(self.VISpar.orPosAndShift[p][2])
|
|
905
|
+
calVect.yOrShift[p] = round(self.VISpar.orPosAndShift[p][3])
|
|
906
|
+
|
|
907
|
+
self.calibView.calib.cal.setPuTrovaCC(self.VISpar.angAndMask[p][2:],p)
|
|
908
|
+
#calVect.flagPlane[p]|= PaIRS_lib.CalFlags.PLANE_NOT_INIT_TROVA_PUNTO|PaIRS_lib.CalFlags.PLANE_NOT_FOUND
|
|
909
|
+
#self.cal.getPuTrovaCC(p)
|
|
910
|
+
calVect.dColPix[p] = round(self.VISpar.spotDistAndRemoval[p][0])
|
|
911
|
+
calVect.dRigPix[p] = round(self.VISpar.spotDistAndRemoval[p][1])
|
|
912
|
+
#self.cal.calcBounds(p)
|
|
913
|
+
calVect.remPointsUp[p] = round(self.VISpar.spotDistAndRemoval[p][2])
|
|
914
|
+
calVect.remPointsDo[p] = round(self.VISpar.spotDistAndRemoval[p][3])
|
|
915
|
+
calVect.remPointsLe[p] = round(self.VISpar.spotDistAndRemoval[p][4])
|
|
916
|
+
calVect.remPointsRi[p] = round(self.VISpar.spotDistAndRemoval[p][5])
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
if calType!=0: #no standard calibration planes involved
|
|
920
|
+
calVect.costPlanes[p1]=costPlanes[p1]
|
|
921
|
+
calib.cal.allocAndinit(additionalPar,1)
|
|
922
|
+
errorFiles=[[],[]]
|
|
923
|
+
if calType >= 2:# Calibrazione piano per controllo Legge le costanti di calibrazione
|
|
924
|
+
# si devono leggere o passare le costanti di calibrazione
|
|
925
|
+
for cam in range(data.NCam):
|
|
926
|
+
buffer=f'{data.percorso}{data.NomeFileOut}{abs(calVect.cam[cam])}.cal'
|
|
927
|
+
if os.path.exists(buffer):
|
|
928
|
+
try:
|
|
929
|
+
calib.readCalFile(buffer,calVect.cost[cam],data.NumCostCalib,CamModType)
|
|
930
|
+
except Exception as inst:
|
|
931
|
+
errorFiles[1].append(f'{os.path.basename(buffer)} ({inst})')
|
|
932
|
+
else:
|
|
933
|
+
errorFiles[0].append(f'{os.path.basename(buffer)}')
|
|
934
|
+
errorMessage=''
|
|
935
|
+
if len(errorFiles[0]) or len(errorFiles[1]):
|
|
936
|
+
errorMessage='Error while initialising the calibration process.\n\n'
|
|
937
|
+
if len(errorFiles[0]):
|
|
938
|
+
errList=f";\n ".join(errorFiles[0])
|
|
939
|
+
errorMessage+=f'The following files do not exist in the specified path ({data.percorso}):\n {errList}.\n\n'
|
|
940
|
+
if len(errorFiles[1]):
|
|
941
|
+
errList=f";\n ".join(errorFiles[1])
|
|
942
|
+
errorMessage+=f'There were errors with opening the following files in the specified path ({data.percorso}):\n {errList}.'
|
|
943
|
+
#pri.Error.blue(errorMessage)
|
|
944
|
+
self.VISpar.errorMessage=errorMessage
|
|
945
|
+
|
|
946
|
+
calib.cal.allocAndinit(additionalPar,2)
|
|
947
|
+
|
|
948
|
+
pri.Process.yellow(f'TipoCal = [{calType} {F_Ph} {F_Pl} {F_Sa} {P_Cyl} {P_Ph}]')
|
|
949
|
+
pri.Process.yellow(f'initDataFromGui: additionalPar={additionalPar}')
|
|
950
|
+
pri.Process.yellow(f'initDataFromGui: plapar={INP.plapar}, z={z}')
|
|
951
|
+
pri.Process.yellow(f'initDataFromGui: calVect.z={calVect.z}')
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
calib.nCams=calib.cal.data.NCam
|
|
955
|
+
calib.cams=calib.cal.getCams()
|
|
956
|
+
calib.nPlanes=calib.cal.data.Numpiani
|
|
957
|
+
|
|
958
|
+
calib.nPlanesPerCam=calib.cal.data.Numpiani_PerCam
|
|
959
|
+
self.VISpar.nPlane=calib.nPlanesPerCam
|
|
960
|
+
self.VISpar.nCam=calib.nCams
|
|
961
|
+
self.FlagInitData=True
|
|
962
|
+
return
|
|
963
|
+
|
|
964
|
+
def setRunCalViButtonLayout(self):
|
|
965
|
+
if self.gui:
|
|
966
|
+
FlagVisible=True
|
|
967
|
+
calib=self.calibView.calib
|
|
968
|
+
calVect=calib.cal.vect
|
|
969
|
+
FlagVisible=all([not bool(p) for p in calVect.flagPlane[:-1]])
|
|
970
|
+
self.gui.ui.button_Run_CalVi.setVisible(FlagVisible)
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
if __name__ == "__main__":
|
|
974
|
+
import sys
|
|
975
|
+
app=QApplication.instance()
|
|
976
|
+
if not app:app = QApplication(sys.argv)
|
|
977
|
+
app.setStyle('Fusion')
|
|
978
|
+
object = Vis_Tab_CalVi(None)
|
|
979
|
+
object.show()
|
|
980
|
+
app.exec()
|
|
981
|
+
app.quit()
|
|
982
|
+
app=None
|