Data Structures & Formats
This module contains all the strictly typed dataclasses used to configure the Flexpose engine. It handles reading and organizing JSON/YAML data into objects.
flexpose.dataformats
ConfigCalculator
dataclass
Stores calculator-specific configuration parameters.
Attributes:
| Name | Type | Description |
|---|---|---|
output_folder |
Path
|
Output folder path. |
task_weight_path |
Path
|
Path to task weight file. |
snr_mode |
Literal
|
SNR calculation mode. |
observer |
Literal
|
Observer type. |
frame_rate |
float
|
Frame rate. |
parameters_path |
str
|
Path to parameters file. |
repetitions |
int
|
Number of repetitions. |
seed |
int
|
Random seed. |
parameters |
DataFrame
|
Parameters data (initialized post-init). |
Source code in flexpose/dataformats.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
ConfigData
dataclass
Stores all configuration data for optimization and simulation.
Attributes:
| Name | Type | Description |
|---|---|---|
spectrum_data |
SpectrumData
|
Spectrum data. |
object_data |
ContrastObject
|
Contrast object data. |
iq_data |
ImageQualityData
|
Image quality data. |
dose_data |
DoseData
|
Dose data. |
wet_data |
WetData
|
WET data. |
detector_data |
DetectorData
|
Detector data. |
xray_tube_data |
XrayTubeData
|
X-ray tube data. |
general_config |
ConfigGeneral
|
General configuration. |
Source code in flexpose/dataformats.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
ConfigDataCalculator
dataclass
Stores all configuration data for calculator-based optimization and simulation.
Attributes:
| Name | Type | Description |
|---|---|---|
spectrum_data |
SpectrumData
|
Spectrum data. |
object_data |
ContrastObject
|
Contrast object data. |
iq_data |
ImageQualityData
|
Image quality data. |
dose_data |
DoseData
|
Dose data. |
wet_data |
WetData
|
WET data. |
detector_data |
DetectorData
|
Detector data. |
xray_tube_data |
XrayTubeData
|
X-ray tube data. |
general_config |
ConfigCalculator
|
Calculator configuration. |
Source code in flexpose/dataformats.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | |
ConfigGeneral
dataclass
Stores general configuration parameters for optimization.
Attributes:
| Name | Type | Description |
|---|---|---|
output_folder |
Path
|
Output folder path. |
task_weight_path |
Path
|
Path to task weight file. |
minimum_snr |
float
|
Minimum SNR value. |
snr_mode |
Literal
|
SNR calculation mode. |
observer |
Literal
|
Observer type. |
frame_rate |
float
|
Frame rate. |
maximum_kerma_rate |
float
|
Maximum kerma rate. |
repetitions |
int
|
Number of repetitions. |
seed |
int
|
Random seed. |
Source code in flexpose/dataformats.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
ContrastObject
dataclass
Stores information about the contrast object being imaged.
Attributes:
| Name | Type | Description |
|---|---|---|
object_name |
str
|
Name of the object. |
attenuation_path |
Path
|
Path to attenuation data. |
density |
float
|
Object density. |
thickness |
float
|
Object thickness. |
size_xy |
tuple[float, float]
|
Object size in x and y. |
velocity_xy |
tuple[tuple[float]]
|
Object velocity in x and y. |
sod |
float
|
Source-to-object distance. |
shape |
Literal
|
Object shape ('cylinder', 'disk', 'rectangular'). |
Source code in flexpose/dataformats.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
DetectorData
dataclass
Stores information about the detector and its properties.
Attributes:
| Name | Type | Description |
|---|---|---|
og_pixel_size |
tuple[float, float]
|
Original pixel size. |
pixel_size |
tuple[float, float]
|
Current pixel size. |
light_yield |
float
|
Optical photons per keV. |
sid |
float
|
Source-to-image distance. |
iopd |
float
|
Image object plane distance. |
e_noise |
float
|
Electronic noise. |
dqe_path |
Path
|
Path to DQE data. |
mtf_path |
Path
|
Path to MTF data. |
dqe |
DataFrame
|
DQE data (initialized post-init). |
mtf |
DataFrame
|
MTF data (initialized post-init). |
Source code in flexpose/dataformats.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
DoseData
dataclass
Stores information about dose calculations.
Attributes:
| Name | Type | Description |
|---|---|---|
dose_path |
Path
|
Path to dose data. |
dosimetry_list |
list[str]
|
List of dosimetry metrics. |
cost_function |
str
|
Cost function used for optimization. |
Source code in flexpose/dataformats.py
88 89 90 91 92 93 94 95 96 97 98 99 100 | |
FocalSpotSize
Bases: TypedDict
Dictionary to store information about the focal spot size.
Keys
label (str): Focal spot label. size_x (float): Size in x direction. size_y (float): Size in y direction. max_ma (float): Maximum mA. min_ma (float): Minimum mA.
Source code in flexpose/dataformats.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | |
ImageQualityData
dataclass
Stores information about image quality data.
Attributes:
| Name | Type | Description |
|---|---|---|
primary_path |
Path
|
Path to primary image data. |
scatter_path |
Path
|
Path to scatter image data. |
img_shape |
tuple[tuple[int]]
|
Shape of the image array. |
Source code in flexpose/dataformats.py
74 75 76 77 78 79 80 81 82 83 84 85 86 | |
SpectralGrid
dataclass
A single quantity tabulated over energy with optional per-pixel variance.
energies: (E,) float (keV) value: (E, H, W) float variance: (E, H, W) float or None units: optional string
Source code in flexpose/dataformats.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |
interp(e)
Interpolate at scalar energy e. Returns (value_e, variance_e or None), shape (H, W)
Source code in flexpose/dataformats.py
381 382 383 384 385 386 387 388 389 390 391 392 | |
interp_many(e_vec)
Vectorized interpolation returns stacks on axis 0: (vals, vars or None), shape (E_bins, H, W)
Source code in flexpose/dataformats.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |
SpectralSet
dataclass
A collection of SpectralGrids sharing a canonical energy axis. Required: N, E, SM. Optional: kerma.
Source code in flexpose/dataformats.py
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | |
SpectrumData
dataclass
Stores information about the x-ray spectrum used in optimization calculations.
Attributes:
| Name | Type | Description |
|---|---|---|
min_kv |
int
|
Minimum tube potential. |
max_kv |
int
|
Maximum tube potential. |
kv_step |
int
|
Step size for tube potential. |
filt |
str
|
Filter type. |
spectrum_folder |
Path
|
Path to spectrum data folder. |
hist_to_mas |
Path | None
|
Path to history-to-mAs calibration file. |
kv_vec |
list[int]
|
List of kV values (initialized post-init). |
df_hist_to_mas |
DataFrame
|
Calibration data (initialized post-init). |
Source code in flexpose/dataformats.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
WetData
dataclass
Stores information about Water Equivalent Thickness (WET) calculations.
Attributes:
| Name | Type | Description |
|---|---|---|
wet_path |
Path
|
Path to WET data. |
wet_type |
Literal
|
Type of WET ('primary', 'total'). |
wet_material |
str
|
Material for WET calculation. |
grid |
str
|
Grid type. |
thickness |
list[int]
|
List of thickness values. |
Source code in flexpose/dataformats.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
XrayTubeData
dataclass
Stores information about the X-ray tube and its calibration.
Attributes:
| Name | Type | Description |
|---|---|---|
tube_specs_path |
Path | None
|
Path to tube specifications file. |
calibration_path |
Path
|
Path to calibration data. |
focal_spot_sizes |
list[FocalSpotSize]
|
List of focal spot sizes. |
fov |
float
|
Field of view. |
max_exposure_time |
float
|
Maximum exposure time. |
min_exposure_time |
float
|
Minimum exposure time. |
tube_specs |
DataFrame | None
|
Tube specifications data (initialized post-init). |
Source code in flexpose/dataformats.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |