diff --git a/core/file/json_utils.cpp b/core/file/json_utils.cpp index 20cd367da3..a6b42c0ffa 100644 --- a/core/file/json_utils.cpp +++ b/core/file/json_utils.cpp @@ -14,6 +14,7 @@ * For more details, see http://www.mrtrix.org/. */ +#include #include #include @@ -254,7 +255,7 @@ void write(const Header &header, nlohmann::json &json, const std::string &image_ } std::vector order; - std::vector flip; + std::array flip; File::NIfTI::axes_on_write(header, order, flip); if (order[0] == 0 && order[1] == 1 && order[2] == 2 && !flip[0] && !flip[1] && !flip[2]) { INFO( diff --git a/core/file/nifti_utils.cpp b/core/file/nifti_utils.cpp index 4d424d74a9..45ac9189a7 100644 --- a/core/file/nifti_utils.cpp +++ b/core/file/nifti_utils.cpp @@ -544,7 +544,7 @@ template void store(NiftiHeader &NH, const Header &H, const } } -void axes_on_write(const Header &H, std::vector &order, std::vector &flip) { +void axes_on_write(const Header &H, std::vector &order, std::array &flip) { Stride::List strides = Stride::get(H); strides.resize(3); order = Stride::order(strides); @@ -552,7 +552,7 @@ void axes_on_write(const Header &H, std::vector &order, std::vector &axes) { - std::vector flip; + std::array flip; axes_on_write(H, axes, flip); if (axes[0] == 0 && axes[1] == 1 && axes[2] == 2 && !flip[0] && !flip[1] && !flip[2]) diff --git a/core/file/nifti_utils.h b/core/file/nifti_utils.h index a940bdcb8e..d5337edb92 100644 --- a/core/file/nifti_utils.h +++ b/core/file/nifti_utils.h @@ -17,6 +17,7 @@ #ifndef __file_nifti_utils_h__ #define __file_nifti_utils_h__ +#include // nifti1_io.h and nifti2_io.h headers must be included after dirent.h (transitively included by header.h) // otherwise we run into definitions conflict on Linux // clang-format off @@ -35,7 +36,7 @@ namespace File { namespace NIfTI { extern bool right_left_warning_issued; -void axes_on_write(const Header &H, std::vector &order, std::vector &flip); +void axes_on_write(const Header &H, std::vector &order, std::array &flip); transform_type adjust_transform(const Header &H, std::vector &order); bool check(int VERSION, Header &H, const size_t num_axes, const std::vector &suffixes); diff --git a/core/phase_encoding.h b/core/phase_encoding.h index 0a2c6e8ad2..2921848aff 100644 --- a/core/phase_encoding.h +++ b/core/phase_encoding.h @@ -18,6 +18,7 @@ #define __phaseencoding_h__ #include +#include #include "app.h" #include "axes.h" @@ -192,7 +193,7 @@ Eigen::MatrixXd transform_for_image_load(const MatrixType &pe_scheme, const Head template Eigen::MatrixXd transform_for_nifti_write(const MatrixType &pe_scheme, const HeaderType &H) { std::vector order; - std::vector flip; + std::array flip; File::NIfTI::axes_on_write(H, order, flip); if (order[0] == 0 && order[1] == 1 && order[2] == 2 && !flip[0] && !flip[1] && !flip[2]) { INFO("No transformation of phase encoding data required for export to file");