| 228 | } |
| 229 | |
| 230 | void ErrorMeasurePass::renderUI(Gui::Widgets& widget) |
| 231 | { |
| 232 | const auto getFilename = [](const std::filesystem::path& path) { return path.empty() ? "N/A" : path.filename().string(); }; |
| 233 | |
| 234 | // Create a button for loading the reference image. |
| 235 | if (widget.button("Load reference")) |
| 236 | { |
| 237 | FileDialogFilterVec filters; |
| 238 | filters.push_back({"exr", "High Dynamic Range"}); |
| 239 | filters.push_back({"pfm", "Portable Float Map"}); |
| 240 | std::filesystem::path path; |
| 241 | if (openFileDialog(filters, path)) |
| 242 | { |
| 243 | mReferenceImagePath = path; |
| 244 | if (!loadReference()) |
| 245 | msgBox("Error", fmt::format("Failed to load reference image from '{}'.", path), MsgBoxType::Ok, MsgBoxIcon::Error); |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | // Create a button for defining the measurements output file. |
| 250 | if (widget.button("Set output data file", true)) |
| 251 | { |
| 252 | FileDialogFilterVec filters; |
| 253 | filters.push_back({"csv", "CSV Files"}); |
| 254 | std::filesystem::path path; |
| 255 | if (saveFileDialog(filters, path)) |
| 256 | { |
| 257 | mMeasurementsFilePath = path; |
| 258 | if (!loadMeasurementsFile()) |
| 259 | msgBox("Error", fmt::format("Failed to save measurements to '{}'.", path), MsgBoxType::Ok, MsgBoxIcon::Error); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | // Radio buttons to select the output. |
| 264 | widget.text("Show:"); |
| 265 | if (mMeasurements.valid) |
| 266 | { |
| 267 | widget.radioButtons(sOutputSelectionButtons, reinterpret_cast<uint32_t&>(mSelectedOutputId)); |
| 268 | widget.tooltip( |
| 269 | "Press 'O' to change output mode; hold 'Shift' to reverse the cycling.\n\n" |
| 270 | "Note: Difference is computed based on current - reference value.", |
| 271 | true |
| 272 | ); |
| 273 | } |
| 274 | else |
| 275 | { |
| 276 | uint32_t dummyId = 0; |
| 277 | widget.radioButtons(sOutputSelectionButtonsSourceOnly, dummyId); |
| 278 | } |
| 279 | |
| 280 | widget.checkbox("Ignore background", mIgnoreBackground); |
| 281 | widget.tooltip( |
| 282 | "Do not include background pixels in the error measurements.\n" |
| 283 | "This option requires the optional input '" + |
| 284 | std::string(kInputChannelWorldPosition) + "' to be bound", |
| 285 | true |
| 286 | ); |
| 287 | widget.checkbox("Compute L2 error (rather than L1)", mComputeSquaredDifference); |
nothing calls this directly
no test coverage detected