PaIRS-UniNa 0.2.4__cp312-cp312-macosx_10_9_universal2.whl → 0.2.5__cp312-cp312-macosx_10_9_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.

Potentially problematic release.


This version of PaIRS-UniNa might be problematic. Click here for more details.

Files changed (57) hide show
  1. PaIRS_UniNa/Changes.txt +23 -0
  2. PaIRS_UniNa/Custom_Top.py +1 -1
  3. PaIRS_UniNa/Explorer.py +3059 -3049
  4. PaIRS_UniNa/FolderLoop.py +371 -371
  5. PaIRS_UniNa/Input_Tab.py +714 -709
  6. PaIRS_UniNa/Input_Tab_tools.py +3017 -3009
  7. PaIRS_UniNa/Output_Tab.py +2 -2
  8. PaIRS_UniNa/PaIRS.py +17 -17
  9. PaIRS_UniNa/PaIRS_PIV.py +56 -1
  10. PaIRS_UniNa/PaIRS_pypacks.py +143 -6
  11. PaIRS_UniNa/Process_Tab.py +6 -11
  12. PaIRS_UniNa/Process_Tab_Disp.py +8 -3
  13. PaIRS_UniNa/Saving_tools.py +277 -277
  14. PaIRS_UniNa/TabTools.py +56 -17
  15. PaIRS_UniNa/Vis_Tab.py +237 -78
  16. PaIRS_UniNa/Whatsnew.py +2 -0
  17. PaIRS_UniNa/_PaIRS_PIV.so +0 -0
  18. PaIRS_UniNa/__init__.py +2 -2
  19. PaIRS_UniNa/gPaIRS.py +3745 -3600
  20. PaIRS_UniNa/icons/pylog.png +0 -0
  21. PaIRS_UniNa/icons/python_warning.png +0 -0
  22. PaIRS_UniNa/icons/queue.png +0 -0
  23. PaIRS_UniNa/icons/uninitialized.png +0 -0
  24. PaIRS_UniNa/icons/window.png +0 -0
  25. PaIRS_UniNa/listLib.py +301 -301
  26. PaIRS_UniNa/parForMulti.py +433 -433
  27. PaIRS_UniNa/parForWorkers.py +46 -1
  28. PaIRS_UniNa/procTools.py +17 -7
  29. PaIRS_UniNa/rqrdpckgs.txt +8 -0
  30. PaIRS_UniNa/stereo.py +683 -683
  31. PaIRS_UniNa/tabSplitter.py +606 -606
  32. PaIRS_UniNa/ui_Calibration_Tab.py +542 -542
  33. PaIRS_UniNa/ui_Custom_Top.py +294 -294
  34. PaIRS_UniNa/ui_Input_Tab.py +1098 -1098
  35. PaIRS_UniNa/ui_Input_Tab_CalVi.py +1280 -1280
  36. PaIRS_UniNa/ui_Log_Tab.py +261 -261
  37. PaIRS_UniNa/ui_Output_Tab.py +2360 -2360
  38. PaIRS_UniNa/ui_Process_Tab.py +3808 -3808
  39. PaIRS_UniNa/ui_Process_Tab_CalVi.py +1547 -1547
  40. PaIRS_UniNa/ui_Process_Tab_Disp.py +1139 -968
  41. PaIRS_UniNa/ui_Process_Tab_Min.py +435 -435
  42. PaIRS_UniNa/ui_ResizePopup.py +203 -203
  43. PaIRS_UniNa/ui_Vis_Tab.py +1626 -1533
  44. PaIRS_UniNa/ui_Vis_Tab_CalVi.py +1249 -1249
  45. PaIRS_UniNa/ui_Whatsnew.py +131 -131
  46. PaIRS_UniNa/ui_gPairs.py +867 -849
  47. PaIRS_UniNa/ui_infoPaIRS.py +550 -428
  48. PaIRS_UniNa/whatsnew.txt +5 -4
  49. {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.5.dist-info}/METADATA +38 -26
  50. {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.5.dist-info}/RECORD +52 -52
  51. {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.5.dist-info}/WHEEL +1 -1
  52. PaIRS_UniNa/icons/order.png +0 -0
  53. PaIRS_UniNa/icons/order_reverse.png +0 -0
  54. PaIRS_UniNa/icons/pencil_bw.png +0 -0
  55. PaIRS_UniNa/icons/run_piv.png +0 -0
  56. PaIRS_UniNa-0.2.4.dist-info/LICENSE +0 -19
  57. {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.5.dist-info}/top_level.txt +0 -0
