-
Notifications
You must be signed in to change notification settings - Fork 198
FIx compilation on Windows with GCC16 #3386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,7 +245,7 @@ class iFOD2 : public MethodBase { | |
| max_truncation = val / max_val; | ||
| } | ||
|
|
||
| if (uniform(rng) < val / max_val) { | ||
| if (uniform(rng()) < val / max_val) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "MR::DWI::Tractography::rng" is directly included [misc-include-cleaner] cpp/core/dwi/tractography/algorithms/iFOD2.h:25: - #include "dwi/tractography/tracking/method.h"
+ #include "dwi/tractography/rng.h"
+ #include "dwi/tractography/tracking/method.h" |
||
| mean_sample_num += n; | ||
| half_log_prob0 = last_half_log_probN; | ||
| pos = positions[0]; | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -68,7 +68,7 @@ class NullDist1 : public MethodBase { | |||||
| return std::nullopt; | ||||||
| } | ||||||
|
|
||||||
| float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng); } | ||||||
| float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng()); } | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: all parameters should be named in a function [readability-named-parameter]
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "MR::DWI::Tractography::rng" is directly included [misc-include-cleaner] cpp/core/dwi/tractography/algorithms/nulldist.h:22: - #include "dwi/tractography/tracking/method.h"
+ #include "dwi/tractography/rng.h"
+ #include "dwi/tractography/tracking/method.h" |
||||||
|
|
||||||
| protected: | ||||||
| const Shared &S; | ||||||
|
|
@@ -129,7 +129,7 @@ class NullDist2 : public iFOD2 { | |||||
| iFOD2::truncate_track(tck, length_to_revert_from, revert_step); | ||||||
| } | ||||||
|
|
||||||
| float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng); } | ||||||
| float get_metric(const Eigen::Vector3f &, const Eigen::Vector3f &) override { return uniform(rng()); } | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: all parameters should be named in a function [readability-named-parameter]
Suggested change
|
||||||
|
|
||||||
| protected: | ||||||
| const Shared &S; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -89,7 +89,7 @@ class Tensor_Prob : public Tensor_Det { | |||||
|
|
||||||
| for (ssize_t i = 0; i < residuals.size(); ++i) { | ||||||
| residuals[i] = residuals[i] ? (data[i] - std::exp(-residuals[i])) : float(0.0); | ||||||
| data[i] += uniform_int(rng) ? residuals[i] : -residuals[i]; | ||||||
| data[i] += uniform_int(rng()) ? residuals[i] : -residuals[i]; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic] data[i] += uniform_int(rng()) ? residuals[i] : -residuals[i];
^There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: implicit conversion 'result_type' (aka 'int') -> 'bool' [readability-implicit-bool-conversion]
Suggested change
|
||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,9 @@ | |
|
|
||
| namespace MR::DWI::Tractography { | ||
|
|
||
| thread_local Math::RNG rng; | ||
|
|
||
| Math::RNG &rng() { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "MR::Math::RNG" is directly included [misc-include-cleaner] cpp/core/dwi/tractography/rng.cpp:17: + #include "math/rng.h" |
||
| static thread_local Math::RNG instance; | ||
| return instance; | ||
| } | ||
|
|
||
| } // namespace MR::DWI::Tractography | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -34,7 +34,7 @@ Sphere::Sphere(std::string_view in) // | |||||||||||||
| bool Sphere::get_seed(Eigen::Vector3f &p) const { | ||||||||||||||
| std::uniform_real_distribution<float> uniform; | ||||||||||||||
| do { | ||||||||||||||
| p = {2.0F * uniform(rng) - 1.0F, 2.0F * uniform(rng) - 1.0F, 2.0F * uniform(rng) - 1.0F}; | ||||||||||||||
| p = {2.0F * uniform(rng()) - 1.0F, 2.0F * uniform(rng()) - 1.0F, 2.0F * uniform(rng()) - 1.0F}; | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: '*' has higher precedence than '-'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: '*' has higher precedence than '-'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: '*' has higher precedence than '-'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
Suggested change
|
||||||||||||||
| } while (p.squaredNorm() > 1.0F); | ||||||||||||||
| p = pos + rad * p; | ||||||||||||||
| return true; | ||||||||||||||
|
|
@@ -50,14 +50,14 @@ SeedMask::SeedMask(const std::filesystem::path &in) | |||||||||||||
| bool SeedMask::get_seed(Eigen::Vector3f &p) const { | ||||||||||||||
| auto seed = mask; | ||||||||||||||
| do { | ||||||||||||||
| seed.index(0) = std::uniform_int_distribution<int>(0, mask.size(0) - 1)(rng); | ||||||||||||||
| seed.index(1) = std::uniform_int_distribution<int>(0, mask.size(1) - 1)(rng); | ||||||||||||||
| seed.index(2) = std::uniform_int_distribution<int>(0, mask.size(2) - 1)(rng); | ||||||||||||||
| seed.index(0) = std::uniform_int_distribution<int>(0, mask.size(0) - 1)(rng()); | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: narrowing conversion from 'ssize_t' (aka 'long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions] seed.index(0) = std::uniform_int_distribution<int>(0, mask.size(0) - 1)(rng());
^There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "std::uniform_int_distribution" is directly included [misc-include-cleaner] seed.index(0) = std::uniform_int_distribution<int>(0, mask.size(0) - 1)(rng());
^ |
||||||||||||||
| seed.index(1) = std::uniform_int_distribution<int>(0, mask.size(1) - 1)(rng()); | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: narrowing conversion from 'ssize_t' (aka 'long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions] seed.index(1) = std::uniform_int_distribution<int>(0, mask.size(1) - 1)(rng());
^ |
||||||||||||||
| seed.index(2) = std::uniform_int_distribution<int>(0, mask.size(2) - 1)(rng()); | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: narrowing conversion from 'ssize_t' (aka 'long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions] seed.index(2) = std::uniform_int_distribution<int>(0, mask.size(2) - 1)(rng());
^ |
||||||||||||||
| } while (!seed.value()); | ||||||||||||||
| std::uniform_real_distribution<float> uniform; | ||||||||||||||
| p = {static_cast<float>(seed.index(0)) + uniform(rng) - 0.5F, | ||||||||||||||
| static_cast<float>(seed.index(1)) + uniform(rng) - 0.5F, | ||||||||||||||
| static_cast<float>(seed.index(2)) + uniform(rng) - 0.5F}; | ||||||||||||||
| p = {static_cast<float>(seed.index(0)) + uniform(rng()) - 0.5F, | ||||||||||||||
| static_cast<float>(seed.index(1)) + uniform(rng()) - 0.5F, | ||||||||||||||
| static_cast<float>(seed.index(2)) + uniform(rng()) - 0.5F}; | ||||||||||||||
| p = (*mask.voxel2scanner) * p; | ||||||||||||||
| return true; | ||||||||||||||
| } | ||||||||||||||
|
|
@@ -101,9 +101,9 @@ bool Random_per_voxel::get_seed(Eigen::Vector3f &p) const { | |||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| std::uniform_real_distribution<float> uniform; | ||||||||||||||
| p = {static_cast<float>(mask.index(0)) + uniform(rng) - 0.5F, | ||||||||||||||
| static_cast<float>(mask.index(1)) + uniform(rng) - 0.5F, | ||||||||||||||
| static_cast<float>(mask.index(2)) + uniform(rng) - 0.5F}; | ||||||||||||||
| p = {static_cast<float>(mask.index(0)) + uniform(rng()) - 0.5F, | ||||||||||||||
| static_cast<float>(mask.index(1)) + uniform(rng()) - 0.5F, | ||||||||||||||
| static_cast<float>(mask.index(2)) + uniform(rng()) - 0.5F}; | ||||||||||||||
| p = (*mask.voxel2scanner) * p; | ||||||||||||||
| return true; | ||||||||||||||
| } | ||||||||||||||
|
|
@@ -228,22 +228,25 @@ bool Rejection_per_voxel::get_seed(Eigen::Vector3f &p) const { | |||||||||||||
| float selector; | ||||||||||||||
| Eigen::Vector3f pos; | ||||||||||||||
| do { | ||||||||||||||
| pos = { | ||||||||||||||
| uniform(rng) * (interp.size(0) - 1), uniform(rng) * (interp.size(1) - 1), uniform(rng) * (interp.size(2) - 1)}; | ||||||||||||||
| pos = {uniform(rng()) * (interp.size(0) - 1), | ||||||||||||||
| uniform(rng()) * (interp.size(1) - 1), | ||||||||||||||
| uniform(rng()) * (interp.size(2) - 1)}; | ||||||||||||||
| seed.voxel(pos); | ||||||||||||||
| selector = rng->Uniform() * max; | ||||||||||||||
| selector = rng().Uniform() * max; | ||||||||||||||
| } while (seed.value() < selector); | ||||||||||||||
| p = interp.voxel2scanner * pos; | ||||||||||||||
| #else | ||||||||||||||
| auto seed = image; | ||||||||||||||
| float selector; | ||||||||||||||
| do { | ||||||||||||||
| seed.index(0) = std::uniform_int_distribution<int>(0, image.size(0) - 1)(rng); | ||||||||||||||
| seed.index(1) = std::uniform_int_distribution<int>(0, image.size(1) - 1)(rng); | ||||||||||||||
| seed.index(2) = std::uniform_int_distribution<int>(0, image.size(2) - 1)(rng); | ||||||||||||||
| selector = uniform(rng) * max; | ||||||||||||||
| seed.index(0) = std::uniform_int_distribution<int>(0, image.size(0) - 1)(rng()); | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: narrowing conversion from 'ssize_t' (aka 'long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions] seed.index(0) = std::uniform_int_distribution<int>(0, image.size(0) - 1)(rng());
^ |
||||||||||||||
| seed.index(1) = std::uniform_int_distribution<int>(0, image.size(1) - 1)(rng()); | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: narrowing conversion from 'ssize_t' (aka 'long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions] seed.index(1) = std::uniform_int_distribution<int>(0, image.size(1) - 1)(rng());
^ |
||||||||||||||
| seed.index(2) = std::uniform_int_distribution<int>(0, image.size(2) - 1)(rng()); | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: narrowing conversion from 'ssize_t' (aka 'long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions] seed.index(2) = std::uniform_int_distribution<int>(0, image.size(2) - 1)(rng());
^ |
||||||||||||||
| selector = uniform(rng()) * max; | ||||||||||||||
| } while (seed.value() < selector); | ||||||||||||||
| p = {seed.index(0) + uniform(rng) - 0.5f, seed.index(1) + uniform(rng) - 0.5f, seed.index(2) + uniform(rng) - 0.5f}; | ||||||||||||||
| p = {seed.index(0) + uniform(rng()) - 0.5f, | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: floating point literal has suffix 'f', which is not uppercase [readability-uppercase-literal-suffix]
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: narrowing conversion from 'ssize_t' (aka 'long') to 'result_type' (aka 'float') [bugprone-narrowing-conversions] p = {seed.index(0) + uniform(rng()) - 0.5f,
^ |
||||||||||||||
| seed.index(1) + uniform(rng()) - 0.5f, | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: floating point literal has suffix 'f', which is not uppercase [readability-uppercase-literal-suffix]
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: narrowing conversion from 'ssize_t' (aka 'long') to 'result_type' (aka 'float') [bugprone-narrowing-conversions] seed.index(1) + uniform(rng()) - 0.5f,
^ |
||||||||||||||
| seed.index(2) + uniform(rng()) - 0.5f}; | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: floating point literal has suffix 'f', which is not uppercase [readability-uppercase-literal-suffix]
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: narrowing conversion from 'ssize_t' (aka 'long') to 'result_type' (aka 'float') [bugprone-narrowing-conversions] seed.index(2) + uniform(rng()) - 0.5f};
^ |
||||||||||||||
| p = voxel2scanner * p; | ||||||||||||||
| #endif | ||||||||||||||
| return true; | ||||||||||||||
|
|
@@ -314,7 +317,7 @@ Random_coordinates::Random_coordinates(const std::filesystem::path &path) // | |||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| bool Random_coordinates::get_seed(Eigen::Vector3f &p) const { | ||||||||||||||
| p = coords.row(std::uniform_int_distribution<>(0, static_cast<int>(num_coordinates() - 1))(rng)); | ||||||||||||||
| p = coords.row(std::uniform_int_distribution<>(0, static_cast<int>(num_coordinates() - 1))(rng())); | ||||||||||||||
| return true; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -334,8 +337,8 @@ bool Rejection_per_coord::get_seed(Eigen::Vector3f &p) const { | |||||||||||||
| std::uniform_real_distribution<float> selector; | ||||||||||||||
| ssize_t coordinate_index(-1); | ||||||||||||||
| do { | ||||||||||||||
| coordinate_index = index_selector(rng); | ||||||||||||||
| } while (weights(coordinate_index) < selector(rng)); | ||||||||||||||
| coordinate_index = index_selector(rng()); | ||||||||||||||
| } while (weights(coordinate_index) < selector(rng())); | ||||||||||||||
| p = coords.row(coordinate_index); | ||||||||||||||
| return true; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,7 +135,7 @@ Dynamic::Dynamic(const std::filesystem::path &in, | |
| // Pick a good fixel to use for testing / debugging | ||
| std::uniform_real_distribution<float> uniform; | ||
| do { | ||
| test_fixel = std::uniform_int_distribution<int>(1, fixels.size() - 1)(rng); | ||
| test_fixel = std::uniform_int_distribution<int>(1, fixels.size() - 1)(rng()); | ||
| } while (fixels[test_fixel].get_weight() < 1.0 || fixels[test_fixel].get_FOD() < 0.5); | ||
|
|
||
| output_fixel_images("begin"); | ||
|
|
@@ -186,7 +186,7 @@ bool Dynamic::get_seed(Eigen::Vector3f &p, Eigen::Vector3f &d) { | |
| while (1) { | ||
|
|
||
| ++this_attempts; | ||
| const size_t fixel_index = 1 + uniform_int(rng); | ||
| const size_t fixel_index = 1 + uniform_int(rng()); | ||
| Fixel &fixel = fixels[fixel_index]; | ||
| float seed_prob; | ||
| if (fixel.can_update()) { | ||
|
|
@@ -223,11 +223,11 @@ bool Dynamic::get_seed(Eigen::Vector3f &p, Eigen::Vector3f &d) { | |
| seed_prob = fixel.get_old_prob(); | ||
| } | ||
|
|
||
| if (seed_prob > uniform_float(rng)) { | ||
| if (seed_prob > uniform_float(rng())) { | ||
|
|
||
| const Eigen::Vector3i &v(fixel.get_voxel()); | ||
| const Eigen::Vector3f vp( | ||
| v[0] + uniform_float(rng) - 0.5, v[1] + uniform_float(rng) - 0.5, v[2] + uniform_float(rng) - 0.5); | ||
| v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: narrowing conversion from 'double' to 'Scalar' (aka 'float') [bugprone-narrowing-conversions] v[0] + uniform_float(rng()) - 0.5, v[1] + uniform_float(rng()) - 0.5, v[2] + uniform_float(rng()) - 0.5);
^ |
||
| p = transform.voxel2scanner.cast<float>() * vp; | ||
|
|
||
| bool good_seed = !act; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "MR::DWI::Tractography::rng" is directly included [misc-include-cleaner]
cpp/core/dwi/tractography/algorithms/iFOD1.h:23: