feat/vtk-3d-view #7

Merged
gaozheng merged 301 commits from feat/vtk-3d-view into main 2026-06-27 18:43:52 +08:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit 379875dff0 - Show all commits

View File

@ -13,9 +13,9 @@ BScan readIprb(const std::string& path, const IprHeader& h) {
} }
const std::streamsize fileSize = f.tellg(); const std::streamsize fileSize = f.tellg();
const long traces = h.lastTrace + 1; const std::int64_t traces = static_cast<std::int64_t>(h.lastTrace) + 1;
const long count = static_cast<long>(h.samples) * traces; const std::int64_t count = static_cast<std::int64_t>(h.samples) * traces;
const std::streamsize expected = static_cast<std::streamsize>(count) * 2; const std::int64_t expected = count * 2;
if (fileSize != expected) { if (fileSize != expected) {
throw std::runtime_error("readIprb: 文件大小与 samples*traces*2 不符: " + path); throw std::runtime_error("readIprb: 文件大小与 samples*traces*2 不符: " + path);
} }
@ -23,10 +23,10 @@ BScan readIprb(const std::string& path, const IprHeader& h) {
BScan b; BScan b;
b.samples = h.samples; b.samples = h.samples;
b.traces = traces; b.traces = traces;
b.data.resize(static_cast<std::size_t>(count)); b.data.resize(static_cast<std::size_t>(h.samples) * traces);
f.seekg(0, std::ios::beg); f.seekg(0, std::ios::beg);
f.read(reinterpret_cast<char*>(b.data.data()), expected); f.read(reinterpret_cast<char*>(b.data.data()), static_cast<std::streamsize>(expected));
if (!f) { if (!f) {
throw std::runtime_error("readIprb: 读取数据失败: " + path); throw std::runtime_error("readIprb: 读取数据失败: " + path);
} }

View File

@ -12,7 +12,7 @@ namespace geopro::io::gpr {
// 一个通道一条测线的雷达 B-scan 剖面int16 存储,布局 [trace*samples + s]s 最快)。 // 一个通道一条测线的雷达 B-scan 剖面int16 存储,布局 [trace*samples + s]s 最快)。
struct BScan { struct BScan {
int samples = 0; int samples = 0;
long traces = 0; std::int64_t traces = 0;
std::vector<int16_t> data; // 大小 = samples*traces std::vector<int16_t> data; // 大小 = samples*traces
}; };