PaIRS-UniNa 0.1.13__cp310-cp310-win_amd64.whl → 0.2.8__cp310-cp310-win_amd64.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 +331 -0
- PaIRS_UniNa/Changes.txt +134 -2
- PaIRS_UniNa/Custom_Top.py +299 -299
- PaIRS_UniNa/Explorer.py +3136 -0
- PaIRS_UniNa/FolderLoop.py +562 -0
- PaIRS_UniNa/Input_Tab.py +831 -0
- PaIRS_UniNa/Input_Tab_CalVi.py +786 -0
- PaIRS_UniNa/Input_Tab_tools.py +3025 -0
- PaIRS_UniNa/Log_Tab.py +57 -14
- PaIRS_UniNa/Output_Tab.py +922 -0
- PaIRS_UniNa/PaIRS_PIV.py +111 -18
- PaIRS_UniNa/PaIRS_pypacks.py +698 -140
- PaIRS_UniNa/Process_Tab.py +1221 -1402
- PaIRS_UniNa/Process_Tab_CalVi.py +137 -262
- PaIRS_UniNa/Process_Tab_Disp.py +163 -0
- PaIRS_UniNa/Process_Tab_Min.py +120 -0
- PaIRS_UniNa/Saving_tools.py +296 -0
- PaIRS_UniNa/TabTools.py +863 -543
- PaIRS_UniNa/Vis_Tab.py +1898 -1315
- PaIRS_UniNa/Vis_Tab_CalVi.py +484 -356
- PaIRS_UniNa/Whatsnew.py +59 -10
- PaIRS_UniNa/_PaIRS_PIV.pyd +0 -0
- PaIRS_UniNa/__init__.py +4 -3
- PaIRS_UniNa/addwidgets_ps.py +326 -56
- PaIRS_UniNa/calib.py +19 -12
- PaIRS_UniNa/calibView.py +48 -25
- PaIRS_UniNa/gPaIRS.py +3902 -3461
- PaIRS_UniNa/gPalette.py +189 -170
- 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/bin_off.png +0 -0
- PaIRS_UniNa/icons/bin_on.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/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/close_all.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/cut.png +0 -0
- PaIRS_UniNa/icons/cut_warnings.png +0 -0
- PaIRS_UniNa/icons/darkmode.png +0 -0
- PaIRS_UniNa/icons/disp_step.png +0 -0
- PaIRS_UniNa/icons/disp_step_off.png +0 -0
- PaIRS_UniNa/icons/edit_list.png +0 -0
- PaIRS_UniNa/icons/example_list.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_beta.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/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/import_set.png +0 -0
- PaIRS_UniNa/icons/information.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/log_logo.png +0 -0
- PaIRS_UniNa/icons/logo_opaco.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/new_workspace.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/paused.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/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/read.png +0 -0
- PaIRS_UniNa/icons/read_list.png +0 -0
- PaIRS_UniNa/icons/reset.png +0 -0
- PaIRS_UniNa/icons/reset_levels.png +0 -0
- PaIRS_UniNa/icons/restore_undo.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/save_and_stop.png +0 -0
- PaIRS_UniNa/icons/save_cfg.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/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/unedited.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/vectorColor.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/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 +8 -8
- PaIRS_UniNa/parForMulti.py +7 -5
- PaIRS_UniNa/parForWorkers.py +370 -31
- PaIRS_UniNa/pivParFor.py +233 -229
- PaIRS_UniNa/plt_util.py +141 -141
- PaIRS_UniNa/preProcParFor.py +153 -148
- PaIRS_UniNa/procTools.py +631 -178
- PaIRS_UniNa/readcfg.py +31 -1
- PaIRS_UniNa/rqrdpckgs.txt +9 -0
- PaIRS_UniNa/stereoPivParFor.py +227 -0
- PaIRS_UniNa/tAVarie.py +215 -215
- PaIRS_UniNa/tabSplitter.py +612 -0
- PaIRS_UniNa/ui_Calibration_Tab.py +545 -0
- PaIRS_UniNa/ui_Custom_Top.py +5 -5
- PaIRS_UniNa/ui_Input_Tab.py +1101 -0
- PaIRS_UniNa/{ui_Import_Tab_CalVi.py → ui_Input_Tab_CalVi.py} +1282 -1275
- PaIRS_UniNa/ui_Log_Tab.py +262 -257
- PaIRS_UniNa/{ui_Export_Tab.py → ui_Output_Tab.py} +2361 -1778
- PaIRS_UniNa/ui_Process_Tab.py +3809 -3758
- PaIRS_UniNa/ui_Process_Tab_CalVi.py +1547 -1546
- PaIRS_UniNa/ui_Process_Tab_Disp.py +1141 -0
- PaIRS_UniNa/ui_Process_Tab_Min.py +437 -0
- PaIRS_UniNa/ui_Vis_Tab.py +1626 -1208
- PaIRS_UniNa/ui_Vis_Tab_CalVi.py +1249 -1249
- PaIRS_UniNa/ui_Whatsnew.py +131 -131
- PaIRS_UniNa/ui_gPairs.py +876 -950
- PaIRS_UniNa/ui_infoPaIRS.py +550 -425
- PaIRS_UniNa/whatsnew.txt +6 -4
- {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/METADATA +69 -51
- pairs_unina-0.2.8.dist-info/RECORD +329 -0
- {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/WHEEL +1 -1
- PaIRS_UniNa/CalVi.py +0 -18
- PaIRS_UniNa/Export_Tab.py +0 -574
- PaIRS_UniNa/Import_Tab.py +0 -657
- PaIRS_UniNa/Import_Tab_CalVi.py +0 -861
- PaIRS_UniNa/Import_Tab_tools.py +0 -598
- PaIRS_UniNa/Tree_Tab.py +0 -543
- PaIRS_UniNa/gCalVi.py +0 -2024
- PaIRS_UniNa/icons/add.png +0 -0
- PaIRS_UniNa/icons/cancelled.png +0 -0
- PaIRS_UniNa/icons/chain.png +0 -0
- PaIRS_UniNa/icons/chain_broken.png +0 -0
- PaIRS_UniNa/icons/default_sizes.png +0 -0
- PaIRS_UniNa/icons/dock_tabs.png +0 -0
- PaIRS_UniNa/icons/done.png +0 -0
- PaIRS_UniNa/icons/down_arrow.png +0 -0
- PaIRS_UniNa/icons/export_logo.png +0 -0
- PaIRS_UniNa/icons/fast_delete.png +0 -0
- PaIRS_UniNa/icons/flip_y.png +0 -0
- PaIRS_UniNa/icons/ganci.png +0 -0
- PaIRS_UniNa/icons/import_blue.png +0 -0
- PaIRS_UniNa/icons/import_logo.png +0 -0
- PaIRS_UniNa/icons/missing.png +0 -0
- PaIRS_UniNa/icons/process_icon.png +0 -0
- PaIRS_UniNa/icons/processing.png +0 -0
- PaIRS_UniNa/icons/restart.png +0 -0
- PaIRS_UniNa/icons/right_arrow.png +0 -0
- PaIRS_UniNa/icons/run_piv.png +0 -0
- PaIRS_UniNa/icons/terminal.png +0 -0
- PaIRS_UniNa/icons/undock_tabs.png +0 -0
- PaIRS_UniNa/icons/vect_field.png +0 -0
- PaIRS_UniNa/icons/w0.png +0 -0
- PaIRS_UniNa/icons/w1.png +0 -0
- PaIRS_UniNa/icons/w2.png +0 -0
- PaIRS_UniNa/icons/w3.png +0 -0
- PaIRS_UniNa/icons/w4.png +0 -0
- PaIRS_UniNa/icons/w5.png +0 -0
- PaIRS_UniNa/run_CalVi.py +0 -14
- PaIRS_UniNa/run_gcalvi.py +0 -5
- PaIRS_UniNa/ui_Import_Tab.py +0 -1077
- PaIRS_UniNa/ui_Tree_Tab.py +0 -684
- PaIRS_UniNa/ui_gCalVi.py +0 -640
- PaIRS_UniNa/ui_infoCalVi.py +0 -428
- PaIRS_UniNa-0.1.13.dist-info/LICENSE +0 -19
- PaIRS_UniNa-0.1.13.dist-info/RECORD +0 -174
- /PaIRS_UniNa/icons/{clean_queue.png → clean.png} +0 -0
- /PaIRS_UniNa/icons/{waiting_c.png → sandglass.png} +0 -0
- {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/top_level.txt +0 -0
PaIRS_UniNa/Vis_Tab_CalVi.py
CHANGED
|
@@ -2,7 +2,7 @@ from .ui_Vis_Tab_CalVi import*
|
|
|
2
2
|
from .TabTools import*
|
|
3
3
|
from .calib import Calib, CalibTasks, calibTasksText, CalibFunctions, calibFunctionsText
|
|
4
4
|
from .calibView import CalibView
|
|
5
|
-
from .
|
|
5
|
+
from .Input_Tab_CalVi import INPpar_CalVi
|
|
6
6
|
from .Process_Tab_CalVi import PROpar_CalVi
|
|
7
7
|
|
|
8
8
|
|
|
@@ -10,51 +10,92 @@ bufferSizeLimit=2000*1e6 #bytes
|
|
|
10
10
|
if __name__ == "__main__":
|
|
11
11
|
cfgName='../../img/calib/NewCam0.cfg'
|
|
12
12
|
cfgName='../../img/calib/NewCam0_Mod.cfg'
|
|
13
|
-
|
|
13
|
+
FlagRunning=True
|
|
14
14
|
else:
|
|
15
15
|
cfgName=''
|
|
16
|
-
|
|
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={}
|
|
17
50
|
|
|
18
51
|
class VISpar_CalVi(TABpar):
|
|
19
52
|
FlagVis=True
|
|
20
53
|
|
|
21
|
-
def __init__(self):
|
|
22
|
-
self.setup()
|
|
23
|
-
super().__init__()
|
|
24
|
-
self.name='VISpar'
|
|
25
|
-
self.surname='VIS_Tab'
|
|
54
|
+
def __init__(self,Process=ProcessTypes.null,Step=StepTypes.null):
|
|
55
|
+
self.setup(Process,Step)
|
|
56
|
+
super().__init__('VISpar_CalVi','Vis_CalVi')
|
|
26
57
|
self.unchecked_fields+=[]
|
|
27
58
|
|
|
28
|
-
def setup(self):
|
|
29
|
-
self.
|
|
30
|
-
self.
|
|
31
|
-
|
|
32
|
-
self.
|
|
33
|
-
self.
|
|
34
|
-
|
|
35
|
-
self.
|
|
36
|
-
self.
|
|
37
|
-
self.
|
|
38
|
-
self.
|
|
39
|
-
self.
|
|
40
|
-
|
|
41
|
-
self.
|
|
42
|
-
self.
|
|
43
|
-
self.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
self.
|
|
47
|
-
self.
|
|
48
|
-
self.
|
|
49
|
-
self.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
self.
|
|
53
|
-
self.
|
|
54
|
-
self.
|
|
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 = []
|
|
55
92
|
|
|
56
|
-
self.
|
|
57
|
-
self.
|
|
93
|
+
self.imList = []
|
|
94
|
+
self.imEx = []
|
|
95
|
+
self.splitterSizes = [ ]
|
|
96
|
+
|
|
97
|
+
self.FlagResetLevels = True
|
|
98
|
+
self.FlagResetZoom = True
|
|
58
99
|
|
|
59
100
|
self.errorMessage=''
|
|
60
101
|
|
|
@@ -62,6 +103,17 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
62
103
|
class VIS_Tab_Signals(gPaIRS_Tab.Tab_Signals):
|
|
63
104
|
run=Signal(bool)
|
|
64
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
|
+
|
|
65
117
|
def closeEvent(self,event):
|
|
66
118
|
''' called when closing
|
|
67
119
|
I had to add this to be sure that calib was destroyed'''
|
|
@@ -74,111 +126,134 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
74
126
|
super().resizeEvent(event)
|
|
75
127
|
self.setZoom()
|
|
76
128
|
|
|
77
|
-
def __init__(self
|
|
78
|
-
parent=None
|
|
79
|
-
self.flagInit=True
|
|
80
|
-
if len(args): parent=args[0]
|
|
81
|
-
if len(args)>1: self.flagInit=args[1]
|
|
129
|
+
def __init__(self,parent: QWidget =None, flagInit= __name__ == "__main__"):
|
|
82
130
|
super().__init__(parent,Ui_VisTab_CalVi,VISpar_CalVi)
|
|
83
131
|
self.signals=self.VIS_Tab_Signals(self)
|
|
84
132
|
|
|
85
133
|
#------------------------------------- Graphical interface: widgets
|
|
134
|
+
self.TABname='Vis_CalVi'
|
|
86
135
|
self.ui: Ui_VisTab_CalVi
|
|
87
|
-
ui=self.ui
|
|
88
136
|
|
|
89
|
-
|
|
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
|
+
|
|
90
144
|
#introducing CalibView
|
|
91
145
|
self.scrollArea = QtWidgets.QScrollArea(self)
|
|
146
|
+
self.scrollArea.setObjectName('scroll_area_Vis_CalVi')
|
|
92
147
|
self.scrollArea.setBackgroundRole(QtGui.QPalette.Dark)
|
|
93
148
|
self.calibView=CalibView(self.scrollArea,self.outFromCalibView,self.outToStatusBarFromCalibView,self.textFromCalib,self.workerCompleted)
|
|
94
149
|
self.scrollArea.setWidget(self.calibView)
|
|
95
|
-
self.ui.
|
|
150
|
+
self.ui.Vis_CalVi_splitter.insertWidget(0,self.scrollArea)
|
|
151
|
+
if __name__ == "__main__":
|
|
152
|
+
self.app=app
|
|
153
|
+
setAppGuiPalette(self)
|
|
96
154
|
|
|
97
155
|
#------------------------------------- Graphical interface: miscellanea
|
|
98
156
|
self.ui.status_L.setText('')
|
|
99
157
|
self.ui.status_R.setText('')
|
|
100
158
|
self.FlagFirstShow=False
|
|
101
|
-
self.FlagSettingNewCalib=False
|
|
102
159
|
self.setLogFont(fontPixelSize-dfontLog)
|
|
103
160
|
|
|
104
161
|
#------------------------------------- Declaration of parameters
|
|
105
162
|
self.VISpar_base=VISpar_CalVi()
|
|
106
163
|
self.VISpar:VISpar_CalVi=self.TABpar
|
|
107
|
-
self.VISpar_old:VISpar_CalVi=self.TABpar_old
|
|
108
|
-
self.defineSetTABpar(self.setVISpar)
|
|
109
|
-
|
|
164
|
+
self.VISpar_old:VISpar_CalVi=self.TABpar_old
|
|
110
165
|
|
|
111
166
|
#------------------------------------- Callbacks
|
|
112
|
-
self.
|
|
113
|
-
self.
|
|
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
|
+
|
|
114
184
|
self.FlagAddPrev=False
|
|
115
|
-
|
|
116
|
-
self.calibView.flagCurrentTask=CalibTasks.stop#todo GP per me si deve cancellare è stato già fatto nell'init di CalibView
|
|
185
|
+
|
|
186
|
+
self.calibView.flagCurrentTask=CalibTasks.stop #todo GP per me si deve cancellare è stato già fatto nell'init di CalibView
|
|
187
|
+
|
|
117
188
|
self.bufferImg={}
|
|
118
189
|
self.bufferSize=[]
|
|
119
190
|
self.setRunButtonText=lambda: None
|
|
120
191
|
|
|
192
|
+
self.FlagResume=0
|
|
193
|
+
self.FlagInitData=False
|
|
194
|
+
|
|
121
195
|
#------------------------------------- Initializing
|
|
122
|
-
if
|
|
196
|
+
if flagInit:
|
|
123
197
|
self.initialize()
|
|
124
198
|
|
|
125
199
|
def initialize(self):
|
|
126
200
|
pri.Info.yellow(f'{"*"*20} VIS initialization {"*"*20}')
|
|
127
|
-
self.defaultSplitterSize()
|
|
128
201
|
|
|
129
202
|
if self.VISpar.cfgName:
|
|
130
|
-
|
|
203
|
+
self.calibView.calib.cfgName=self.VISpar.cfgName
|
|
131
204
|
flagOp=self.calibView.calib.readCfg()
|
|
132
205
|
self.calibView.calib.readImgs() #todo verificare eventuali errori e dimensioni delle immagini in questo momento non da errore e l'img viene tagliata
|
|
133
206
|
|
|
134
|
-
self.
|
|
135
|
-
self.
|
|
136
|
-
|
|
137
|
-
#self.signals.run.emit(not flagOp)
|
|
207
|
+
self.nullCallback('CalVi process')
|
|
208
|
+
#self.adjustTABparInd()
|
|
138
209
|
self.runCalVi('_Mod' in self.VISpar.cfgName)
|
|
139
|
-
#self.ui.plot.show()
|
|
140
|
-
#self.setTABpar(True) #with bridge
|
|
141
210
|
|
|
142
|
-
def defaultSplitterSize(self):
|
|
143
|
-
self.ui.splitter.setSizes([self.width()-self.ui.w_Commands.minimumWidth(),self.ui.w_Commands.minimumWidth()])
|
|
144
|
-
|
|
145
211
|
@Slot(bool)
|
|
146
212
|
def runCalVi(self,flagMod=False):
|
|
213
|
+
self.FlagBridge=False
|
|
147
214
|
self.calibView.flagFirstTask=CalibTasks.findPlanesFromOrigin if flagMod else CalibTasks.findAllPlanes
|
|
148
|
-
self.VISpar.plane=self.VISpar.cam=
|
|
149
|
-
self.
|
|
215
|
+
self.VISpar.plane=self.VISpar.cam=1
|
|
216
|
+
self.VISpar.FlagPlotMask=False
|
|
150
217
|
if flagMod: self.ui.log.setText('')
|
|
218
|
+
self.setTABlayout()
|
|
151
219
|
if self.calibView.executeCalibTask(self.calibView.flagFirstTask):
|
|
152
220
|
self.setTaskButtonsText()
|
|
153
|
-
self.resetScaleFactor()
|
|
221
|
+
#self.resetScaleFactor()
|
|
154
222
|
|
|
155
223
|
def stopCalVi(self):
|
|
156
224
|
self.calibView.executeCalibTask(CalibTasks.stop)
|
|
157
225
|
self.setTaskButtonsText()
|
|
158
|
-
self.
|
|
226
|
+
self.gui.ui.button_Run_CalVi.setVisible(True)
|
|
227
|
+
self.setTABlayout()
|
|
228
|
+
self.FlagBridge=True
|
|
229
|
+
self.adjustTABparInd()
|
|
159
230
|
|
|
160
231
|
def show(self):
|
|
161
232
|
super().show()
|
|
162
233
|
if not self.FlagFirstShow:
|
|
163
234
|
self.FlagFirstShow=True
|
|
164
235
|
self.resetScaleFactor()
|
|
236
|
+
self.setVISlayout()
|
|
165
237
|
|
|
166
|
-
def
|
|
167
|
-
self.ui.
|
|
168
|
-
self.ui.button_zoom_equal.clicked.connect(self.addParWrapper(self.resetScaleFactor,'Zoom'))
|
|
169
|
-
self.ui.button_zoom_plus.clicked.connect(self.addParWrapper(lambda:self.zoom(1.25),'Zoom'))
|
|
170
|
-
self.ui.splitter.addfuncout['setScrollAreaWidth']=self.setZoom
|
|
171
|
-
|
|
238
|
+
def defineFurtherCallbacks(self):
|
|
239
|
+
self.ui.Vis_CalVi_splitter.addfuncout['setScrollAreaWidth']=self.wrappedCallback('Splitter sizes',self.splitterMoved)
|
|
172
240
|
|
|
173
241
|
self.taskButtons=[self.ui.button_findAll,
|
|
174
242
|
self.ui.button_find,
|
|
175
243
|
self.ui.button_calibrate,
|
|
176
244
|
self.ui.button_saveCoord,
|
|
177
245
|
]
|
|
178
|
-
self.
|
|
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))
|
|
179
254
|
for k,ind in enumerate([f.value for f in CalibTasks if f.value>0]):
|
|
180
|
-
self.
|
|
181
|
-
self.taskButtons[k].clicked.connect(self.
|
|
255
|
+
self.taskButtons_actions.append(create_taskButton_action(ind,k))
|
|
256
|
+
self.taskButtons[k].clicked.connect(self.taskButtons_actions[k])
|
|
182
257
|
|
|
183
258
|
self.buttonsToDisableNotCalibrated=[] #used to gray buttons if not calibrated
|
|
184
259
|
self.functionButtons=[
|
|
@@ -186,18 +261,24 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
186
261
|
self.ui.button_focusErr,
|
|
187
262
|
self.ui.button_copyGrid,
|
|
188
263
|
]
|
|
189
|
-
self.
|
|
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))
|
|
190
272
|
for k,ind in enumerate([f.value for f in CalibFunctions if f.value>0]):
|
|
191
|
-
self.
|
|
192
|
-
self.functionButtons[k].clicked.connect(self.
|
|
273
|
+
self.functionButtons_actions.append(create_functionButton_action(ind))
|
|
274
|
+
self.functionButtons[k].clicked.connect(self.functionButtons_actions[k])
|
|
193
275
|
self.buttonsToDisableNotCalibrated.append(self.functionButtons[k])
|
|
194
276
|
|
|
195
|
-
|
|
196
277
|
functionButtons_insert=[0,0,0]
|
|
197
278
|
for k,ind in enumerate([f.value for f in CalibFunctions]):
|
|
198
|
-
action=QAction(self.functionButtons[k].
|
|
279
|
+
action=QAction(self.functionButtons[k].icn,calibFunctionsText[abs(ind)],self)
|
|
199
280
|
self.calibView.contextMenuActions.insert(functionButtons_insert[k],action)
|
|
200
|
-
action.triggered.connect(
|
|
281
|
+
action.triggered.connect(create_functionButton_action(ind))
|
|
201
282
|
if ind>0:
|
|
202
283
|
self.buttonsToDisableNotCalibrated.append(action)
|
|
203
284
|
|
|
@@ -208,53 +289,6 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
208
289
|
self.originOffbox,
|
|
209
290
|
self.remPoinsBox,
|
|
210
291
|
] #used to gray buttons when calibrating
|
|
211
|
-
|
|
212
|
-
self.spin_plane_callback=self.addParWrapper(self.spinImgChanged,'Plane changed')
|
|
213
|
-
self.ui.spin_plane.valueChanged.connect(self.spin_plane_callback)
|
|
214
|
-
self.spin_cam_callback=self.spinImgChanged
|
|
215
|
-
self.spin_xOriOff_callback=lambda off: self.spin_OriOff_callback(off,self.ui.spin_xOriOff,True)
|
|
216
|
-
self.spin_yOriOff_callback=lambda off: self.spin_OriOff_callback(off,self.ui.spin_yOriOff,False)
|
|
217
|
-
|
|
218
|
-
self.spin_yp_callback=lambda off: self.spin_remPoi_callback(off, self.ui.spin_yp,False,True)
|
|
219
|
-
self.spin_ym_callback=lambda off: self.spin_remPoi_callback(off, self.ui.spin_ym,False,False)
|
|
220
|
-
self.spin_xp_callback=lambda off: self.spin_remPoi_callback(off, self.ui.spin_xp,True,True)
|
|
221
|
-
self.spin_xm_callback=lambda off: self.spin_remPoi_callback(off, self.ui.spin_xm,True,False)
|
|
222
|
-
self.ui.button_copyGrid.clicked.connect(self.copyRemPoints)
|
|
223
|
-
|
|
224
|
-
spin_names=['cam',
|
|
225
|
-
'LMin',
|
|
226
|
-
'LMax',
|
|
227
|
-
'yOriOff',
|
|
228
|
-
'xOriOff',
|
|
229
|
-
'yp',
|
|
230
|
-
'ym',
|
|
231
|
-
'xp',
|
|
232
|
-
'xm',
|
|
233
|
-
]
|
|
234
|
-
spin_tips=['Camera number (from 1 to number of cameras)',
|
|
235
|
-
'Minimum value of the image intensity',
|
|
236
|
-
'Maximum value of the image intensity',
|
|
237
|
-
'Shift the origin along y with respect to the first selected point in current target image',
|
|
238
|
-
'Shift the origin along x with respect to the first selected point in current target image',
|
|
239
|
-
'Maximum y limit for the point grid',
|
|
240
|
-
'Minimum y limit for the point grid',
|
|
241
|
-
'Maximum x limit for the point grid',
|
|
242
|
-
'Minimum x limit for the point grid',
|
|
243
|
-
]
|
|
244
|
-
self.setSpinCallbacks(spin_names,spin_tips)
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
self.button_restore_callback=self.addParWrapper(self.restoreLevels,'Restore image levels')
|
|
248
|
-
self.ui.button_restore.clicked.connect(self.button_restore_callback)
|
|
249
|
-
|
|
250
|
-
self.radio_showMask_callback=self.addParWrapper(self.showMask,'Show/hide correlation mask')
|
|
251
|
-
self.ui.radio_showMask.clicked.connect(self.radio_showMask_callback)
|
|
252
|
-
|
|
253
|
-
self.tool_plotMask_callback=self.addParWrapper(self.plotMask,'Plot correlation mask')
|
|
254
|
-
self.ui.tool_plotMask.clicked.connect(self.tool_plotMask_callback)
|
|
255
|
-
|
|
256
|
-
self.signals.run.connect(self.runCalVi)
|
|
257
|
-
return
|
|
258
292
|
|
|
259
293
|
def setLogFont(self,fPixSize):
|
|
260
294
|
logfont=self.ui.log.font()
|
|
@@ -262,93 +296,134 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
262
296
|
logfont.setPixelSize(fPixSize)
|
|
263
297
|
self.ui.log.setFont(logfont)
|
|
264
298
|
|
|
265
|
-
#*********************************************
|
|
266
|
-
def
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
self.
|
|
272
|
-
|
|
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
|
|
273
348
|
else:
|
|
274
|
-
self.
|
|
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)
|
|
275
378
|
|
|
276
379
|
FlagZoomLevels=FlagImg or FlagMask
|
|
277
380
|
self.ui.g_Zoom.setEnabled(FlagZoomLevels)
|
|
278
381
|
self.ui.g_Levels.setEnabled(FlagZoomLevels)
|
|
279
382
|
|
|
280
|
-
self.ui.
|
|
281
|
-
self.ui.radio_showMask.setChecked(self.VISpar.FlagShowMask)
|
|
282
|
-
self.ui.tool_plotMask.setEnabled(self.VISpar.FlagShowMask)
|
|
283
|
-
self.ui.tool_plotMask.setChecked(self.VISpar.FlagPlotMask and self.VISpar.FlagShowMask)
|
|
383
|
+
self.ui.button_PlotMask.setEnabled(self.VISpar.MaskType not in (2,3))
|
|
284
384
|
|
|
285
|
-
self.ui.w_Commands.setVisible(self.VISpar.
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if self.VISpar.FlagRun:
|
|
289
|
-
self.calibView.contextMenu =QtWidgets.QMenu(self)
|
|
385
|
+
self.ui.w_Commands.setVisible(self.VISpar.FlagRunning)
|
|
386
|
+
if self.VISpar.FlagRunning:
|
|
387
|
+
self.calibView.contextMenu = QtWidgets.QMenu(self)
|
|
290
388
|
for a in self.calibView.contextMenuActions:
|
|
291
389
|
self.calibView.contextMenu.addAction(a)
|
|
292
390
|
self.calibView.contextMenu.insertSeparator(self.calibView.contextMenuActions[1])
|
|
293
391
|
else:
|
|
294
392
|
self.calibView.contextMenu =None
|
|
295
393
|
|
|
296
|
-
self.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
self.
|
|
300
|
-
self.
|
|
301
|
-
|
|
302
|
-
self.
|
|
303
|
-
self.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if
|
|
308
|
-
self.
|
|
309
|
-
self.
|
|
310
|
-
|
|
311
|
-
|
|
394
|
+
self.setSpinMaxMin()
|
|
395
|
+
self.ui.Vis_CalVi_splitter.setSizes(self.VISpar.splitterSizes)
|
|
396
|
+
|
|
397
|
+
self.calibView.scaleFactor=self.VISpar.scaleFactor
|
|
398
|
+
self.calibView.calib.LMin=self.VISpar.LMin
|
|
399
|
+
self.calibView.calib.LMax=self.VISpar.LMax
|
|
400
|
+
self.calibView.calib.flagShowMask=self.VISpar.FlagShowMask
|
|
401
|
+
self.calibView.calib.flagPlotMask=self.VISpar.FlagPlotMask
|
|
402
|
+
|
|
403
|
+
FlagNoImage=True
|
|
404
|
+
if self.VISpar.cam>0 and self.VISpar.plane>0:
|
|
405
|
+
if self.VISpar.nCam==len(self.VISpar.imEx):
|
|
406
|
+
TargetType=self.gui.w_Process_CalVi.PROpar.TargetType
|
|
407
|
+
nPlane=self.VISpar.nPlane/(1+TargetType)
|
|
408
|
+
if nPlane==len(self.VISpar.imEx[0]):
|
|
409
|
+
plane=int( (self.VISpar.plane+TargetType)/(1+TargetType) )
|
|
410
|
+
if self.VISpar.imEx[self.VISpar.cam-1][plane-1]:
|
|
411
|
+
FlagNoImage=False
|
|
412
|
+
if FlagNoImage:
|
|
413
|
+
self.ui.status_R.setText('')
|
|
414
|
+
self.ui.status_L.setText('')
|
|
415
|
+
self.calibView.hide()
|
|
416
|
+
else:
|
|
417
|
+
if self.VISpar_old.FlagRunning!=self.VISpar.FlagRunning or (self.VISpar.nPlane>0 and self.VISpar_old.nPlane==0):
|
|
418
|
+
self.plotPlane()
|
|
419
|
+
self.button_zoom_equal_action()
|
|
312
420
|
self.setZoom()
|
|
313
421
|
self.plotPlane()
|
|
422
|
+
self.calibView.show()
|
|
423
|
+
if not self.VISpar.FlagInit:
|
|
424
|
+
self.button_zoom_equal_action()
|
|
425
|
+
self.setRunButtonText()
|
|
314
426
|
return
|
|
315
|
-
|
|
316
|
-
def calib2VIS(self,flagResetLevels=True,flagResetZoom=True):
|
|
317
|
-
c=self.calibView.calib
|
|
318
|
-
self.VISpar.nPlane=c.nPlanesPerCam
|
|
319
|
-
self.VISpar.nCam=c.nCams
|
|
320
|
-
"""
|
|
321
|
-
if flagReset:
|
|
322
|
-
self.VISpar.plane=0
|
|
323
|
-
self.VISpar.cam=0
|
|
324
|
-
else:
|
|
325
|
-
self.VISpar.plane=c.nPlanesPerCam if self.VISpar.plane>c.nPlanesPerCam else self.VISpar.plane
|
|
326
|
-
self.VISpar.cam=c.nCams if self.VISpar.cam>c.nCams else self.VISpar.cam
|
|
327
|
-
"""
|
|
328
|
-
|
|
329
|
-
c.setLMinMax()
|
|
330
|
-
self.VISpar.LLim=c.LLim
|
|
331
|
-
if flagResetLevels:
|
|
332
|
-
self.VISpar.LMin=c.LMin
|
|
333
|
-
self.VISpar.LMax=c.LMax
|
|
334
|
-
else:
|
|
335
|
-
self.VISpar.LMax=c.LMax if self.VISpar.LMax>c.LLim else self.VISpar.LMax
|
|
336
|
-
self.VISpar.LMin=self.VISpar.LMax-1 if self.VISpar.LMin >self.VISpar.LMax-1 else self.VISpar.LMin
|
|
337
|
-
|
|
338
|
-
self.VISpar.MaskType=abs(self.calibView.calib.cal.data.FlagPos)
|
|
339
|
-
if self.VISpar.MaskType in (2,3):
|
|
340
|
-
self.VISpar.FlagShowMask=0
|
|
341
|
-
self.VISpar.FlagPlotMask=0
|
|
342
|
-
self.FlagSettingNewCalib=flagResetZoom
|
|
343
|
-
#self.setVISpar()
|
|
344
|
-
|
|
345
|
-
def setSpinMaxMinLimValues(self):
|
|
346
|
-
spins=['plane','cam','LMin','LMax']
|
|
347
|
-
vals=[]
|
|
348
|
-
for s in spins: vals.append(getattr(self.VISpar,s))
|
|
349
|
-
self.setSpinMaxMin()
|
|
350
|
-
for s,v in zip(spins,vals): setattr(self.VISpar,s,v)
|
|
351
|
-
self.setSpinValues()
|
|
352
427
|
|
|
353
428
|
def setSpinMaxMin(self):
|
|
354
429
|
self.ui.spin_plane.setMinimum(1*bool(self.VISpar.nPlane))
|
|
@@ -361,110 +436,126 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
361
436
|
self.ui.spin_LMax.setMinimum(self.VISpar.LMin+1)
|
|
362
437
|
self.ui.spin_LMax.setMaximum(self.VISpar.LLim)
|
|
363
438
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
439
|
+
#********************************************* Zoom
|
|
440
|
+
#******************** Actions
|
|
441
|
+
def button_zoom_minus_action(self):
|
|
442
|
+
self.zoom(0.8)
|
|
443
|
+
return
|
|
444
|
+
|
|
445
|
+
def button_zoom_equal_action(self):
|
|
446
|
+
self.resetScaleFactor()
|
|
447
|
+
self.zoom(1.0)
|
|
448
|
+
return
|
|
449
|
+
|
|
450
|
+
def button_zoom_plus_action(self):
|
|
451
|
+
self.zoom(1.25)
|
|
452
|
+
return
|
|
375
453
|
|
|
376
|
-
def
|
|
377
|
-
|
|
378
|
-
if
|
|
379
|
-
self.
|
|
380
|
-
|
|
454
|
+
def zoom(self,zoom):
|
|
455
|
+
''' zooms f a factor zoom if negative reset to no zoom '''
|
|
456
|
+
if zoom<=0:
|
|
457
|
+
zoom = self.calibView.scaleFactor = 1.0
|
|
458
|
+
self.zoomImage(zoom)
|
|
459
|
+
|
|
460
|
+
def zoomImage(self, zoom):
|
|
461
|
+
''' zooms the image of self.CalibView.scaleFactor times a factor zoom
|
|
462
|
+
adjust also the scrollBars'''
|
|
463
|
+
self.calibView.scaleFactor *= zoom
|
|
464
|
+
self.VISpar.scaleFactor=self.calibView.scaleFactor
|
|
465
|
+
self.VISpar.scrollBarValues[0]=self.adjustedScrollBarValue(self.scrollArea.horizontalScrollBar(), zoom)
|
|
466
|
+
self.VISpar.scrollBarValues[1]=self.adjustedScrollBarValue(self.scrollArea.verticalScrollBar(), zoom)
|
|
467
|
+
|
|
468
|
+
def adjustedScrollBarValue(self, scrollBar:QScrollBar, factor):
|
|
469
|
+
''' adjust the position when zooming in or out '''
|
|
470
|
+
return int(factor * scrollBar.value() + ((factor - 1) * scrollBar.pageStep()/2))
|
|
471
|
+
|
|
472
|
+
def splitterMoved(self):
|
|
473
|
+
self.calibView.resetScaleFactor(self.scrollArea.size())
|
|
474
|
+
self.VISpar.defaultScaleFactor=self.calibView.scaleFactor
|
|
475
|
+
self.VISpar.splitterSizes=self.ui.Vis_CalVi_splitter.sizes()
|
|
381
476
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
477
|
+
#******************** Settings
|
|
478
|
+
def setZoom(self):
|
|
479
|
+
#self.calibView.show()
|
|
480
|
+
self.calibView.resize(self.VISpar.scaleFactor * self.calibView.pixmap().size())
|
|
481
|
+
self.scrollArea.horizontalScrollBar().setValue(self.VISpar.scrollBarValues[0])
|
|
482
|
+
self.scrollArea.verticalScrollBar().setValue(self.VISpar.scrollBarValues[1])
|
|
387
483
|
|
|
484
|
+
#******************** Adjusting
|
|
485
|
+
def resetScaleFactor(self):
|
|
486
|
+
''' reset the scale factor so that the image perfectly feet the window'''
|
|
487
|
+
self.calibView.resetScaleFactor(self.scrollArea.size())
|
|
488
|
+
self.VISpar.defaultScaleFactor=self.VISpar.scaleFactor=self.calibView.scaleFactor
|
|
489
|
+
self.VISpar.scrollBarValues=[0,0]
|
|
490
|
+
|
|
491
|
+
#********************************************* Levels
|
|
492
|
+
#******************** Actions
|
|
493
|
+
def button_restore_action(self):
|
|
494
|
+
self.VISpar.FlagResetLevels=True
|
|
495
|
+
|
|
496
|
+
#******************** Adjusting
|
|
388
497
|
def restoreLevels(self):
|
|
389
|
-
pc=self.VISpar.plane
|
|
390
|
-
c=self.VISpar.cam
|
|
498
|
+
pc=self.VISpar.plane-1
|
|
499
|
+
c=self.VISpar.cam-1
|
|
391
500
|
p=pc+c*self.calibView.calib.nPlanesPerCam
|
|
392
501
|
c=self.calibView.calib
|
|
393
502
|
c.setLMinMax(p)
|
|
394
|
-
self.VISpar.LLim=c.LLim
|
|
395
|
-
self.VISpar.LMin=c.LMin
|
|
396
|
-
self.VISpar.LMax=c.LMax
|
|
397
503
|
|
|
504
|
+
#********************************************* Mask
|
|
505
|
+
#******************** Actions
|
|
506
|
+
def button_PlotMask_action(self):
|
|
507
|
+
self.VISpar.FlagPlotMask=self.ui.button_PlotMask.isChecked()
|
|
508
|
+
|
|
509
|
+
#******************** Settings
|
|
510
|
+
def button_PlotMask_set(self):
|
|
511
|
+
self.ui.button_PlotMask.setChecked(self.VISpar.FlagPlotMask)
|
|
512
|
+
|
|
513
|
+
#********************************************* Plot
|
|
514
|
+
#******************** Layout
|
|
398
515
|
def plotPlane(self):
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
return
|
|
402
|
-
else:
|
|
403
|
-
self.calibView.show()
|
|
404
|
-
pc=self.VISpar.plane
|
|
405
|
-
c=self.VISpar.cam
|
|
516
|
+
pc=self.VISpar.plane-1
|
|
517
|
+
c=self.VISpar.cam-1
|
|
406
518
|
p=pc+c*self.calibView.calib.nPlanesPerCam
|
|
407
519
|
self.calibView.plotPlane(p)
|
|
408
520
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
521
|
+
#********************************************* Parameters
|
|
522
|
+
#******************** Actions
|
|
523
|
+
def spin_OriOff_action(self,spin:QSpinBox,flagX):
|
|
524
|
+
self.focusOnTarget()
|
|
525
|
+
Off=spin.value()
|
|
413
526
|
if spin.hasFocus():
|
|
414
|
-
self.calibView.spinOriginChanged(Off,
|
|
527
|
+
self.calibView.spinOriginChanged(Off,spin,flagX,flagPlot=False)
|
|
528
|
+
|
|
529
|
+
def spin_xOriOff_action(self):
|
|
530
|
+
self.spin_OriOff_action(self.ui.spin_xOriOff,True)
|
|
531
|
+
|
|
532
|
+
def spin_yOriOff_action(self):
|
|
533
|
+
self.spin_OriOff_action(self.ui.spin_yOriOff,False)
|
|
415
534
|
|
|
416
|
-
def
|
|
417
|
-
self.focusOnTarget(
|
|
418
|
-
|
|
419
|
-
setattr(self.VISpar,nameSpin,spin.value())
|
|
535
|
+
def spin_remPoi_action(self,spin:QSpinBox,flagX,flagPos):
|
|
536
|
+
self.focusOnTarget()
|
|
537
|
+
Off=spin.value()
|
|
420
538
|
if spin.hasFocus():
|
|
421
539
|
self.calibView.spinRemPoints(Off,spin,flagX,flagPos)
|
|
422
540
|
|
|
423
|
-
def
|
|
424
|
-
self.
|
|
425
|
-
self.calibView.copyRemPoints()
|
|
426
|
-
|
|
427
|
-
def showMask(self):
|
|
428
|
-
self.VISpar.FlagShowMask=self.ui.radio_showMask.isChecked()
|
|
429
|
-
if not self.VISpar.FlagShowMask: self.VISpar.FlagPlotMask=False
|
|
430
|
-
self.calibView.calib.flagShowMask=self.VISpar.FlagShowMask
|
|
431
|
-
self.calibView.calib.flagPlotMask=self.VISpar.FlagPlotMask
|
|
541
|
+
def spin_ym_action(self):
|
|
542
|
+
self.spin_remPoi_action(self.ui.spin_ym,flagX=False,flagPos=False)
|
|
432
543
|
|
|
433
|
-
def
|
|
434
|
-
self.
|
|
435
|
-
self.calibView.calib.flagPlotMask=self.VISpar.FlagPlotMask
|
|
436
|
-
#self.restoreLevels()
|
|
544
|
+
def spin_yp_action(self):
|
|
545
|
+
self.spin_remPoi_action(self.ui.spin_yp,flagX=False,flagPos=True)
|
|
437
546
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
''' reset the scale factor so that the image perfectly feet the window'''
|
|
441
|
-
self.calibView.resetScaleFactor(self.scrollArea.size())
|
|
442
|
-
self.VISpar.scaleFactor=self.calibView.scaleFactor
|
|
443
|
-
self.zoomImage(1)
|
|
547
|
+
def spin_xm_action(self):
|
|
548
|
+
self.spin_remPoi_action(self.ui.spin_xm,flagX=True,flagPos=False)
|
|
444
549
|
|
|
445
|
-
def
|
|
446
|
-
|
|
447
|
-
if zoom<=0:
|
|
448
|
-
zoom =self.calibView.scaleFactor = 1.0
|
|
449
|
-
self.zoomImage(zoom)
|
|
450
|
-
|
|
451
|
-
def zoomImage(self, zoom):
|
|
452
|
-
''' zooms the image of self.CalibView.scaleFactor times a factor zoom
|
|
453
|
-
adjust also the scrollBars'''
|
|
454
|
-
self.calibView.scaleFactor *= zoom
|
|
455
|
-
self.VISpar.scaleFactor=self.calibView.scaleFactor
|
|
456
|
-
self.setZoom()
|
|
457
|
-
self.adjustScrollBar(self.scrollArea.horizontalScrollBar(), zoom)
|
|
458
|
-
self.adjustScrollBar(self.scrollArea.verticalScrollBar(), zoom)
|
|
459
|
-
|
|
460
|
-
def setZoom(self):
|
|
461
|
-
self.calibView.resize(self.calibView.scaleFactor * self.calibView.pixmap().size())
|
|
462
|
-
|
|
463
|
-
def adjustScrollBar(self, scrollBar:QScrollBar, factor):
|
|
464
|
-
''' adjust the position when zooming in or out
|
|
465
|
-
# TBS copied and possibly modified wrongly'''
|
|
466
|
-
scrollBar.setValue(int(factor * scrollBar.value()+ ((factor - 1) * scrollBar.pageStep()/2)))
|
|
550
|
+
def spin_xp_action(self):
|
|
551
|
+
self.spin_remPoi_action(self.ui.spin_xp,flagX=True,flagPos=True)
|
|
467
552
|
|
|
553
|
+
def button_copyGrid_action(self):
|
|
554
|
+
self.focusOnTarget()
|
|
555
|
+
self.calibView.copyRemPoints()
|
|
556
|
+
|
|
557
|
+
def focusOnTarget(self):
|
|
558
|
+
self.VISpar.FlagPlotMask=False
|
|
468
559
|
|
|
469
560
|
#********************************************* CalibView function
|
|
470
561
|
def outFromCalibView(self,out:str):
|
|
@@ -475,8 +566,10 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
475
566
|
c=int(p/calib.nPlanesPerCam)
|
|
476
567
|
pc=p-c*calib.nPlanesPerCam
|
|
477
568
|
|
|
478
|
-
|
|
479
|
-
|
|
569
|
+
FlagSettingPar=TABpar.FlagSettingPar
|
|
570
|
+
TABpar.FlagSettingPar=True
|
|
571
|
+
self.VISpar.plane=pc+1
|
|
572
|
+
self.VISpar.cam=c+1
|
|
480
573
|
self.ui.spin_cam.setValue(c+1)
|
|
481
574
|
self.ui.spin_plane.setValue(pc+1)
|
|
482
575
|
|
|
@@ -487,6 +580,7 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
487
580
|
self.ui.spin_xp.setValue(da.remPointsRi[p])
|
|
488
581
|
self.ui.spin_ym.setValue(da.remPointsDo[p])
|
|
489
582
|
self.ui.spin_yp.setValue(da.remPointsUp[p])
|
|
583
|
+
TABpar.FlagSettingPar=FlagSettingPar
|
|
490
584
|
|
|
491
585
|
if self.VISpar.FlagPlotMask:
|
|
492
586
|
out2=' [CC mask]'
|
|
@@ -507,9 +601,6 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
507
601
|
#print(f'textFromCalib {out}')
|
|
508
602
|
self.ui.log.setText(out)
|
|
509
603
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
604
|
def workerCompleted(self,flagError):
|
|
514
605
|
''' called when worker has completed '''
|
|
515
606
|
if flagError:
|
|
@@ -521,7 +612,6 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
521
612
|
def setTaskButtonsText(self):
|
|
522
613
|
''' set all the button texts and enable/disable them '''
|
|
523
614
|
flagEnab=True if (self.calibView.flagCurrentTask==CalibTasks.stop) else False
|
|
524
|
-
self.updateGCalVi()
|
|
525
615
|
for f in [f for f in CalibTasks if f.value>0]:
|
|
526
616
|
if flagEnab: # stop the process -> enable all buttons and restore text
|
|
527
617
|
self.taskButtons [f.value-1].setText(calibTasksText[f.value])
|
|
@@ -535,6 +625,7 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
535
625
|
b.setEnabled(flagEnab)
|
|
536
626
|
for b in self.buttonsToDisableNotCalibrated:
|
|
537
627
|
b.setEnabled(self.calibView.calib.cal.flagCalibrated)
|
|
628
|
+
self.setRunCalViButtonLayout()
|
|
538
629
|
#for b in self.functionButtons: b.setEnabled(flagEnab)
|
|
539
630
|
#pri.Callback.green('-----abcde----- TaskButtonsText -----abcde-----')
|
|
540
631
|
|
|
@@ -550,23 +641,8 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
550
641
|
if flagFocus: self.focusOnTarget()
|
|
551
642
|
self.calibView.executeCalibFunction(flag)
|
|
552
643
|
#pri.Callback.green('-----|||||----- functionButtonPressed -----|||||-----')
|
|
553
|
-
|
|
554
|
-
def focusOnTarget(self,flagCallback=True):
|
|
555
|
-
if self.VISpar.FlagPlotMask:
|
|
556
|
-
self.ui.tool_plotMask.setChecked(False)
|
|
557
|
-
self.tool_plotMask_callback()
|
|
558
|
-
|
|
559
644
|
|
|
560
645
|
#********************************************* Spin callbacks
|
|
561
|
-
def spinImgChanged(self):
|
|
562
|
-
''' changes the plotted image'''
|
|
563
|
-
pc=self.ui.spin_plane.value()-1
|
|
564
|
-
self.VISpar.plane=pc
|
|
565
|
-
c=self.ui.spin_cam.value()-1
|
|
566
|
-
self.VISpar.cam=c
|
|
567
|
-
if self.ui.spin_plane.hasFocus() or self.ui.spin_cam.hasFocus():
|
|
568
|
-
self.plotPlane()
|
|
569
|
-
|
|
570
646
|
def setImgFromGui(self):
|
|
571
647
|
inddel=[]
|
|
572
648
|
calib=self.calibView.calib
|
|
@@ -574,39 +650,58 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
574
650
|
calib.ccMask=[]
|
|
575
651
|
flagFirstImage=True
|
|
576
652
|
npType=np.uint16
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
653
|
+
|
|
654
|
+
data=calib.cal.data
|
|
655
|
+
Him=data.ImgH
|
|
656
|
+
Wim=data.ImgW
|
|
657
|
+
if self.VISpar.imList: #only used to read the first image and fix the img dimensions
|
|
658
|
+
for imListc,imExc in zip(self.VISpar.imList,self.VISpar.imEx):
|
|
659
|
+
for k,f in enumerate(imListc):
|
|
660
|
+
ex=imExc[k]=os.path.exists(f)
|
|
661
|
+
if ex:
|
|
582
662
|
if f not in self.bufferImg:
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
663
|
+
try:
|
|
664
|
+
im=Image.open(f)
|
|
665
|
+
da=np.array(im,dtype=npType)
|
|
666
|
+
if len(da.shape)!=2:
|
|
667
|
+
self.bufferImg[f]=da=None
|
|
668
|
+
raise(f'Error: the image file: {f} seems not to be grayscale!')
|
|
669
|
+
else:
|
|
670
|
+
self.bufferImg[f]=da
|
|
671
|
+
except:
|
|
672
|
+
pri.Error.red(f'Error while opening the image file: {f}.\n{traceback.format_exc()}\n')
|
|
673
|
+
self.bufferImg[f]=da=None
|
|
586
674
|
else:
|
|
587
675
|
da=self.bufferImg[f]
|
|
588
|
-
if flagFirstImage:
|
|
676
|
+
if flagFirstImage and da is not None:
|
|
589
677
|
Him,Wim=da.shape
|
|
590
678
|
flagFirstImage=False
|
|
591
679
|
break
|
|
592
|
-
if not flagFirstImage: break
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
for j in range(len(self.list_Image_Files[0])):
|
|
599
|
-
for k,fp in enumerate(self.list_Image_Files):
|
|
600
|
-
f=fp[j]
|
|
680
|
+
if not flagFirstImage: break
|
|
681
|
+
if self.VISpar.imList: #reading the images
|
|
682
|
+
for imListc,imExc in zip(self.VISpar.imList,self.VISpar.imEx):
|
|
683
|
+
k=-1
|
|
684
|
+
for f,ex in zip(imListc,imExc):
|
|
685
|
+
k+=1
|
|
601
686
|
if f not in self.bufferImg:
|
|
602
|
-
if
|
|
603
|
-
|
|
604
|
-
|
|
687
|
+
if ex:
|
|
688
|
+
try:
|
|
689
|
+
im=Image.open(f)
|
|
690
|
+
da=np.array(im,dtype=npType)
|
|
691
|
+
if len(da.shape)!=2:
|
|
692
|
+
da=None
|
|
693
|
+
raise(f'Error: the image file: {f} seems not to be grayscale!')
|
|
694
|
+
except:
|
|
695
|
+
pri.Error.red(f'Error while opening the image file: {f}.\n{traceback.format_exc()}\n')
|
|
696
|
+
da=None
|
|
605
697
|
else:
|
|
606
698
|
da=np.zeros((Him,Wim),dtype=npType)
|
|
607
699
|
self.bufferImg[f]=da
|
|
608
700
|
else:
|
|
609
701
|
da=self.bufferImg[f]
|
|
702
|
+
if da is None:
|
|
703
|
+
inddel.append(k)
|
|
704
|
+
continue
|
|
610
705
|
h,w=da.shape
|
|
611
706
|
if (Wim,Him)!=(w,h):
|
|
612
707
|
inddel.append(k)
|
|
@@ -617,17 +712,18 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
617
712
|
|
|
618
713
|
self.bufferSize=0
|
|
619
714
|
for f in self.bufferImg:#deleting buffer if to big
|
|
620
|
-
|
|
715
|
+
a:np.ndarray=self.bufferImg[f]
|
|
716
|
+
if a is not None:
|
|
621
717
|
self.bufferSize+=a.size*a.itemsize
|
|
622
718
|
if self.bufferSize>bufferSizeLimit:
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
719
|
+
imgList=list(self.bufferImg)
|
|
720
|
+
k=0
|
|
721
|
+
while self.bufferSize>bufferSizeLimit and len(imgList) and imgList[k] not in self.VISpar.imList:
|
|
722
|
+
f=imgList[k]
|
|
723
|
+
a=self.bufferImg[f]
|
|
724
|
+
self.bufferSize-=a.size*a.itemsize
|
|
725
|
+
self.bufferImg.pop(f)
|
|
726
|
+
imgList.pop(k)
|
|
631
727
|
|
|
632
728
|
if calib.imgs:
|
|
633
729
|
calib.cal.setImgs(calib.imgs)
|
|
@@ -636,16 +732,19 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
636
732
|
return inddel
|
|
637
733
|
|
|
638
734
|
def initDataFromGui(self,INP:INPpar_CalVi,PRO:PROpar_CalVi):
|
|
735
|
+
#FlagNewImages=self.VISpar.imList!=INP.imList or self.VISpar.imEx!=INP.imEx
|
|
736
|
+
#if not FlagNewImages: return FlagNewImages
|
|
737
|
+
self.VISpar.imList=copy.deepcopy(INP.imList)
|
|
738
|
+
self.VISpar.imEx=copy.deepcopy(INP.imEx)
|
|
639
739
|
calib=self.calibView.calib
|
|
640
740
|
calib.cal.DefaultValues()
|
|
641
741
|
calib.FlagCalibration=False
|
|
642
|
-
|
|
643
|
-
self.list_eim=INP.list_eim
|
|
742
|
+
|
|
644
743
|
self.FlagResume=0
|
|
645
744
|
#-------------------------------------- %
|
|
646
745
|
# Not in cfg %
|
|
647
746
|
# --------------------------------------%
|
|
648
|
-
|
|
747
|
+
|
|
649
748
|
data=calib.cal.data
|
|
650
749
|
calVect=calib.cal.vect
|
|
651
750
|
data.PercErrMax = 0.1 # 0.10 Percentuale massima per errore in posizioneTom da modificare
|
|
@@ -656,28 +755,37 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
656
755
|
# --------------------------------------%
|
|
657
756
|
data.percorso = INP.path #percorso file di input
|
|
658
757
|
data.EstensioneIn = INP.ext #estensione in (b16 o tif)
|
|
659
|
-
data.FlagCam=0 if
|
|
660
|
-
data.percorsoOut = INP.
|
|
661
|
-
data.NomeFileOut = INP.
|
|
758
|
+
data.FlagCam=0 if INP.FlagCam else 1
|
|
759
|
+
data.percorsoOut = INP.path_out # percorso file di output
|
|
760
|
+
data.NomeFileOut = INP.root_out # nome file di output
|
|
662
761
|
|
|
663
762
|
camString=''
|
|
664
763
|
cams=INP.cams
|
|
665
|
-
if
|
|
764
|
+
if INP.FlagCam:
|
|
666
765
|
if len(cams)==1: camString=f'_cam{cams[0]}'
|
|
667
766
|
else:
|
|
668
767
|
cams=[-1]
|
|
669
768
|
calib.cfgName=f'{data.percorsoOut}{data.NomeFileOut}{camString}.cfg'
|
|
670
|
-
data.NCam = len(cams) # Numero di elementi nel vettore cam (numero di camere da calibrare)
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
769
|
+
data.NCam = len(cams) if INP.FlagCam else 1 # Numero di elementi nel vettore cam (numero di camere da calibrare)
|
|
770
|
+
|
|
771
|
+
if self.VISpar.FlagRunning:
|
|
772
|
+
varName=f'{data.percorsoOut}{data.NomeFileOut}{camString}{outExt.calvi}'
|
|
773
|
+
if os.path.exists(varName):
|
|
774
|
+
try:
|
|
775
|
+
with open(varName, 'rb') as file:
|
|
776
|
+
try:
|
|
777
|
+
var=pickle.load(file)
|
|
778
|
+
except:
|
|
779
|
+
self.FlagResume=-1
|
|
780
|
+
else:
|
|
781
|
+
self.FlagResume=1 if INP.isEqualTo(var[0],exceptions=TABpar().fields,fields=['cams','filenames','x','y','w','h','W','H']) else -1
|
|
782
|
+
INP.printDifferences(var[0])
|
|
783
|
+
#PRO.printDifferences(var[1])
|
|
784
|
+
if self.FlagResume>0:
|
|
785
|
+
self.VISpar.copyfrom(var[2],TABpar().fields+['FlagRunning'])
|
|
786
|
+
except:
|
|
787
|
+
self.FlagResume=-1
|
|
788
|
+
pri.Error.red(f'Error while restoring the previous calibration process file: {varName}.\n{traceback.format_exc()}\n')
|
|
681
789
|
|
|
682
790
|
#-------------------------------------- %
|
|
683
791
|
# Distance between spots %
|
|
@@ -721,6 +829,12 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
721
829
|
data.Numpiani = data.NCam * data.Numpiani_PerCam
|
|
722
830
|
|
|
723
831
|
if len(INP.filenames) <1 : #when initializing the filenames are not known
|
|
832
|
+
calib.nCams=0
|
|
833
|
+
calib.cams=[]
|
|
834
|
+
calib.nPlanes=0
|
|
835
|
+
calib.nPlanesPerCam=0
|
|
836
|
+
self.VISpar.nPlane=calib.nPlanesPerCam
|
|
837
|
+
self.VISpar.nCam=calib.nCams
|
|
724
838
|
return
|
|
725
839
|
|
|
726
840
|
CamModType=[1,2,3,10,30][PRO.CamMod]
|
|
@@ -839,10 +953,24 @@ class Vis_Tab_CalVi(gPaIRS_Tab):
|
|
|
839
953
|
calib.nCams=calib.cal.data.NCam
|
|
840
954
|
calib.cams=calib.cal.getCams()
|
|
841
955
|
calib.nPlanes=calib.cal.data.Numpiani
|
|
956
|
+
|
|
842
957
|
calib.nPlanesPerCam=calib.cal.data.Numpiani_PerCam
|
|
958
|
+
self.VISpar.nPlane=calib.nPlanesPerCam
|
|
959
|
+
self.VISpar.nCam=calib.nCams
|
|
960
|
+
self.FlagInitData=True
|
|
961
|
+
return
|
|
962
|
+
|
|
963
|
+
def setRunCalViButtonLayout(self):
|
|
964
|
+
if self.gui:
|
|
965
|
+
FlagVisible=True
|
|
966
|
+
calib=self.calibView.calib
|
|
967
|
+
calVect=calib.cal.vect
|
|
968
|
+
FlagVisible=all([not bool(p) for p in calVect.flagPlane[:-1]])
|
|
969
|
+
self.gui.ui.button_Run_CalVi.setVisible(FlagVisible)
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
|
|
843
973
|
|
|
844
|
-
return
|
|
845
|
-
|
|
846
974
|
if __name__ == "__main__":
|
|
847
975
|
import sys
|
|
848
976
|
app=QApplication.instance()
|