-
Notifications
You must be signed in to change notification settings - Fork 203
fmtlib adoption extension #3375
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
base: fmt
Are you sure you want to change the base?
Changes from all commits
6e762fc
84718c2
2827ef7
0a1e784
c87677d
6c1dc7d
8070894
fa5ca6b
3756d21
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 |
|---|---|---|
|
|
@@ -53,9 +53,9 @@ void usage() { | |
| using value_type = Stats::value_type; | ||
| using complex_type = Stats::complex_type; | ||
|
|
||
| class Volume_loop { | ||
| template <typename T> class Volume_loop { | ||
| public: | ||
| Volume_loop(Image<complex_type> &in) : image(in), is_4D(in.ndim() == 4), status(true) { | ||
| Volume_loop(Image<T> &in) : image(in), is_4D(in.ndim() == 4), status(true) { | ||
| if (is_4D) | ||
| image.index(3) = 0; | ||
| } | ||
|
|
@@ -76,12 +76,12 @@ class Volume_loop { | |
| } | ||
|
|
||
| private: | ||
| Image<complex_type> ℑ | ||
| Image<T> ℑ | ||
|
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: member 'image' of type 'Image<complex> &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members] Image<T> ℑ
^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: member 'image' of type 'Image &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members] Image<T> ℑ
^ |
||
| const bool is_4D; | ||
| bool status; | ||
| }; | ||
|
|
||
| void run_volume(Stats::Stats &stats, Image<complex_type> &data, Image<bool> &mask) { | ||
| template <typename T> void run_volume(Stats::Stats<T> &stats, Image<T> &data, Image<bool> &mask) { | ||
| if (mask.valid()) { | ||
| for (auto l = Loop(0, 3)(data, mask); l; ++l) { | ||
| if (mask.value()) | ||
|
|
@@ -93,12 +93,8 @@ void run_volume(Stats::Stats &stats, Image<complex_type> &data, Image<bool> &mas | |
| } | ||
| } | ||
|
|
||
| void run() { | ||
| auto header = Header::open(argument[0]); | ||
| if (header.ndim() > 4) | ||
| throw Exception("mrstats is not designed to handle images greater than 4D"); | ||
| const bool is_complex = header.datatype().is_complex(); | ||
| auto data = header.get_image<complex_type>(); | ||
| template <typename T> void run_impl(Header &header) { | ||
| auto data = header.get_image<T>(); | ||
| const bool ignorezero = !get_options("ignorezero").empty(); | ||
|
|
||
| auto opt = get_options("mask"); | ||
|
|
@@ -114,18 +110,28 @@ void run() { | |
| fields.push_back(opt[n][0]); | ||
|
|
||
| if (App::log_level && fields.empty()) | ||
| Stats::print_header(is_complex); | ||
| Stats::print_header<T>(); | ||
|
|
||
| if (get_options("allvolumes").empty()) { | ||
| for (auto i = Volume_loop(data); i; ++i) { | ||
| Stats::Stats stats(is_complex, ignorezero); | ||
| run_volume(stats, data, mask); | ||
| for (auto i = Volume_loop<T>(data); i; ++i) { | ||
| Stats::Stats<T> stats(ignorezero); | ||
| run_volume<T>(stats, data, mask); | ||
| stats.print(data, fields); | ||
| } | ||
| } else { | ||
| Stats::Stats stats(is_complex, ignorezero); | ||
| for (auto i = Volume_loop(data); i; ++i) | ||
| run_volume(stats, data, mask); | ||
| Stats::Stats<T> stats(ignorezero); | ||
| for (auto i = Volume_loop<T>(data); i; ++i) | ||
| run_volume<T>(stats, data, mask); | ||
| stats.print(data, fields); | ||
| } | ||
| } | ||
|
|
||
| void run() { | ||
| auto header = Header::open(argument[0]); | ||
| if (header.ndim() > 4) | ||
| throw Exception("mrstats is not designed to handle images greater than 4D"); | ||
| if (header.datatype().is_complex()) | ||
| run_impl<complex_type>(header); | ||
| else | ||
| run_impl<value_type>(header); | ||
| } | ||
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: member 'image' of type 'Image &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members]
Image<T> ℑ ^