1+ """
2+ HyperCTui initialization module.
3+
4+ This module provides constants, helper functions, and configuration settings for the
5+ HyperCT UI application. It includes path definitions, UI styling properties,
6+ and class definitions to organize application structure and data.
7+ """
8+
19import os
10+ from typing import Any , Dict , Union
211
312from qtpy .uic import loadUi
413
3544SOURCE_DETECTOR_DISTANCE = 19.855 # m, at SNAP
3645DETECTOR_OFFSET = 0 # micros
3746
38- DEFAULT_EVALUATION_REGIONS = {
47+ DEFAULT_EVALUATION_REGIONS : Dict [ int , Dict [ str , Union [ str , int ]]] = {
3948 0 : {
4049 "name" : "Region 1" ,
4150 "from" : 20 ,
5665
5766# main window dimensions
5867class UiSizeSmall :
68+ """
69+ Small UI window size configuration.
70+
71+ Attributes
72+ ----------
73+ width : int
74+ Width of the UI window in pixels.
75+ height : int
76+ Height of the UI window in pixels.
77+ """
78+
5979 width = 800
6080 height = 300
6181
6282
6383class UiSizeLarge :
84+ """
85+ Large UI window size configuration.
86+
87+ Attributes
88+ ----------
89+ width : int
90+ Width of the UI window in pixels.
91+ height : int
92+ Height of the UI window in pixels.
93+ """
94+
6495 width = 800
6596 height = 800
6697
6798
6899class DataType :
100+ """
101+ Constants defining data types used in the application.
102+
103+ Attributes
104+ ----------
105+ projection : str
106+ String identifier for projection data.
107+ ob : str
108+ String identifier for open beam data.
109+ """
110+
69111 projection = "projections"
70112 ob = "ob"
71113
72114
73115class TabNames :
116+ """
117+ Names for the application tabs.
118+
119+ Attributes
120+ ----------
121+ tab0 : str
122+ Open beam setup tab label.
123+ tab1 : str
124+ Initial projections tab label.
125+ tab2 : str
126+ Crop tab label.
127+ tab3 : str
128+ Rotation center tab label.
129+ tab4 : str
130+ Autonomous reconstruction tab label.
131+ tab5 : str
132+ Settings tab label.
133+ """
134+
74135 tab0 = " - Setup the open beams"
75136 tab1 = " - Initialize first projections (0\u00b0 and 180\u00b0 )"
76137 tab2 = " - Crop"
@@ -80,11 +141,47 @@ class TabNames:
80141
81142
82143class ObTabNames :
144+ """
145+ Constants for the open beam tab indices.
146+
147+ Attributes
148+ ----------
149+ new_obs : int
150+ Index for the new open beams tab.
151+ selected_obs : int
152+ Index for the selected open beams tab.
153+ """
154+
83155 new_obs = 0
84156 selected_obs = 1
85157
86158
87159class EvaluationRegionKeys :
160+ """
161+ Keys used in evaluation region dictionaries.
162+
163+ Attributes
164+ ----------
165+ state : str
166+ Key for checkbox state.
167+ from_value : str
168+ Key for start value.
169+ to_value : str
170+ Key for end value.
171+ id : str
172+ Key for horizontal line ID.
173+ name : str
174+ Key for region name.
175+ label_id : str
176+ Key for label ID.
177+ from_index : str
178+ Key for start file index.
179+ to_index : str
180+ Key for end file index.
181+ str_from_to_value : str
182+ Key for string representation of range.
183+ """
184+
88185 state = "state of the checkbox"
89186 from_value = "from value"
90187 to_value = "to value"
@@ -96,5 +193,20 @@ class EvaluationRegionKeys:
96193 str_from_to_value = "string form of from -> to range"
97194
98195
99- def load_ui (ui_filename , baseinstance ):
196+ def load_ui (ui_filename : str , baseinstance : Any ) -> Any :
197+ """
198+ Load a Qt UI file and apply it to the specified base instance.
199+
200+ Parameters
201+ ----------
202+ ui_filename : str
203+ Path to the UI file to load.
204+ baseinstance : Any
205+ Instance to which the UI should be applied.
206+
207+ Returns
208+ -------
209+ Any
210+ The baseinstance with the UI applied.
211+ """
100212 return loadUi (ui_filename , baseinstance = baseinstance )
0 commit comments