PaIRS_UniNa/Output_Tab.py CHANGED
@@ -399,7 +399,7 @@ class Output_Tab(gPaIRS_Tab):
399
399
  self.setOptionValidRoot(ind)
400
400
  self.checkMinCompatibility(ind)
401
401
  self.checkCommonRegion(ind)
402
- OUT.OptionDone=1 if OUT.OptionValidPath==1 and OUT.OptionValidSubFold in (1,-1) and OUT.OptionValidRoot in (1,-2) and OUT.OptionValidMin==1 and not OUT.FlagWarnCR else 0 if OUT.OptionValidPath==0 or OUT.OptionValidSubFold==0 or OUT.OptionValidRoot in (0,-1) or OUT.OptionValidMin==0 or OUT.FlagWarnCR else -1
402
+ OUT.OptionDone=1 if OUT.OptionValidPath==1 and OUT.OptionValidSubFold in (1,-1) and OUT.OptionValidRoot==1 and OUT.OptionValidMin==1 and not OUT.FlagWarnCR else 0 if OUT.OptionValidPath==0 or OUT.OptionValidSubFold==0 or OUT.OptionValidRoot in (0,-1) or OUT.OptionValidMin==0 or OUT.FlagWarnCR else -1
403
403
  #pri.Info.blue(f'Output OptionDone = {OUT.OptionDone}')
404
404
 
405
405
  def get_image_dimensions(self,file_name):
@@ -419,7 +419,7 @@ class Output_Tab(gPaIRS_Tab):
419
419
  ind=OUT.ind
420
420
  else: OUT:OUTpar=self.TABpar_at(ind)
421
421
 
422
- if OUT.imageFile is not None and OUT.imageFileMin is not None and self.get_image_dimensions(self.OUTpar.inputPath+OUT.imageFile)!=self.get_image_dimensions(OUT.imageFileMin):
422
+ if OUT.Step!=StepTypes.min and OUT.imageFile is not None and OUT.imageFileMin is not None and self.get_image_dimensions(OUT.inputPath+OUT.imageFile)!=self.get_image_dimensions(OUT.imageFileMin):
423
423
  OUT.OptionValidMin=0
424
424
  else:
425
425
  OUT.OptionValidMin=1
PaIRS_UniNa/PaIRS.py CHANGED
@@ -1,18 +1,18 @@
1
1
  from .gPaIRS import *
2
-
3
- def run():
4
- gui:gPaIRS
5
- app,gui,flagPrint=launchPaIRS()
6
- quitPaIRS(app,flagPrint)
7
-
8
- def cleanRun():
9
- if os.path.exists(lastcfgname):
10
- os.remove(lastcfgname)
11
- run()
12
-
13
- def debugRun():
14
- gui:gPaIRS
15
- app,gui,flagPrint=launchPaIRS(flagInputDebug=True)
16
- quitPaIRS(app,flagPrint)
17
-
18
-
2
+
3
+ def run():
4
+ gui:gPaIRS
5
+ app,gui,flagPrint=launchPaIRS()
6
+ quitPaIRS(app,flagPrint)
7
+
8
+ def cleanRun():
9
+ if os.path.exists(lastcfgname):
10
+ os.remove(lastcfgname)
11
+ run()
12
+
13
+ def debugRun():
14
+ gui:gPaIRS
15
+ app,gui,flagPrint=launchPaIRS(flagInputDebug=True)
16
+ quitPaIRS(app,flagPrint)
17
+
18
+
PaIRS_UniNa/PaIRS_PIV.py CHANGED
@@ -568,11 +568,17 @@ class DatiProcVect(object):
568
568
  teta = property(_PaIRS_PIV.DatiProcVect_teta_get, _PaIRS_PIV.DatiProcVect_teta_set)
569
569
  dOrt = property(_PaIRS_PIV.DatiProcVect_dOrt_get, _PaIRS_PIV.DatiProcVect_dOrt_set)
570
570
  dPar = property(_PaIRS_PIV.DatiProcVect_dPar_get, _PaIRS_PIV.DatiProcVect_dPar_set)
