geopro/src/data/GprVolumeRepository.hpp

58 lines
3.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef GEOPRO_DATA_GPRVOLUMEREPOSITORY_HPP
#define GEOPRO_DATA_GPRVOLUMEREPOSITORY_HPP
#include <string>
#include "core/algo/GprVolumeBuilder.hpp" // geopro::core::BuiltI16
#include "repo/I3dSceneRepository.hpp" // geopro::data::VolumeGrid
namespace geopro::data {
// 把逐线 GPR 处理后量化体(int16 BuiltI16)反量化成 app 渲染链吃的稠密 float 体
// (VolumeGrid),使真实雷达三维体可经现成 loadVolume→addVolume→buildVoxel 显示。
//
// 数据层方案 A(纯数据层,零 UI/render/controller 改动)
// io::gpr::buildLineVolumeFromGpr3dv(P1/P2 链) → core::BuiltI16(int16+Quant)
// → builtI16ToVolumeGrid(反量化) → data::VolumeGrid(float)。
// 与现 mock(Api3dRepository 反演剖面 IDW)同格式输出,故下游 addVolume 无需任何改动。
// 纯函数适配器BuiltI16(int16 量化体) → VolumeGrid(float 稠密体)。
// - 逐体素 Quant::toPhys 反量化kBlank(空值哨兵)→ NaN(下游 buildVoxel 映射为透明)。
// - origin/spacing 原样搬运vmin/vmax 用 BuiltI16 的物理值域。
// - 布局一致(i 最快、k 最慢),两体可逐体素对位拷贝。
VolumeGrid builtI16ToVolumeGrid(const geopro::core::BuiltI16& built);
// 走 P1/P2 链建逐线 GPR 体并适配成 app 的 VolumeGrid。
// lineDir/linePrefix 同 gpr3dv-smoke / build-line(如 "D:/Downloads/明星路", "明星路_001")。
// coarse(下采样因子≥1):沿测线(道/X 轴)每 coarse 道取 1省内存横向/深度保全分辨率。
// 稠密 VolumeGrid 全内存,长线需较大 coarse 控内存(默认 4 = build-line POC 档)。
// targetDy(米,>0 启用):线内【通道间插值】目标横向间距(读真实道偏移规则化,不跨线)。
// 默认 0.025(2.5cm)0=不插值(Y=原通道数)。详见 io::gpr::buildLineVolumeFromGpr3dv。
// 失败(加载失败/立方体为空)→ 抛 std::runtime_error(由 io::gpr 链抛出,原样透传)。
VolumeGrid createGprVolumeGrid(const std::string& lineDir,
const std::string& linePrefix, int coarse = 4,
double targetDy = 0.025);
// 走【规范化测线链】(io::gpr::buildLineVolumeFromNormalized) 建逐线雷达体并适配
// 成 app 的 VolumeGrid。读 {lineDir}/{linePrefix}.head + .data(轴 X=道/Y=通道/
// Z=采样)→ BuiltI16(int16+Quant) → builtI16ToVolumeGrid 反量化 → VolumeGrid。
// 与 createGprVolumeGrid(P1/P2 链)同输出格式,下游 addVolume 无需改动;区别仅是
// 上游数据源走规范化 .head/.data 而非 .iprh/.iprb。
// coarse(≥1)沿测线下采样targetDy(米,>0 启用)线内通道插值(读 .head CH_X_OFFSETS)。
// 失败(加载失败/解析失败)→ 抛 std::runtime_error(由 io::gpr 链抛出,原样透传)。
// 雷达显示增益模式(纯显示、逐道沿深度、不动原始 .data窗口随增益重取)
// Off = 原始振幅;
// Agc = dewow + 滑窗 RMS 归一:最大化显出深部弱反射(找目标),但【抹相对振幅】;
// Tpow = dewow + ×时间^幂:保幅增益(补几何扩散/衰减),【保留相对强弱】——判振幅/复核异常用。
// (审阅者点③:标深部目标前应在 Tpow 保幅下也确认,不只信 Agc。)
enum class RadarGainMode { Off, Agc, Tpow };
VolumeGrid createRadarVolumeGrid(const std::string& lineDir,
const std::string& linePrefix, int coarse = 4,
double targetDy = 0.025,
RadarGainMode gainMode = RadarGainMode::Off);
} // namespace geopro::data
#endif // GEOPRO_DATA_GPRVOLUMEREPOSITORY_HPP