mosamatic2 2.0.14__py3-none-any.whl → 2.0.16__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.

Potentially problematic release.


This version of mosamatic2 might be problematic. Click here for more details.

mosamatic2/core/utils.py CHANGED
@@ -363,5 +363,9 @@ def is_docker_running():
363
363
  return False
364
364
 
365
365
 
366
+ def is_path_docker_compatible(path):
367
+ return not ' ' in path
368
+
369
+
366
370
  def to_unix_path(path):
367
371
  return path.replace("\\", "/").replace(" ", "\\ ")
@@ -1 +1 @@
1
- 2.0.14
1
+ 2.0.16
@@ -16,6 +16,7 @@ from PySide6.QtCore import (
16
16
  )
17
17
 
18
18
  from mosamatic2.core.managers.logmanager import LogManager
19
+ from mosamatic2.core.utils import is_docker_running, is_path_docker_compatible
19
20
  from mosamatic2.ui.widgets.panels.pipelines.pipelinepanel import PipelinePanel
20
21
  from mosamatic2.ui.settings import Settings
21
22
  from mosamatic2.ui.utils import is_macos
@@ -127,6 +128,15 @@ class BoaDockerPipelinePanel(PipelinePanel):
127
128
  self.settings().set('last_directory', directory)
128
129
 
129
130
  def handle_run_pipeline_button(self):
131
+ if not is_docker_running():
132
+ QMessageBox.information(self, 'Error', 'Docker is not running. Please start Docker Desktop first')
133
+ return
134
+ if not is_path_docker_compatible(self.scans_dir_line_edit().text()):
135
+ QMessageBox.information(self, 'Error', 'Path to scans directory contains spaces and is not Docker compatible')
136
+ return
137
+ if not is_path_docker_compatible(self.output_dir_line_edit().text()):
138
+ QMessageBox.information(self, 'Error', 'Path to output directory contains spaces and is not Docker compatible')
139
+ return
130
140
  errors = self.check_inputs_and_parameters()
131
141
  if len(errors) > 0:
132
142
  error_message = 'Following errors were encountered:\n'
@@ -18,6 +18,7 @@ from PySide6.QtCore import (
18
18
  )
19
19
 
20
20
  from mosamatic2.core.managers.logmanager import LogManager
21
+ from mosamatic2.core.utils import is_docker_running, is_path_docker_compatible
21
22
  from mosamatic2.ui.widgets.panels.pipelines.pipelinepanel import PipelinePanel
22
23
  from mosamatic2.ui.settings import Settings
23
24
  from mosamatic2.ui.utils import is_macos
@@ -223,6 +224,18 @@ class DefaultDockerPipelinePanel(PipelinePanel):
223
224
  self.model_type_combobox().setCurrentText('pytorch')
224
225
 
225
226
  def handle_run_pipeline_button(self):
227
+ if not is_docker_running():
228
+ QMessageBox.information(self, 'Error', 'Docker is not running. Please start Docker Desktop first')
229
+ return
230
+ if not is_path_docker_compatible(self.images_dir_line_edit().text()):
231
+ QMessageBox.information(self, 'Error', 'Path to images directory contains spaces and is not Docker compatible')
232
+ return
233
+ if not is_path_docker_compatible(self.model_files_dir_line_edit().text()):
234
+ QMessageBox.information(self, 'Error', 'Path to model files directory contains spaces and is not Docker compatible')
235
+ return
236
+ if not is_path_docker_compatible(self.output_dir_line_edit().text()):
237
+ QMessageBox.information(self, 'Error', 'Path to output directory contains spaces and is not Docker compatible')
238
+ return
226
239
  errors = self.check_inputs_and_parameters()
227
240
  if len(errors) > 0:
228
241
  error_message = 'Following errors were encountered:\n'
@@ -14,6 +14,8 @@ class CustomInteractorStyle(vtk.vtkInteractorStyleImage):
14
14
  self.status_actor = status_actor
15
15
  self.slice_obj = slice_obj
16
16
  self.orientation = orientation
17
+ self._color_window = 0
18
+ self._color_level = 0
17
19
 
18
20
  xmin, xmax, ymin, ymax, zmin, zmax = image_data.GetExtent()
19
21
  if orientation == "axial":
@@ -29,6 +31,22 @@ class CustomInteractorStyle(vtk.vtkInteractorStyleImage):
29
31
  self.slice_mapper.SetSliceNumber(self.slice)
30
32
  self.update_status_message()
31
33
 
34
+ def color_window(self):
35
+ return self._color_window
36
+
37
+ def set_color_window(self, color_window):
38
+ self._color_window = color_window
39
+ self.slice_obj.GetProperty().SetColorWindow(self._color_window)
40
+ self.GetInteractor().GetRenderWindow().Render()
41
+
42
+ def color_level(self):
43
+ return self._color_level
44
+
45
+ def set_color_level(self, color_level):
46
+ self._color_level = color_level
47
+ self.slice_obj.GetProperty().SetColorLevel(self._color_level)
48
+ self.GetInteractor().GetRenderWindow().Render()
49
+
32
50
  def update_status_message(self):
33
51
  window = int(self.slice_obj.GetProperty().GetColorWindow())
34
52
  level = int(self.slice_obj.GetProperty().GetColorLevel())
@@ -11,10 +11,12 @@ IMAGE_SHIFT_SCALE = -1000
11
11
 
12
12
 
13
13
  class SliceViewer(QWidget):
14
- def __init__(self):
14
+ def __init__(self, color_window=COLOR_WINDOW, color_level=COLOR_LEVEL):
15
15
  super(SliceViewer, self).__init__()
16
16
  self._nifti_file_or_dicom_dir = None
17
17
  self._view_orientation = 'axial'
18
+ self._color_window = color_window
19
+ self._color_level = color_level
18
20
  self._vtk_widget = QVTKRenderWindowInteractor(self)
19
21
  self._render_window = self._vtk_widget.GetRenderWindow()
20
22
  self._interactor = self._render_window.GetInteractor()
@@ -27,6 +29,22 @@ class SliceViewer(QWidget):
27
29
  self._render_window.AddRenderer(self._default_renderer)
28
30
  self._render_window.Render()
29
31
 
32
+ def color_window(self):
33
+ return self._color_window
34
+
35
+ def set_color_window(self, color_window):
36
+ self._color_window = color_window
37
+ if self._interactor_style:
38
+ self._interactor_style.set_color_window(self._color_window)
39
+
40
+ def color_level(self):
41
+ return self._color_level
42
+
43
+ def set_color_level(self, color_level):
44
+ self._color_level = color_level
45
+ if self._interactor_style:
46
+ self._interactor_style.set_color_level(self._color_level)
47
+
30
48
  def nifti_file_or_dicom_dir(self):
31
49
  return self._nifti_file_or_dicom_dir
32
50
 
@@ -75,8 +93,8 @@ class SliceViewer(QWidget):
75
93
  slice_mapper.SetOrientationToZ() # axial orientation
76
94
  slice_mapper.SetSliceNumber(axial_index)
77
95
  slice = vtk.vtkImageSlice()
78
- slice.GetProperty().SetColorWindow(400)
79
- slice.GetProperty().SetColorLevel(40)
96
+ slice.GetProperty().SetColorWindow(self.color_window())
97
+ slice.GetProperty().SetColorLevel(self.color_level())
80
98
  slice.SetMapper(slice_mapper)
81
99
  slice_text_actor = self.create_text_actor("", 0.01, 0.01, 12, align_bottom=True, normalized=True)
82
100
  usage_text_actor = self.create_text_actor(
@@ -1,5 +1,7 @@
1
1
  from PySide6.QtWidgets import (
2
2
  QLineEdit,
3
+ QLabel,
4
+ QSpinBox,
3
5
  QHBoxLayout,
4
6
  QVBoxLayout,
5
7
  QFormLayout,
@@ -24,6 +26,9 @@ class SliceVisualization(Visualization):
24
26
  self._image_line_edit = None
25
27
  self._image_select_button = None
26
28
  self._image_dir_select_button = None
29
+ self._color_window_spinbox = None
30
+ self._color_level_spinbox = None
31
+ self._color_window_and_level_reset_button = None
27
32
  self._load_image_button = None
28
33
  self._slice_viewer = None
29
34
  self._form_layout = None
@@ -47,6 +52,22 @@ class SliceVisualization(Visualization):
47
52
  self._image_dir_select_button.clicked.connect(self.handle_image_dir_select_button)
48
53
  return self._image_dir_select_button
49
54
 
55
+ def color_window_spinbox(self):
56
+ if not self._color_window_spinbox:
57
+ self._color_window_spinbox = QSpinBox(self, minimum=0, maximum=1024, value=400)
58
+ return self._color_window_spinbox
59
+
60
+ def color_level_spinbox(self):
61
+ if not self._color_level_spinbox:
62
+ self._color_level_spinbox = QSpinBox(self, minimum=0, maximum=100, value=40)
63
+ return self._color_level_spinbox
64
+
65
+ def color_window_and_level_reset_button(self):
66
+ if not self._color_window_and_level_reset_button:
67
+ self._color_window_and_level_reset_button = QPushButton('Reset')
68
+ self._color_window_and_level_reset_button.clicked.connect(self.handle_color_window_and_level_reset_button)
69
+ return self._color_window_and_level_reset_button
70
+
50
71
  def load_image_button(self):
51
72
  if not self._load_image_button:
52
73
  self._load_image_button = QPushButton('Load')
@@ -55,7 +76,10 @@ class SliceVisualization(Visualization):
55
76
 
56
77
  def slice_viewer(self):
57
78
  if not self._slice_viewer:
58
- self._slice_viewer = SliceViewer()
79
+ self._slice_viewer = SliceViewer(
80
+ color_window=self.color_window_spinbox().value(),
81
+ color_level=self.color_level_spinbox().value(),
82
+ )
59
83
  return self._slice_viewer
60
84
 
61
85
  def form_layout(self):
@@ -75,7 +99,14 @@ class SliceVisualization(Visualization):
75
99
  image_layout.addWidget(self.image_line_edit())
76
100
  image_layout.addWidget(self.image_select_button())
77
101
  image_layout.addWidget(self.image_dir_select_button())
102
+ color_window_and_level_layout = QHBoxLayout()
103
+ color_window_and_level_layout.addWidget(QLabel('Color window'))
104
+ color_window_and_level_layout.addWidget(self.color_window_spinbox())
105
+ color_window_and_level_layout.addWidget(QLabel('Color level'))
106
+ color_window_and_level_layout.addWidget(self.color_level_spinbox())
107
+ color_window_and_level_layout.addWidget(self.color_window_and_level_reset_button())
78
108
  self.form_layout().addRow('NIFTI file or DICOM directory', image_layout)
109
+ self.form_layout().addRow('', color_window_and_level_layout)
79
110
  layout = QVBoxLayout()
80
111
  layout.addLayout(self.form_layout())
81
112
  layout.addWidget(self.load_image_button())
@@ -97,6 +128,10 @@ class SliceVisualization(Visualization):
97
128
  self.image_line_edit().setText(dir_path)
98
129
  self.settings().set('last_directory', dir_path)
99
130
 
131
+ def handle_color_window_and_level_reset_button(self):
132
+ self.slice_viewer().set_color_window(self.color_window_spinbox().value())
133
+ self.slice_viewer().set_color_level(self.color_level_spinbox().value())
134
+
100
135
  def handle_load_image_button(self):
101
136
  self.slice_viewer().set_nifti_file_or_dicom_dir(self.image_line_edit().text())
102
137
  # self.slice_viewer().set_view_orientation('axial')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mosamatic2
3
- Version: 2.0.14
3
+ Version: 2.0.16
4
4
  Summary:
5
5
  Author: Ralph Brecheisen
6
6
  Author-email: r.brecheisen@maastrichtuniversity.nl
@@ -57,7 +57,7 @@ mosamatic2/core/tasks/selectslicefromscanstask/selectslicefromscanstask.py,sha25
57
57
  mosamatic2/core/tasks/task.py,sha256=APPnid6dpSGkPuDqU1vm2RIMR5vkpvbP1CPHUMjympg,1691
58
58
  mosamatic2/core/tasks/totalsegmentatortask/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  mosamatic2/core/tasks/totalsegmentatortask/totalsegmentatortask.py,sha256=Yzy-V6psjhmt-idvLxBoUmbyQGnCBb0OiD0s9lXLmWk,2096
60
- mosamatic2/core/utils.py,sha256=y8ujz-sX5nMH2eqvCyzXK2AqYCVVppvJFmGi0UgFXTk,12170
60
+ mosamatic2/core/utils.py,sha256=4duREimHWkUfZIjSy16fsxF8-3ZxukfOi8eSNjAdxF8,12240
61
61
  mosamatic2/server.py,sha256=-cZ9BPsZUXoINKqwhCHN8c59mlvzzDXzTVxsYt9au70,4644
62
62
  mosamatic2/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
63
  mosamatic2/ui/mainwindow.py,sha256=DrX-6Hu4-3wJJy6rZkexYuTQ-pO_uliyEQVkYc4GuCM,15848
@@ -65,7 +65,7 @@ mosamatic2/ui/resources/icons/mosamatic2.icns,sha256=OfhC-diJTIgaNMOezxKKilGsY7m
65
65
  mosamatic2/ui/resources/icons/mosamatic2.ico,sha256=ySD3RYluHK3pgS0Eas7eKrVk_AskdLQ4qs_IT-wNhq4,12229
66
66
  mosamatic2/ui/resources/icons/spinner.gif,sha256=rvaac6GUZauHSPFSOLWr0RmLfjmtZih2Q8knQ2WP3Po,16240
67
67
  mosamatic2/ui/resources/images/body-composition.jpg,sha256=KD-BudbXwThB4lJOZZN-ad5-TZRaaZ5cKTH0Ar1TOZs,21227
68
- mosamatic2/ui/resources/VERSION,sha256=cadBjTxujszIMUSfzEbzxhs3Pql7CycMb88twqbpTEk,9
68
+ mosamatic2/ui/resources/VERSION,sha256=-cxAVNmHfDH3lZMAtwEaTEwW3lYerVGKI5FoPFpnQq0,9
69
69
  mosamatic2/ui/settings.py,sha256=YEVHYJIfNsqMO3v1pjzgh7Pih9GGoUX7S9s8S-sBNUk,2121
70
70
  mosamatic2/ui/utils.py,sha256=6bbPIrh4RJ_yhQKNZrgPbL4XeUEogjIjbk_e5c3QS5g,853
71
71
  mosamatic2/ui/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -77,8 +77,8 @@ mosamatic2/ui/widgets/panels/defaultpanel.py,sha256=Ry32Xv6ibxm6NdZ7eBOCcisWNcmn
77
77
  mosamatic2/ui/widgets/panels/logpanel.py,sha256=ogswJ6_ryb6u7JeVnOsh2Ez8KWg6jtCFZwij8s87xO4,1861
78
78
  mosamatic2/ui/widgets/panels/mainpanel.py,sha256=KqI8dA7GpLFd2unqVRTBkNxdnh6AWGpVPwQuaEg8PmI,2431
79
79
  mosamatic2/ui/widgets/panels/pipelines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
- mosamatic2/ui/widgets/panels/pipelines/boadockerpipelinepanel.py,sha256=bsyyt-42Qho6D4rpSjo9sBJBM9ISOChX-N8QWc3j2s0,7711
81
- mosamatic2/ui/widgets/panels/pipelines/defaultdockerpipelinepanel.py,sha256=smEymbmYQ1wy0lgkhjGAGhXQedIhE8wjiX2TqYF6VB8,13284
80
+ mosamatic2/ui/widgets/panels/pipelines/boadockerpipelinepanel.py,sha256=f1VKob6SRi8dO2m1HF4JXwV_EkrzYWgTdkIOILDD5y4,8406
81
+ mosamatic2/ui/widgets/panels/pipelines/defaultdockerpipelinepanel.py,sha256=VAYx8Ksb9yVaA2GngB5h-sJNfALXeQMmWqOEXQNCjKY,14215
82
82
  mosamatic2/ui/widgets/panels/pipelines/defaultpipelinepanel.py,sha256=qkfI4BnLIXqE_YvSQj4sO_FjnK0eVdIMqAZ8sktgI-8,13727
83
83
  mosamatic2/ui/widgets/panels/pipelines/pipelinepanel.py,sha256=SlkKme8Wv2Bvp2Alen98mFjv3F5eZCwJylj294gd5uU,178
84
84
  mosamatic2/ui/widgets/panels/stackedpanel.py,sha256=dK1YWuHUzxRhVb5gP0Lu9rAiW4XagjcHmGF__5Lpufk,657
@@ -94,13 +94,13 @@ mosamatic2/ui/widgets/panels/tasks/taskpanel.py,sha256=t8lIx1P8sS1Fa-aNm6eEha629
94
94
  mosamatic2/ui/widgets/panels/tasks/totalsegmentatortaskpanel.py,sha256=6jXjHSlnyaWiei5LF08cR8vnEc5-OtbMpAlqpxPQZ-0,8169
95
95
  mosamatic2/ui/widgets/panels/visualizations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
96
96
  mosamatic2/ui/widgets/panels/visualizations/slicevisualization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
97
- mosamatic2/ui/widgets/panels/visualizations/slicevisualization/custominteractorstyle.py,sha256=GaXmO5SvXwLAnrVtAGglTXgPx6mD0Q6f8gYrGN5WRO4,2644
98
- mosamatic2/ui/widgets/panels/visualizations/slicevisualization/sliceviewer.py,sha256=yMjKzV_r6oPDMtz4-bLSWqTUBv42Jl4uHV-T3H51Xuo,4613
99
- mosamatic2/ui/widgets/panels/visualizations/slicevisualization/slicevisualization.py,sha256=2cLTHsGrdMMt_dbnq0EUAFSSW7naR6B1neB7RnUOmjQ,4214
97
+ mosamatic2/ui/widgets/panels/visualizations/slicevisualization/custominteractorstyle.py,sha256=AylbJRq85Y2qpMqQi_nfUwcO-cKEhhzfMBzHx8kJ4pY,3275
98
+ mosamatic2/ui/widgets/panels/visualizations/slicevisualization/sliceviewer.py,sha256=T2BKe_k6vAQ2GFT5c-8uncddLKmkyOPCPo_FXl7G7w8,5307
99
+ mosamatic2/ui/widgets/panels/visualizations/slicevisualization/slicevisualization.py,sha256=jH5kfvF2Jb-7fkfwC6egsGDhTR9yX5-dQDDZNddvPqM,6087
100
100
  mosamatic2/ui/widgets/panels/visualizations/visualization.py,sha256=JvqTJi7cCGYK1-wrN2oURdCOBoPS2clVUyYglhkoVJg,178
101
101
  mosamatic2/ui/widgets/splashscreen.py,sha256=MS-OczOWfwwEQNQd-JWe9_Mh57css0cSQgbu973rwQo,4056
102
102
  mosamatic2/ui/worker.py,sha256=v7e3gq7MUudgpB1BJW-P7j5wurzu6-HG5m7I6WHgJp0,699
103
- mosamatic2-2.0.14.dist-info/entry_points.txt,sha256=MCUpKkgbej1clgp8EqlLQGs0BIKwGPcBPiVWLfGz9Gw,126
104
- mosamatic2-2.0.14.dist-info/METADATA,sha256=Sxzdp8j94khefNNBq1PE8DIg8QEcIHSrl6tNhvzu7hg,1534
105
- mosamatic2-2.0.14.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
106
- mosamatic2-2.0.14.dist-info/RECORD,,
103
+ mosamatic2-2.0.16.dist-info/entry_points.txt,sha256=MCUpKkgbej1clgp8EqlLQGs0BIKwGPcBPiVWLfGz9Gw,126
104
+ mosamatic2-2.0.16.dist-info/METADATA,sha256=DZje4-e8ccI8_fErMX-LIRP0rjq-_p5QQpEezDXWIm0,1534
105
+ mosamatic2-2.0.16.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
106
+ mosamatic2-2.0.16.dist-info/RECORD,,