571
+ dParOld = property(_PaIRS_PIV.DatiProcVect_dParOld_get, _PaIRS_PIV.DatiProcVect_dParOld_set)
572
+ widthPar = property(_PaIRS_PIV.DatiProcVect_widthPar_get, _PaIRS_PIV.DatiProcVect_widthPar_set)
573
+ maxCC = property(_PaIRS_PIV.DatiProcVect_maxCC_get, _PaIRS_PIV.DatiProcVect_maxCC_set)
571
574
  x = property(_PaIRS_PIV.DatiProcVect_x_get, _PaIRS_PIV.DatiProcVect_x_set)
572
575
  y = property(_PaIRS_PIV.DatiProcVect_y_get, _PaIRS_PIV.DatiProcVect_y_set)
573
576
  z = property(_PaIRS_PIV.DatiProcVect_z_get, _PaIRS_PIV.DatiProcVect_z_set)
577
+ info = property(_PaIRS_PIV.DatiProcVect_info_get, _PaIRS_PIV.DatiProcVect_info_set)
574
578
  tanCsi = property(_PaIRS_PIV.DatiProcVect_tanCsi_get, _PaIRS_PIV.DatiProcVect_tanCsi_set)
575
579
  CC = property(_PaIRS_PIV.DatiProcVect_CC_get, _PaIRS_PIV.DatiProcVect_CC_set)
580
+ init4DArrayRot = property(_PaIRS_PIV.DatiProcVect_init4DArrayRot_get, _PaIRS_PIV.DatiProcVect_init4DArrayRot_set)
581
+ CCrot = property(_PaIRS_PIV.DatiProcVect_CCrot_get, _PaIRS_PIV.DatiProcVect_CCrot_set)
576
582
 
577
583
  def __init__(self):
578
584
  _PaIRS_PIV.DatiProcVect_swiginit(self, _PaIRS_PIV.new_DatiProcVect())
@@ -669,13 +675,21 @@ class DispAvgCorr(object):
669
675
  ic = property(_PaIRS_PIV.DispAvgCorr_ic_get, _PaIRS_PIV.DispAvgCorr_ic_set)
670
676
  jc = property(_PaIRS_PIV.DispAvgCorr_jc_get, _PaIRS_PIV.DispAvgCorr_jc_set)
671
677
  NImg = property(_PaIRS_PIV.DispAvgCorr_NImg_get, _PaIRS_PIV.DispAvgCorr_NImg_set)
672
- DeltaZ = property(_PaIRS_PIV.DispAvgCorr_DeltaZ_get, _PaIRS_PIV.DispAvgCorr_DeltaZ_set)
678
+ nIterMaxValid = property(_PaIRS_PIV.DispAvgCorr_nIterMaxValid_get, _PaIRS_PIV.DispAvgCorr_nIterMaxValid_set)
679
+ numStd = property(_PaIRS_PIV.DispAvgCorr_numStd_get, _PaIRS_PIV.DispAvgCorr_numStd_set)
673
680
  dOrtMean = property(_PaIRS_PIV.DispAvgCorr_dOrtMean_get, _PaIRS_PIV.DispAvgCorr_dOrtMean_set)
681
+ dParMean = property(_PaIRS_PIV.DispAvgCorr_dParMean_get, _PaIRS_PIV.DispAvgCorr_dParMean_set)
682
+ percOutlier = property(_PaIRS_PIV.DispAvgCorr_percOutlier_get, _PaIRS_PIV.DispAvgCorr_percOutlier_set)
683
+ DeltaZ = property(_PaIRS_PIV.DispAvgCorr_DeltaZ_get, _PaIRS_PIV.DispAvgCorr_DeltaZ_set)
674
684
  ta0Mean = property(_PaIRS_PIV.DispAvgCorr_ta0Mean_get, _PaIRS_PIV.DispAvgCorr_ta0Mean_set)
675
685
  ta1Mean = property(_PaIRS_PIV.DispAvgCorr_ta1Mean_get, _PaIRS_PIV.DispAvgCorr_ta1Mean_set)
686
+ RisxRadd = property(_PaIRS_PIV.DispAvgCorr_RisxRadd_get, _PaIRS_PIV.DispAvgCorr_RisxRadd_set)
676
687
  RaggioFiltro = property(_PaIRS_PIV.DispAvgCorr_RaggioFiltro_get, _PaIRS_PIV.DispAvgCorr_RaggioFiltro_set)
677
688
  SogliaCor = property(_PaIRS_PIV.DispAvgCorr_SogliaCor_get, _PaIRS_PIV.DispAvgCorr_SogliaCor_set)
678
689
  N_NormEpi = property(_PaIRS_PIV.DispAvgCorr_N_NormEpi_get, _PaIRS_PIV.DispAvgCorr_N_NormEpi_set)
690
+ minStdDOrt = property(_PaIRS_PIV.DispAvgCorr_minStdDOrt_get, _PaIRS_PIV.DispAvgCorr_minStdDOrt_set)
691
+ minStdDPar = property(_PaIRS_PIV.DispAvgCorr_minStdDPar_get, _PaIRS_PIV.DispAvgCorr_minStdDPar_set)
692
+ minStdMaxCC = property(_PaIRS_PIV.DispAvgCorr_minStdMaxCC_get, _PaIRS_PIV.DispAvgCorr_minStdMaxCC_set)
679
693
 
680
694
  def __init__(self):
681
695
  _PaIRS_PIV.DispAvgCorr_swiginit(self, _PaIRS_PIV.new_DispAvgCorr())
@@ -759,6 +773,47 @@ class StereoDisp(StereoBase):
759
773
 
760
774
  # Register StereoDisp in _PaIRS_PIV:
761
775
  _PaIRS_PIV.StereoDisp_swigregister(StereoDisp)
776
+ class AniDiff(object):
777
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
778
+ __repr__ = _swig_repr
779
+ nIt = property(_PaIRS_PIV.AniDiff_nIt_get, _PaIRS_PIV.AniDiff_nIt_set)
780
+ K = property(_PaIRS_PIV.AniDiff_K_get, _PaIRS_PIV.AniDiff_K_set)
781
+ lam = property(_PaIRS_PIV.AniDiff_lam_get, _PaIRS_PIV.AniDiff_lam_set)
782
+ semiLen = property(_PaIRS_PIV.AniDiff_semiLen_get, _PaIRS_PIV.AniDiff_semiLen_set)
783
+ flagFilter = property(_PaIRS_PIV.AniDiff_flagFilter_get, _PaIRS_PIV.AniDiff_flagFilter_set)
784
+ flagBC = property(_PaIRS_PIV.AniDiff_flagBC_get, _PaIRS_PIV.AniDiff_flagBC_set)
785
+ numThreads = property(_PaIRS_PIV.AniDiff_numThreads_get, _PaIRS_PIV.AniDiff_numThreads_set)
786
+ numBoxes = property(_PaIRS_PIV.AniDiff_numBoxes_get, _PaIRS_PIV.AniDiff_numBoxes_set)
787
+ indBoxes = property(_PaIRS_PIV.AniDiff_indBoxes_get, _PaIRS_PIV.AniDiff_indBoxes_set)
788
+
789
+ def __init__(self):
790
+ _PaIRS_PIV.AniDiff_swiginit(self, _PaIRS_PIV.new_AniDiff())
791
+ __swig_destroy__ = _PaIRS_PIV.delete_AniDiff
792
+
793
+ # Register AniDiff in _PaIRS_PIV:
794
+ _PaIRS_PIV.AniDiff_swigregister(AniDiff)
795
+ class AniDif(object):
796
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
797
+ __repr__ = _swig_repr
798
+
799
+ def __init__(self):
800
+ _PaIRS_PIV.AniDif_swiginit(self, _PaIRS_PIV.new_AniDif())
801
+ __swig_destroy__ = _PaIRS_PIV.delete_AniDif
802
+
803
+ def SizeOfReal(self):
804
+ return _PaIRS_PIV.AniDif_SizeOfReal(self)
805
+
806
+ def run(self, npArr):
807
+ return _PaIRS_PIV.AniDif_run(self, npArr)
808
+
809
+ def initAll(self, npArr):
810
+ return _PaIRS_PIV.AniDif_initAll(self, npArr)
811
+ data = property(_PaIRS_PIV.AniDif_data_get, _PaIRS_PIV.AniDif_data_set)
812
+ indBoxes = property(_PaIRS_PIV.AniDif_indBoxes_get, _PaIRS_PIV.AniDif_indBoxes_set)
813
+ boxAverage = property(_PaIRS_PIV.AniDif_boxAverage_get, _PaIRS_PIV.AniDif_boxAverage_set)
814
+
815
+ # Register AniDif in _PaIRS_PIV:
816
+ _PaIRS_PIV.AniDif_swigregister(AniDif)
762
817
  class DataFromPIV(object):
763
818
  thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
764
819
  __repr__ = _swig_repr
@@ -20,6 +20,7 @@ developerIDs={
20
20
  'GP_Win_Office_New': '140626882900161', #'0x7824af430781',
21
21
  'GP_Mac_Laptop': 'V94LRP93FV', #'0xa275dd445ab0',
22
22
  'TA_Win_Office': '160983906000941', #'0xccb0da8c896e'
23
+ 'TA_Win_Office_New': '231128824801036', #??
23
24
  }
24
25
 
25
26
  import psutil,subprocess
@@ -64,12 +65,13 @@ elif currentID==developerIDs['GP_Mac_Laptop']: #gerardo mac
64
65
  '/Users/gerardo/Desktop/PaIRS_examples/PIV_data/virtual_case/',
65
66
  #'/Users/gerardo/Desktop/PaIRS_examples/PIV_data/virtual_case_2/',
66
67
  '/Users/gerardo/Desktop/PaIRS_examples/PIV_data/real_case/',
68
+ '/Users/gerardo/Desktop/PaIRS_examples/SPIV_data/real_case/img/',
67
69
  '/Users/gerardo/Desktop/PaIRS_examples/Calibration_data/pinhole/',
68
70
  '/Users/gerardo/Desktop/PaIRS_examples/Calibration_data/cylinder/'
69
71
  ]
70
72
  basefold_DEBUG_VIS='/Users/gerardo/Desktop/PaIRS_examples/PIV_data/real_case/'
71
73
  basefold_DEBUG_VIS='/Users/gerardo/Desktop/PIV_Img/img1/'
72
- elif currentID==developerIDs['TA_Win_Office']: #TA Ufficio
74
+ elif currentID in (developerIDs['TA_Win_Office'],developerIDs['TA_Win_Office_New']): #TA windows
73
75
  basefold_DEBUG='C:\desk\Attuali\PythonLibC\PIV\img'
74
76
  basefold_DEBUGOptions=[
75
77
  'C:/desk/PIV_Img/img1/',
@@ -319,7 +321,7 @@ if Flag_NATIVEDIALOGS:
319
321
  else:
320
322
  optionNativeDialog=QFileDialog.Option.DontUseNativeDialog
321
323
 
322
- def warningDialog(self:QWidget,Message,time_milliseconds=0,flagScreenCenter=False,icon:QIcon=QIcon(),palette=None,pixmap=None,title='Warning!',flagRichText=False,flagNoButtons=False,addButton:dict=None,FlagStayOnTop=False): #addButton=['Print Message',lambda: print(Message)]
324
+ def warningDialog(self:QWidget,Message,time_milliseconds=0,flagScreenCenter=False,icon:QIcon=QIcon(),palette=None,pixmap=None,title='Warning!',flagRichText=False,flagNoButtons=False,addButton:dict=None,FlagStayOnTop=False,pixmapSize=64): #addButton=['Print Message',lambda: print(Message)]
323
325
  dlg=None
324
326
  if Message:
325
327
  if isinstance(self,QMainWindow) and hasattr(self,'w_Input'):
@@ -328,6 +330,7 @@ def warningDialog(self:QWidget,Message,time_milliseconds=0,flagScreenCenter=Fals
328
330
  dlg = QMessageBox(self)
329
331
  dlg.setWindowTitle(title)
330
332
  dlg.setText(str(Message))
333
+
331
334
  if flagRichText: dlg.setTextFormat(Qt.TextFormat.RichText)
332
335
  if flagNoButtons:
333
336
  dlg.setStandardButtons(QMessageBox.StandardButton.NoButton)
@@ -361,7 +364,7 @@ def warningDialog(self:QWidget,Message,time_milliseconds=0,flagScreenCenter=Fals
361
364
  if palette:
362
365
  dlg.setPalette(palette)
363
366
  if pixmap:
364
- dlg.setIconPixmap(QPixmap(pixmap).scaled(64, 64, Qt.AspectRatioMode.KeepAspectRatio,Qt.SmoothTransformation))
367
+ dlg.setIconPixmap(QPixmap(pixmap).scaled(pixmapSize, pixmapSize, Qt.AspectRatioMode.KeepAspectRatio,Qt.SmoothTransformation))
365
368
  if self:
366
369
  dlg.setFont(self.font())
367
370
  c=dlg.findChildren(QObject)
@@ -685,10 +688,9 @@ def toPlainText(text):
685
688
  return PlainTextConverter.toPlainText()
686
689
 
687
690
  def showTip(obj,message):
688
- tip=QToolTip(obj)
689
691
  toolTipDuration=obj.toolTipDuration()
690
692
  obj.setToolTipDuration(3000)
691
- tip.showText(QCursor.pos(),message)
693
+ QToolTip.showText(QCursor.pos(),message)
692
694
  obj.setToolTipDuration(toolTipDuration)
693
695
 
694
696
  def clean_tree(tree:QTreeWidget):
@@ -1095,6 +1097,34 @@ def optimalPivCores(totCore,nImgs,penCore=1):
1095
1097
  #nPivMax=floor(totCore/nCoreMax)
1096
1098
  return nPivMax,nCoreMax
1097
1099
 
1100
+ from PySide6.QtCore import qInstallMessageHandler, QtMsgType
1101
+ def custom_qt_message_handler(mode, context, message):
1102
+ if ("QPainter" in message or "paintEngine" in message):
1103
+ return #Silenzia questi messaggi
1104
+ print(message) #Altrimenti stampali normalmente (oppure loggali)
1105
+ qInstallMessageHandler(custom_qt_message_handler)
1106
+
1107
+ """
1108
+ def custom_qt_message_handler(mode, context, message):
1109
+ if "QPainter" in message or "paintEngine" in message:
1110
+ print("\n!!! Intercepted Qt message:")
1111
+ print(message)
1112
+ print("\n*** Current Python stacktrace:")
1113
+ traceback.print_stack() # Questo stampa lo stack in cui è stato generato il messaggio
1114
+ else:
1115
+ print(message)
1116
+ qInstallMessageHandler(custom_qt_message_handler)
1117
+ import functools
1118
+ import traceback
1119
+ def log_qpainter_usage(func):
1120
+ @functools.wraps(func)
1121
+ def wrapper(*args, **kwargs):
1122
+ print(f"\n°°° Execution of {func.__name__} in {func.__module__}")
1123
+ traceback.print_stack(limit=4) # Mostra solo lo stack alto
1124
+ return func(*args, **kwargs)
1125
+ return wrapper
1126
+ """
1127
+
1098
1128
  class PaIRSApp(QApplication):
1099
1129
  def __init__(self,*args):
1100
1130
  super().__init__(*args)
@@ -1110,4 +1140,111 @@ class PaIRSApp(QApplication):
1110
1140
 
1111
1141
  def installMessageHandler(self):
1112
1142
  qInstallMessageHandler(self.message_handler)
1113
-
1143
+
1144
+ rqrdpckgs_filename=foldPaIRS+"rqrdpckgs.txt"
1145
+ from packaging.version import Version
1146
+ import importlib.metadata
1147
+
1148
+ def resetRequiredPackagesFile(filename=rqrdpckgs_filename):
1149
+ # Leggi il contenuto esistente
1150
+ try:
1151
+ with open(filename, "r") as f:
1152
+ lines = f.readlines()
1153
+ except FileNotFoundError:
1154
+ pri.Error.red(f"resetRequiredPackagesFile: File {filename} not found.")
1155
+ return
1156
+
1157
+ with open(filename, "w") as f:
1158
+ for line in lines:
1159
+ parts = line.strip().split()
1160
+ if len(parts) >= 3:
1161
+ pkg = parts[0]
1162
+ vmin = parts[1]
1163
+ vmax = parts[2]
1164
+ f.write(f"{pkg}\t{vmin}\t{vmax}\t0\n")
1165
+ else:
1166
+ pri.Error.red(f"resetRequiredPackagesFile: Skipping malformed line: {line}")
1167
+
1168
+ def checkRequiredPackages(self, filename=rqrdpckgs_filename, FlagDisplay=False, FlagForcePrint=False):
1169
+ required_packages = []
1170
+ vmin_list = []
1171
+ vmax_list = []
1172
+ vcurr_list = []
1173
+
1174
+ # Read file
1175
+ with open(filename, "r") as f:
1176
+ for line in f:
1177
+ #pri.Info.white(line)
1178
+ parts = line.strip().split()
1179
+ if len(parts) >= 4:
1180
+ required_packages.append(parts[0])
1181
+ vmin_list.append(Version(parts[1]))
1182
+ vmax_list.append(Version(parts[2]))
1183
+ vcurr_list.append(Version(parts[3]) if parts[3] != "0" else None)
1184
+ else:
1185
+ pri.Error.red(f"Malformed line: {line}")
1186
+
1187
+ Flag = False
1188
+ warnings = []
1189
+
1190
+ for i, pkg in enumerate(required_packages):
1191
+ try:
1192
+ installed_version = Version(importlib.metadata.version(pkg))
1193
+ except importlib.metadata.PackageNotFoundError:
1194
+ installed_version = None
1195
+
1196
+ # Update current installed version
1197
+ if installed_version is not None and (installed_version != vcurr_list[i] or FlagDisplay):
1198
+ vcurr_list[i] = installed_version
1199
+ Flag = True
1200
+
1201
+ # Check if within [vmin, vmax]
1202
+ if not (vmin_list[i] <= installed_version <= vmax_list[i]):
1203
+ """
1204
+ warnings.append(
1205
+ f"- {pkg}: installed = {installed_version}, target range = [{vmin_list[i]}, {vmax_list[i]}]"
1206
+ )
1207
+ """
1208
+ warnings.append(
1209
+ f"- {pkg} {installed_version} not in [{vmin_list[i]}, {vmax_list[i]}]"
1210
+ )
1211
+
1212
+ # Show warning
1213
+ if len(warnings)>0: self.FlagPackIssue=True
1214
+ if len(warnings)>0 or FlagForcePrint:
1215
+ message = (
1216
+ "Some installed packages have a version outside the target range used to develop "
1217
+ "the current release of the PaIRS_UniNa package.\n\n"
1218
+ "This may lead to compatibility issues. If you experience unexpected behavior, "
1219
+ "it is recommended to either reinstall the last tested compatible versions."
1220
+ f" If any issue occurs, please contact the authors at {__mail__}.\n\n"
1221
+ #"or use the standalone executable available at:\n"
1222
+ #"https://pairs.unina.it/#download\n\n"
1223
+ "Incompatible packages:\n"
1224
+ + "\n".join(warnings) +
1225
+ "\n\nYou may reinstall the last compatible versions using the following commands:\n\n"
1226
+ )
1227
+ for i, pkg in enumerate(required_packages):
1228
+ if vcurr_list[i] is not None and (not (vmin_list[i] <= vcurr_list[i] <= vmax_list[i]) or FlagForcePrint):
1229
+ message += (
1230
+ f"python -m pip uninstall {pkg}\n"
1231
+ f"python -m pip install {pkg}=={vmax_list[i]}\n"
1232
+ )
1233
+
1234
+ warningDialog(
1235
+ self,
1236
+ Message=message,
1237
+ flagScreenCenter=True,
1238
+ pixmap=icons_path + 'python_warning.png',
1239
+ pixmapSize=96
1240
+ )
1241
+ elif FlagDisplay:
1242
+ warningDialog(self, Message="All installed packages are within the expected version range.", flagScreenCenter=True,pixmap=icons_path+'greenv.png')
1243
+
1244
+ # Update file if needed
1245
+ if Flag:
1246
+ with open(filename, "w") as f:
1247
+ for pkg, vmin, vmax, vcurr in zip(required_packages, vmin_list, vmax_list, vcurr_list):
1248
+ f.write(f"{pkg}\t{vmin}\t{vmax}\t{vcurr if vcurr else 0}\n")
1249
+
1250
+ return required_packages, vmin_list, vmax_list, vcurr_list
@@ -726,7 +726,6 @@ class Process_Tab(gPaIRS_Tab):
726
726
  text=wedit.text()
727
727
  split_text=re.split('(\d+)', text)[1:-1:2]
728
728
  vect=[int(i) for i in split_text]
729
- tip=QToolTip(wedit)
730
729
  FlagEmpty=len(vect)==0
731
730
  if FlagEmpty: FlagError=True
732
731
  else: FlagError=not all([v>=w for v,w in zip(vect[:-1],vect[1:])])
@@ -739,21 +738,18 @@ class Process_Tab(gPaIRS_Tab):
739
738
  wlab.setToolTip(message)
740
739
  wlab.setStatusTip(message)
741
740
  """
742
- tip=QToolTip(wedit)
743
- tip.showText(QCursor.pos(),wlab.toolTip(),wedit,QRect(),3000)
741
+ QToolTip.showText(QCursor.pos(),wlab.toolTip(),wedit,QRect(),3000)
744
742
  """
745
743
  else:
746
744
  wlab.setPixmap(QPixmap())
747
- tip.hideText()
748
745
  self.PROpar.VectFlag[self.Vect_widgets.index(wedit)]=not FlagError
749
- return split_text, vect, tip, FlagError
746
+ return split_text, vect, FlagError
750
747
 
751
748
  def set_Wind_vectors(self,wedit:QLineEdit,wlab:QLabel,i):
752
- _, vect, tip, FlagError=self.edit_Wind_vectors(wedit,wlab)
753
- self.set_Wind_vectors_new(i,vect,tip,FlagError)
749
+ _, vect, FlagError=self.edit_Wind_vectors(wedit,wlab)
750
+ self.set_Wind_vectors_new(i,vect,FlagError)
754
751
 
755
- def set_Wind_vectors_new(self,i,vect,tip=QToolTip(),FlagError=False):
756
- #tip.hideText()
752
+ def set_Wind_vectors_new(self,i,vect,FlagError=False):
757
753
  if not FlagError:
758
754
  Nit_i=len(vect)
759
755
  if Nit_i>self.PROpar.Nit:
@@ -1365,10 +1361,9 @@ class Process_Tab(gPaIRS_Tab):
1365
1361
  item.setStatusTip('')
1366
1362
 
1367
1363
  message='No context menu available! Please, pause processing.'
1368
- tip=QToolTip(self)
1369
1364
  toolTipDuration=self.toolTipDuration()
1370
1365
  self.setToolTipDuration(3000)
1371
- tip.showText(QCursor.pos(),message)
1366
+ QToolTip.showText(QCursor.pos(),message)
1372
1367
  self.setToolTipDuration(toolTipDuration)
1373
1368
  item.setToolTip(toolTip)
1374
1369
  item.setStatusTip(toolTip)
@@ -8,6 +8,8 @@ spin_tips={
8
8
  'SemiWidth_Epipolar' : 'Semi-width normal to epipolar line',
9
9
  'Filter_SemiWidth' : 'Semi-width of filter',
10
10
  'Threshold' : 'Threshold for disparity computation',
11
+ 'Nit_OutDet' : 'Number of iterations for outlier detection',
12
+ 'Std_Threshold' : 'S.t.d. threshold for disparity validation',
11
13
  }
12
14
  check_tips={}
13
15
  radio_tips={}
@@ -49,6 +51,8 @@ class PROpar_Disp(TABpar):
49
51
  self.Filter_SemiWidth = 10
50
52
  self.Threshold = 0.5
51
53
 
54
+ self.Nit_OutDet = 5
55
+ self.Std_Threshold = 3.0
52
56
 
53
57
  class Process_Tab_Disp(gPaIRS_Tab):
54
58
  class Process_Tab_Signals(gPaIRS_Tab.Tab_Signals):
@@ -105,7 +109,6 @@ class Process_Tab_Disp(gPaIRS_Tab):
105
109
  if flagInit:
106
110
  self.initialize()
107
111
 
108
-
109
112
  def initialize(self):
110
113
  pri.Info.yellow(f'{"*"*20} PROCESS Disp initialization {"*"*20}')
111
114
  self.setTABpar(FlagAdjustPar=True,FlagBridge=False)
@@ -115,13 +118,15 @@ class Process_Tab_Disp(gPaIRS_Tab):
115
118
  #*************************************************** Adjusting parameters
116
119
  def adjustPROpar(self):
117
120
  minIWSize=min([self.PROpar.Vect[0],self.PROpar.Vect[2]])
121
+ self.PROpar.SemiWidth_Epipolar=min([self.PROpar.SemiWidth_Epipolar, int(minIWSize/4)])
122
+ self.PROpar.Filter_SemiWidth=min([self.PROpar.Filter_SemiWidth, int(minIWSize/4)])
118
123
  self.ui.spin_SemiWidth_Epipolar.setMaximum(int(minIWSize/4))
119
124
  self.ui.spin_Filter_SemiWidth.setMaximum(int(minIWSize/4))
120
125
  return
121
-
122
-
126
+
123
127
  #*************************************************** Layout
124
128
  def setPROlayout(self):
129
+ self.ui.w_Std_Threshold.setVisible(self.PROpar.Nit_OutDet>0)
125
130
  return
126
131
 
127
132
  #*************************************************** Windowing and Correlation