MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / DialogLoadMask

Class DialogLoadMask

pyxrf/gui_module/dlg_load_mask.py:23–415  ·  view source on GitHub ↗

Dialog box for selecting spatial ROI and mask. Typical use: default_dir = "/home/user/data" n_rows, n_columns = 15, 20 # Some values # Values that are changed by the dialog box roi = (2, 3, 11, 9) use_roi = True mask_f_path = "" use_mask = False dlg = Di

Source from the content-addressed store, hash-verified

21
22
23class DialogLoadMask(QDialog):
24 """
25 Dialog box for selecting spatial ROI and mask.
26
27 Typical use:
28
29 default_dir = "/home/user/data"
30 n_rows, n_columns = 15, 20 # Some values
31
32 # Values that are changed by the dialog box
33 roi = (2, 3, 11, 9)
34 use_roi = True
35 mask_f_path = ""
36 use_mask = False
37
38 dlg = DialogLoadMask()
39 dlg.set_image_size(n_rows=n_rows, n_columns=n_columns)
40 dlg.set_roi(row_start=roi[0], column_start=roi[1], row_end=roi[2], column_end=roi[3])
41 dlg.set_roi_active(use_roi)
42
43 dlg.set_default_directory(default_dir)
44 dlg.set_mask_file_path(mask_f_path)
45 dlg.set_mask_file_active(use_mask)
46
47 if dlg.exec() == QDialog.Accepted:
48 # If success, then read the values back. Discard changes if rejected.
49 roi = dlg.get_roi()
50 use_roi = dlg.get_roi_active()
51 mask_f_path = dlg.get_mask_file_path()
52 use_mask = dlg.get_mask_file_active()
53 """
54
55 def __init__(self):
56 super().__init__()
57
58 self._validation_enabled = False
59
60 self.resize(500, 300)
61 self.setWindowTitle("Load Mask or Select ROI")
62
63 # Initialize variables used with ROI selection group
64 self._n_rows = 0
65 self._n_columns = 0
66 self._roi_active = False
67 self._row_start = -1
68 self._column_start = -1
69 self._row_end = -1
70 self._column_end = -1
71 # ... with Mask group
72 self._mask_active = False
73 self._mask_file_path = ""
74 self._default_directory = ""
75
76 # Fields for entering spatial ROI coordinates
77 self.validator_rows = QIntValidator()
78 self.validator_rows.setBottom(1)
79 self.validator_cols = QIntValidator()
80 self.validator_cols.setBottom(1)

Callers 7

pb_apply_mask_clickedMethod · 0.85
test_DialogLoadMask_1Function · 0.85
test_DialogLoadMask_2Function · 0.85
test_DialogLoadMask_3Function · 0.85
test_DialogLoadMask_4Function · 0.85
test_DialogLoadMask_5Function · 0.85
test_DialogLoadMask_6Function · 0.85

Calls

no outgoing calls

Tested by 6

test_DialogLoadMask_1Function · 0.68
test_DialogLoadMask_2Function · 0.68
test_DialogLoadMask_3Function · 0.68
test_DialogLoadMask_4Function · 0.68
test_DialogLoadMask_5Function · 0.68
test_DialogLoadMask_6Function · 0.68