PyImageLabeling 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. PyImageLabeling/__init__.py +22 -0
  2. PyImageLabeling/config.json +289 -0
  3. PyImageLabeling/controller/Controller.py +25 -0
  4. PyImageLabeling/controller/Events.py +147 -0
  5. PyImageLabeling/controller/FileEvents.py +69 -0
  6. PyImageLabeling/controller/ImageEvents.py +32 -0
  7. PyImageLabeling/controller/LabelEvents.py +219 -0
  8. PyImageLabeling/controller/LabelingEvents.py +123 -0
  9. PyImageLabeling/controller/settings/ContourFillinSetting.py +93 -0
  10. PyImageLabeling/controller/settings/CoutourFillingApplyCancel.py +37 -0
  11. PyImageLabeling/controller/settings/EraserSetting.py +73 -0
  12. PyImageLabeling/controller/settings/LabelSetting.py +91 -0
  13. PyImageLabeling/controller/settings/MagicPenSetting.py +125 -0
  14. PyImageLabeling/controller/settings/OpacitySetting.py +66 -0
  15. PyImageLabeling/controller/settings/PaintBrushSetting.py +66 -0
  16. PyImageLabeling/icons/apply.png +0 -0
  17. PyImageLabeling/icons/asterisk-green.png +0 -0
  18. PyImageLabeling/icons/asterisk-red.png +0 -0
  19. PyImageLabeling/icons/back.png +0 -0
  20. PyImageLabeling/icons/border.png +0 -0
  21. PyImageLabeling/icons/cancel.png +0 -0
  22. PyImageLabeling/icons/cleaner.png +0 -0
  23. PyImageLabeling/icons/close.png +0 -0
  24. PyImageLabeling/icons/down.png +0 -0
  25. PyImageLabeling/icons/ellipse.png +0 -0
  26. PyImageLabeling/icons/eraser.png +0 -0
  27. PyImageLabeling/icons/filling.png +0 -0
  28. PyImageLabeling/icons/logoMAIA.png +0 -0
  29. PyImageLabeling/icons/magic.png +0 -0
  30. PyImageLabeling/icons/maia.png +0 -0
  31. PyImageLabeling/icons/maia1.png +0 -0
  32. PyImageLabeling/icons/maia3.ico +0 -0
  33. PyImageLabeling/icons/maia_icon.png +0 -0
  34. PyImageLabeling/icons/move.png +0 -0
  35. PyImageLabeling/icons/opacity.png +0 -0
  36. PyImageLabeling/icons/open_image.png +0 -0
  37. PyImageLabeling/icons/open_layer.png +0 -0
  38. PyImageLabeling/icons/paint.png +0 -0
  39. PyImageLabeling/icons/plus.png +0 -0
  40. PyImageLabeling/icons/polygon.png +0 -0
  41. PyImageLabeling/icons/rectangle.png +0 -0
  42. PyImageLabeling/icons/reset.png +0 -0
  43. PyImageLabeling/icons/save.png +0 -0
  44. PyImageLabeling/icons/setting.png +0 -0
  45. PyImageLabeling/icons/transparency.png:Zone.Identifier +4 -0
  46. PyImageLabeling/icons/up.png +0 -0
  47. PyImageLabeling/icons/visibility.png +0 -0
  48. PyImageLabeling/icons/zoom_minus.png +0 -0
  49. PyImageLabeling/icons/zoom_plus.png +0 -0
  50. PyImageLabeling/model/Core.py +795 -0
  51. PyImageLabeling/model/File/Files.py +166 -0
  52. PyImageLabeling/model/File/NextImage.py +36 -0
  53. PyImageLabeling/model/File/PreviousImage.py +19 -0
  54. PyImageLabeling/model/Image/MoveImage.py +32 -0
  55. PyImageLabeling/model/Image/ResetMoveZoomImage.py +16 -0
  56. PyImageLabeling/model/Image/ZoomMinus.py +25 -0
  57. PyImageLabeling/model/Image/ZoomPlus.py +16 -0
  58. PyImageLabeling/model/Labeling/ClearAll.py +22 -0
  59. PyImageLabeling/model/Labeling/ContourFilling.py +135 -0
  60. PyImageLabeling/model/Labeling/Ellipse.py +350 -0
  61. PyImageLabeling/model/Labeling/Eraser.py +131 -0
  62. PyImageLabeling/model/Labeling/MagicPen.py +131 -0
  63. PyImageLabeling/model/Labeling/PaintBrush.py +207 -0
  64. PyImageLabeling/model/Labeling/Polygon.py +279 -0
  65. PyImageLabeling/model/Labeling/Rectangle.py +248 -0
  66. PyImageLabeling/model/Labeling/Undo.py +12 -0
  67. PyImageLabeling/model/Model.py +40 -0
  68. PyImageLabeling/model/Utils.py +40 -0
  69. PyImageLabeling/old_version/label_rectangle_properties.json +6 -0
  70. PyImageLabeling/old_version/main.py +2073 -0
  71. PyImageLabeling/old_version/models/EraseSettingsDialog.py +51 -0
  72. PyImageLabeling/old_version/models/LabeledRectangle.py +80 -0
  73. PyImageLabeling/old_version/models/MagicSettingsDialog.py +119 -0
  74. PyImageLabeling/old_version/models/OverlayOpacityDialog.py +63 -0
  75. PyImageLabeling/old_version/models/PaintSettingsDialog.py +289 -0
  76. PyImageLabeling/old_version/models/PointItem.py +66 -0
  77. PyImageLabeling/old_version/models/ProcessWorker.py +52 -0
  78. PyImageLabeling/old_version/models/ZoomableGraphicsView.py +1214 -0
  79. PyImageLabeling/old_version/models/tools/ContourTool.py +279 -0
  80. PyImageLabeling/old_version/models/tools/EraserTool.py +290 -0
  81. PyImageLabeling/old_version/models/tools/MagicPenTool.py +199 -0
  82. PyImageLabeling/old_version/models/tools/OverlayTool.py +179 -0
  83. PyImageLabeling/old_version/models/tools/PaintTool.py +68 -0
  84. PyImageLabeling/old_version/models/tools/PolygonTool.py +786 -0
  85. PyImageLabeling/old_version/models/tools/RectangleTool.py +1036 -0
  86. PyImageLabeling/parameters.json +1 -0
  87. PyImageLabeling/style.css +611 -0
  88. PyImageLabeling/view/Builder.py +333 -0
  89. PyImageLabeling/view/QBackgroundItem.py +30 -0
  90. PyImageLabeling/view/QWidgets.py +10 -0
  91. PyImageLabeling/view/View.py +226 -0
  92. PyImageLabeling/view/ZoomableGraphicsView.py +91 -0
  93. PyImageLabeling/view/__init__.py +0 -0
  94. pyimagelabeling-1.0.0.dist-info/METADATA +55 -0
  95. pyimagelabeling-1.0.0.dist-info/RECORD +99 -0
  96. pyimagelabeling-1.0.0.dist-info/WHEEL +5 -0
  97. pyimagelabeling-1.0.0.dist-info/licenses/LICENCE +22 -0
  98. pyimagelabeling-1.0.0.dist-info/top_level.txt +2 -0
  99. pypi/publish_pypi.py +18 -0
@@ -0,0 +1,125 @@
1
+ from PyQt6.QtWidgets import QDialog, QSlider, QFormLayout, QDialogButtonBox, QSpinBox, QLabel, QHBoxLayout, QVBoxLayout, QComboBox
2
+ from PyQt6.QtCore import Qt
3
+
4
+ from PyImageLabeling.model.Utils import Utils
5
+
6
+ class MagicPenSetting(QDialog):
7
+ def __init__(self, parent):
8
+ super().__init__(parent)
9
+ self.setWindowTitle("Magic Pen Settings")
10
+ self.resize(500, 500)
11
+
12
+ self.tolerance = Utils.load_parameters()["magic_pen"]["tolerance"]
13
+ self.max_pixels = Utils.load_parameters()["magic_pen"]["max_pixels"]
14
+ self.method = Utils.load_parameters()["magic_pen"]["method"]
15
+
16
+ layout = QVBoxLayout()
17
+
18
+
19
+ #########################################################################################################
20
+
21
+ form_layout = QHBoxLayout()
22
+ tolerance_label = QLabel("Tolerance (percentage):")
23
+ layout.addWidget(tolerance_label)
24
+ layout.setSpacing(10)
25
+ # Tolerance slider and spinbox
26
+ self.tolerance_slider = QSlider(Qt.Orientation.Horizontal)
27
+ self.tolerance_slider.setRange(0, 100)
28
+ self.tolerance_slider.setValue(self.tolerance)
29
+ self.tolerance_slider.setTickPosition(QSlider.TickPosition.TicksBelow)
30
+ self.tolerance_slider.setTickInterval(10)
31
+
32
+ self.tolerance_spinbox = QSpinBox()
33
+ self.tolerance_spinbox.setRange(0, 100)
34
+ self.tolerance_spinbox.setValue(self.tolerance)
35
+
36
+ # Connect both ways to keep them synchronized
37
+ self.tolerance_spinbox.valueChanged.connect(self.tolerance_slider.setValue)
38
+ self.tolerance_slider.valueChanged.connect(self.tolerance_spinbox.setValue)
39
+
40
+ # Update internal values when sliders change
41
+ self.tolerance_slider.valueChanged.connect(self.update_tolerance)
42
+ self.tolerance_spinbox.valueChanged.connect(self.update_tolerance)
43
+
44
+ form_layout.addWidget(self.tolerance_slider)
45
+ form_layout.addWidget(self.tolerance_spinbox)
46
+
47
+ layout.addLayout(form_layout)
48
+
49
+ #########################################################################################################
50
+
51
+ # Points limit setting
52
+ points_limit_label = QLabel("Maximum number of pixels (integer):")
53
+ layout.addWidget(points_limit_label)
54
+
55
+ points_slider_layout = QHBoxLayout()
56
+ self.points_limit_slider = QSlider(Qt.Orientation.Horizontal)
57
+ self.points_limit_slider.setRange(5000, 500000)
58
+ self.points_limit_slider.setTickInterval(50000)
59
+ self.points_limit_slider.setValue(self.max_pixels)
60
+
61
+ self.points_limit_spinbox = QSpinBox()
62
+ self.points_limit_spinbox.setRange(5000, 500000)
63
+ self.points_limit_spinbox.setValue(self.max_pixels)
64
+ self.points_limit_spinbox.setSingleStep(5000)
65
+
66
+ # Connect both ways to keep them synchronized
67
+ self.points_limit_slider.valueChanged.connect(self.points_limit_spinbox.setValue)
68
+ self.points_limit_spinbox.valueChanged.connect(self.points_limit_slider.setValue)
69
+
70
+ # Update internal values when sliders change
71
+ self.points_limit_slider.valueChanged.connect(self.update_max_pixels)
72
+ self.points_limit_spinbox.valueChanged.connect(self.update_max_pixels)
73
+
74
+ points_slider_layout.addWidget(self.points_limit_slider)
75
+ points_slider_layout.addWidget(self.points_limit_spinbox)
76
+
77
+ layout.addLayout(points_slider_layout)
78
+
79
+ #########################################################################################################
80
+
81
+ method_label = QLabel("Method:")
82
+ layout.addWidget(method_label)
83
+
84
+ self.method_combobox = QComboBox()
85
+ self.method_combobox.addItem('RGB')
86
+ self.method_combobox.addItem('HSV')
87
+
88
+ self.method_combobox.setCurrentText(self.method)
89
+ self.method_combobox.currentTextChanged.connect(self.update_method)
90
+
91
+ layout.addWidget(self.method_combobox)
92
+
93
+
94
+ #########################################################################################################
95
+ method_label = QLabel(None)
96
+ layout.addWidget(method_label)
97
+
98
+ # Buttons
99
+ self.buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
100
+ self.buttons.accepted.connect(self.accept)
101
+ self.buttons.rejected.connect(self.reject)
102
+ layout.addWidget(self.buttons)
103
+
104
+ self.setLayout(layout)
105
+
106
+ def update_tolerance(self, value):
107
+ """Update internal tolerance value when slider changes"""
108
+ self.tolerance = value
109
+
110
+ def update_max_pixels(self, value):
111
+ """Update internal max points value when slider changes"""
112
+ self.max_pixels = value
113
+
114
+ def update_method(self, value):
115
+ """Update method when the combobox changes"""
116
+ self.method = value
117
+
118
+ def accept(self):
119
+ """Override accept to ensure settings are updated before closing"""
120
+ # Update internal values one final time
121
+ self.tolerance, self.max_pixels, self.method = self.tolerance_slider.value(), self.points_limit_slider.value(), self.method_combobox.currentText()
122
+ data = Utils.load_parameters()
123
+ data["magic_pen"]["tolerance"], data["magic_pen"]["max_pixels"], data["magic_pen"]["method"] = self.tolerance, self.max_pixels, self.method
124
+ Utils.save_parameters(data)
125
+ return super().accept()
@@ -0,0 +1,66 @@
1
+ from PyQt6.QtWidgets import QDialog, QSlider, QFormLayout, QDialogButtonBox, QSpinBox, QLabel, QHBoxLayout, QVBoxLayout
2
+ from PyQt6.QtCore import Qt
3
+
4
+ from PyImageLabeling.model.Utils import Utils
5
+
6
+ class OpacitySetting(QDialog):
7
+ def __init__(self, zoomable_graphic_view):
8
+ super().__init__(zoomable_graphic_view)
9
+ self.setWindowTitle("Opacity Settings")
10
+ self.resize(500, 100)
11
+ self.min_opacity = 10
12
+ self.max_opacity = 100
13
+
14
+ self.opacity = Utils.load_parameters()["labeling_opacity"]
15
+ if not (self.min_opacity <= self.opacity <= self.max_opacity):
16
+ self.opacity = 50
17
+
18
+ layout = QVBoxLayout()
19
+ label = QLabel("Percentage (between 10 and 100):")
20
+ layout.addWidget(label)
21
+
22
+ slider_layout = QHBoxLayout()
23
+
24
+ # Tolerance slider and spinbox
25
+ self.opacity_slider = QSlider(Qt.Orientation.Horizontal)
26
+ self.opacity_slider.setRange(self.min_opacity, self.max_opacity)
27
+ self.opacity_slider.setValue(self.opacity)
28
+ self.opacity_slider.setTickPosition(QSlider.TickPosition.TicksBelow)
29
+ self.opacity_slider.setTickInterval(10)
30
+
31
+ self.opacity_spinbox = QSpinBox()
32
+ self.opacity_spinbox.setRange(self.min_opacity, self.max_opacity)
33
+ self.opacity_spinbox.setValue(self.opacity)
34
+
35
+ # Connect both ways to keep them synchronized
36
+ self.opacity_spinbox.valueChanged.connect(self.opacity_slider.setValue)
37
+ self.opacity_slider.valueChanged.connect(self.opacity_spinbox.setValue)
38
+
39
+ # Update internal values when sliders change
40
+ self.opacity_slider.valueChanged.connect(self.update_opacity)
41
+ self.opacity_spinbox.valueChanged.connect(self.update_opacity)
42
+
43
+ slider_layout.addWidget(self.opacity_slider)
44
+ slider_layout.addWidget(self.opacity_spinbox)
45
+ layout.addLayout(slider_layout)
46
+
47
+ # Buttons
48
+ self.buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
49
+ self.buttons.accepted.connect(self.accept)
50
+ self.buttons.rejected.connect(self.reject)
51
+ layout.addWidget(self.buttons)
52
+
53
+ self.setLayout(layout)
54
+
55
+ def update_opacity(self, value):
56
+ """Update internal tolerance value when slider changes"""
57
+ self.opacity = value
58
+
59
+ def accept(self):
60
+ """Override accept to ensure settings are updated before closing"""
61
+ # Update internal values one final time
62
+ self.opacity = self.opacity_slider.value()
63
+ data = Utils.load_parameters()
64
+ data["labeling_opacity"] = self.opacity
65
+ Utils.save_parameters(data)
66
+ return super().accept()
@@ -0,0 +1,66 @@
1
+ from PyQt6.QtWidgets import QDialog, QSlider, QFormLayout, QDialogButtonBox, QSpinBox, QLabel, QHBoxLayout, QVBoxLayout
2
+ from PyQt6.QtCore import Qt
3
+
4
+ from PyImageLabeling.model.Utils import Utils
5
+
6
+ class PaintBrushSetting(QDialog):
7
+ def __init__(self, zoomable_graphic_view, model):
8
+ super().__init__(zoomable_graphic_view)
9
+ self.setWindowTitle("Paint brush Settings")
10
+ self.resize(500, 100)
11
+
12
+ self.size_paint_brush = Utils.load_parameters()["paint_brush"]["size"]
13
+ self.max_size = min(model.image_qrect.width(), model.image_qrect.height())
14
+ self.min_size = 1
15
+ if not (self.min_size <= self.size_paint_brush <= self.max_size):
16
+ self.size_paint_brush = 5
17
+
18
+ layout = QVBoxLayout()
19
+ label = QLabel("Size of the brush in pixel:")
20
+ layout.addWidget(label)
21
+
22
+ slider_layout = QHBoxLayout()
23
+
24
+ # Tolerance slider and spinbox
25
+ self.size_paint_brush_slider = QSlider(Qt.Orientation.Horizontal)
26
+ self.size_paint_brush_slider.setRange(self.min_size, self.max_size)
27
+ self.size_paint_brush_slider.setValue(self.size_paint_brush)
28
+ self.size_paint_brush_slider.setTickPosition(QSlider.TickPosition.TicksBelow)
29
+ self.size_paint_brush_slider.setTickInterval(10)
30
+
31
+ self.size_paint_brush_spinbox = QSpinBox()
32
+ self.size_paint_brush_spinbox.setRange(self.min_size, self.max_size)
33
+ self.size_paint_brush_spinbox.setValue(self.size_paint_brush)
34
+
35
+ # Connect both ways to keep them synchronized
36
+ self.size_paint_brush_spinbox.valueChanged.connect(self.size_paint_brush_slider.setValue)
37
+ self.size_paint_brush_slider.valueChanged.connect(self.size_paint_brush_spinbox.setValue)
38
+
39
+ # Update internal values when sliders change
40
+ self.size_paint_brush_slider.valueChanged.connect(self.update_size_paint_brush)
41
+ self.size_paint_brush_spinbox.valueChanged.connect(self.update_size_paint_brush)
42
+
43
+ slider_layout.addWidget(self.size_paint_brush_slider)
44
+ slider_layout.addWidget(self.size_paint_brush_spinbox)
45
+ layout.addLayout(slider_layout)
46
+
47
+ # Buttons
48
+ self.buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
49
+ self.buttons.accepted.connect(self.accept)
50
+ self.buttons.rejected.connect(self.reject)
51
+ layout.addWidget(self.buttons)
52
+
53
+ self.setLayout(layout)
54
+
55
+ def update_size_paint_brush(self, value):
56
+ """Update internal tolerance value when slider changes"""
57
+ self.size_paint_brush = value
58
+
59
+ def accept(self):
60
+ """Override accept to ensure settings are updated before closing"""
61
+ # Update internal values one final time
62
+ self.size_paint_brush = self.size_paint_brush_slider.value()
63
+ data = Utils.load_parameters()
64
+ data["paint_brush"]["size"] = self.size_paint_brush
65
+ Utils.save_parameters(data)
66
+ return super().accept()
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,4 @@
1
+ [ZoneTransfer]
2
+ ZoneId=3
3
+ ReferrerUrl=https://www.flaticon.com/search?word=opacity
4
+ HostUrl=about:internet
Binary file
Binary file
Binary file
Binary file