Skip to content

Commit

Permalink
Apply second batch of clang-tidy suggestions
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
dchristiaens and github-actions[bot] authored Sep 18, 2024
1 parent e7e0f61 commit cc51416
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cmd/dwirecon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ void run() {
y.setZero();
ssize_t j = 0;
for (auto lv = Loop("loading image data", {0, 1, 2, 3})(dwisub); lv; lv++, j++) {
float const w = Wsub(size_t(dwisub.index(2)), size_t(dwisub.index(3))) * Wvox[j];
float const w = Wsub(dwisub.index(2), dwisub.index(3)) * Wvox[j];
y[j] = std::sqrt(w) * dwisub.value();
}

Expand Down Expand Up @@ -361,7 +361,7 @@ void run() {
}

// Output source prediction
bool complete = !get_options("complete").empty();
bool const complete = !get_options("complete").empty();
opt = get_options("spred");
if (!opt.empty()) {
srchdr.size(3) = (complete) ? dwi.size(3) : dwisub.size(3);
Expand Down
19 changes: 10 additions & 9 deletions cmd/dwisliceoutliergmm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ class RMSErrorFunctor {
}

void operator()(Image<value_type> &data, Image<value_type> &pred) {
size_t v = data.get_index(3);
size_t z = data.get_index(2);
ssize_t const v = data.get_index(3);
ssize_t const z = data.get_index(2);
// Get transformation for masking. Note that the MB-factor of the motion table and the OR settings can be different.
size_t ne_mot = motion.rows() / nv;
transform_type T{DWI::SVR::se3exp(motion.row(v * ne_mot + z % ne_mot)).cast<double>()};
ssize_t const ne_mot = motion.rows() / nv;
transform_type const T{DWI::SVR::se3exp(motion.row(v * ne_mot + z % ne_mot)).cast<double>()};
// Calculate slice error
value_type e = 0.0;
int n = 0;
Expand All @@ -92,7 +92,7 @@ class RMSErrorFunctor {
if (!mask.value())
continue;
}
value_type d = data.value() - pred.value();
value_type const d = data.value() - pred.value();
e += d * d;
n++;
}
Expand All @@ -105,16 +105,16 @@ class RMSErrorFunctor {
Emb.setZero();
Eigen::MatrixXi Nmb(ne, nv);
Nmb.setZero();
for (size_t b = 0; b < nz / ne; b++) {
for (ssize_t b = 0; b < nz / ne; b++) {
Emb += E->block(b * ne, 0, ne, nv);
Nmb += N->block(b * ne, 0, ne, nv);
}
Eigen::MatrixXf R = (Nmb.array() > 0).select(Emb.cwiseQuotient(Nmb.cast<float>()), Eigen::MatrixXf::Zero(ne, nv));
Eigen::MatrixXf const R = (Nmb.array() > 0).select(Emb.cwiseQuotient(Nmb.cast<float>()), Eigen::MatrixXf::Zero(ne, nv));
return R.cwiseSqrt();
}

private:
const size_t nv, nz, ne;
const ssize_t nv, nz, ne;
const Transform T0;
Interp::Nearest<Image<bool>> mask;
const Eigen::MatrixXf motion;
Expand All @@ -140,7 +140,8 @@ template <typename T> class GMModel {
void fit(const VecType &x) {
// initialise
init(x);
float_t ll, ll0 = -std::numeric_limits<float_t>::infinity();
float_t ll;
float_t ll0 = -std::numeric_limits<float_t>::infinity();
// Expectation-Maximization
for (int n = 0; n < niter; n++) {
ll = e_step(x);
Expand Down

0 comments on commit cc51416

Please sign in to comment.