conversion warnings

This commit is contained in:
Erik Fröjdh
2024-11-18 18:18:55 +01:00
parent 3af8182998
commit 9f7cdbcb48
12 changed files with 57 additions and 44 deletions

View File

@ -47,6 +47,7 @@ class ClusterFile {
public:
ClusterFile(const std::filesystem::path &fname, size_t chunk_size = 1000);
~ClusterFile();
std::vector<Cluster> read_clusters(size_t n_clusters);
std::vector<Cluster> read_frame(int32_t &out_fnum);
std::vector<Cluster>
@ -59,6 +60,7 @@ class ClusterFile {
double *eta3y);
size_t chunk_size() const { return m_chunk_size; }
void close();
};

View File

@ -61,14 +61,14 @@ class ScanParameters {
struct ROI{
size_t xmin{};
size_t xmax{};
size_t ymin{};
size_t ymax{};
int64_t xmin{};
int64_t xmax{};
int64_t ymin{};
int64_t ymax{};
size_t height() const { return ymax - ymin; }
size_t width() const { return xmax - xmin; }
}__attribute__((packed));
int64_t height() const { return ymax - ymin; }
int64_t width() const { return xmax - xmin; }
};
/**
@ -91,7 +91,7 @@ class RawMasterFile {
xy m_geometry;
size_t m_max_frames_per_file{};
uint32_t m_adc_mask{};
// uint32_t m_adc_mask{}; // TODO! implement reading
FrameDiscardPolicy m_frame_discard_policy{};
size_t m_frame_padding{};

View File

@ -16,6 +16,7 @@ namespace aare {
class RawSubFile {
protected:
std::ifstream m_file;
DetectorType m_detector_type;
size_t m_bitdepth;
std::filesystem::path m_fname;
size_t m_rows{};
@ -25,7 +26,7 @@ class RawSubFile {
uint32_t m_pos_row{};
uint32_t m_pos_col{};
DetectorType m_detector_type;
std::optional<NDArray<ssize_t, 2>> m_pixel_map;
public:

View File

@ -226,7 +226,7 @@ template <typename T> void VarClusterFinder<T>::single_pass(NDView<T, 2> img) {
template <typename T> void VarClusterFinder<T>::first_pass() {
for (int i = 0; i < original_.size(); ++i) {
for (size_t i = 0; i < original_.size(); ++i) {
if (use_noise_map)
threshold_ = 5 * noiseMap(i);
binary_(i) = (original_(i) > threshold_);
@ -250,17 +250,17 @@ template <typename T> void VarClusterFinder<T>::first_pass() {
template <typename T> void VarClusterFinder<T>::second_pass() {
for (int64_t i = 0; i != labeled_.size(); ++i) {
auto current_label = labeled_(i);
if (current_label != 0) {
auto it = child.find(current_label);
for (size_t i = 0; i != labeled_.size(); ++i) {
auto cl = labeled_(i);
if (cl != 0) {
auto it = child.find(cl);
while (it != child.end()) {
current_label = it->second;
it = child.find(current_label);
cl = it->second;
it = child.find(cl);
// do this once before doing the second pass?
// all values point to the final one...
}
labeled_(i) = current_label;
labeled_(i) = cl;
}
}
}
@ -271,7 +271,7 @@ template <typename T> void VarClusterFinder<T>::store_clusters() {
// Do we always have monotonic increasing
// labels? Then vector?
// here the translation is label -> Hit
std::unordered_map<int, Hit> h_size;
std::unordered_map<int, Hit> h_map;
for (int i = 0; i < shape_[0]; ++i) {
for (int j = 0; j < shape_[1]; ++j) {
if (labeled_(i, j) != 0 || false
@ -280,7 +280,7 @@ template <typename T> void VarClusterFinder<T>::store_clusters() {
// (i+1 < shape_[0] and labeled_(i+1, j) != 0) or
// (j+1 < shape_[1] and labeled_(i, j+1) != 0)
) {
Hit &record = h_size[labeled_(i, j)];
Hit &record = h_map[labeled_(i, j)];
if (record.size < MAX_CLUSTER_SIZE) {
record.rows[record.size] = i;
record.cols[record.size] = j;
@ -300,7 +300,7 @@ template <typename T> void VarClusterFinder<T>::store_clusters() {
}
}
for (const auto &h : h_size)
for (const auto &h : h_map)
hits.push_back(h.second);
}

View File

@ -93,7 +93,7 @@ class DynamicCluster {
(sizeof(T) == dt.bytes())
? 0
: throw std::invalid_argument("[ERROR] Type size mismatch");
return memcpy(m_data + idx * dt.bytes(), &val, (size_t)dt.bytes());
return memcpy(m_data + idx * dt.bytes(), &val, dt.bytes());
}
template <typename T> std::string to_string() const {