• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

paulmthompson / WhiskerToolbox / 14342212362

08 Apr 2025 07:43PM UTC coverage: 12.935% (+0.008%) from 12.927%
14342212362

push

github

paulmthompson
clang tidy fixes in data manager files

0 of 153 new or added lines in 15 files covered. (0.0%)

45 existing lines in 8 files now uncovered.

208 of 1608 relevant lines covered (12.94%)

1.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/WhiskerToolbox/DataManager/Media/HDF5_Data.cpp
1

2
#include "HDF5_Data.hpp"
3

4
#include <H5Cpp.h>
5

6
#include <algorithm>
7
#include <iostream>
8

9
void HDF5Data::doLoadMedia(std::string name) {
×
10

NEW
11
    int const frame_dim = 0;
×
NEW
12
    int const height_dim = 1;
×
NEW
13
    int const width_dim = 2;
×
14

15
    auto c_str = name.c_str();
×
16
    H5::H5File file(c_str, H5F_ACC_RDONLY);
×
17

NEW
18
    for (int i = 0; i < file.getNumObjs(); i++) {
×
19
        std::cout << file.getObjnameByIdx(i) << std::endl;
×
20
    }
21

NEW
22
    std::string const key = "Data";
×
23

NEW
24
    H5::DataSet const dataset{file.openDataSet(key)};
×
25

NEW
26
    H5::DataSpace const dataspace = dataset.getSpace();
×
NEW
27
    int const n_dims = dataspace.getSimpleExtentNdims();
×
28
    std::vector<hsize_t> dims(n_dims);
×
29
    dataspace.getSimpleExtentDims(dims.data());
×
30

31
    std::cout << "n_dims: " << dims.size() << '\n';
×
32

33
    std::cout << "shape: (";
×
34
    for (hsize_t dim: dims) {
×
35
        std::cout << dim << ", ";
×
36
    }
NEW
37
    std::cout << ")\n"
×
NEW
38
              << std::endl;
×
39

40
    _data = std::vector<uint16_t>(dims[frame_dim] * dims[height_dim] * dims[width_dim]);
×
41

NEW
42
    dataset.read(static_cast<void *>(_data.data()), H5::PredType::NATIVE_UINT16);
×
43

44
    updateWidth(dims[width_dim]);
×
45
    updateHeight(dims[height_dim]);
×
NEW
46
    _max_val = *std::max_element(std::begin(_data), std::end(_data));
×
47

48
    std::cout << "Read data" << std::endl;
×
49
    std::cout << "Maximum instensity " << _max_val << std::endl;
×
50

51
    file.close();
×
52

53
    setTotalFrameCount(dims[frame_dim]);
×
54
}
×
55

NEW
56
void HDF5Data::doLoadFrame(int frame_id) {
×
UNCOV
57
    auto start_position = frame_id * getHeight() * getWidth();
×
58
    auto frame_data = std::vector<uint8_t>(getHeight() * getWidth());
×
NEW
59
    for (int i = 0; i < frame_data.size(); i++) {
×
UNCOV
60
        auto normalized_data = static_cast<float>(_data[start_position + i]) / _max_val;
×
61
        frame_data[i] = static_cast<uint8_t>(normalized_data * 256.0f);
×
62
    }
63
    this->setRawData(frame_data);
×
64
}
×
65

66
std::string HDF5Data::GetFrameID(int frame_id) {
×
67
    return std::to_string(frame_id);
×
68
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc