Skip to content
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

Adapter::Reslice: fix handling of complex types #2891

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions core/adapter/reslice.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ typename std::enable_if<!std::is_same<value_type, bool>::value && std::is_integr
}

template <typename value_type>
typename std::enable_if<std::is_floating_point<value_type>::value, value_type>::type inline normalise(
const default_type sum, const default_type norm) {
typename std::enable_if<!std::is_same<value_type, bool>::value && !std::is_integral<value_type>::value,
value_type>::type inline normalise(const default_type sum, const default_type norm) {
return (sum * norm);
}
} // namespace
Expand Down Expand Up @@ -98,6 +98,7 @@ template <template <class ImageType> class Interpolator, class ImageType>
class Reslice : public ImageBase<Reslice<Interpolator, ImageType>, typename ImageType::value_type> {
public:
using value_type = typename ImageType::value_type;
using internal_type = typename std::conditional<is_complex<value_type>::value, cdouble, double>::type;

template <class HeaderType>
Reslice(const ImageType &original,
Expand Down Expand Up @@ -175,7 +176,7 @@ class Reslice : public ImageBase<Reslice<Interpolator, ImageType>, typename Imag
using namespace Eigen;
if (oversampling) {
Vector3d d(x[0] + from[0], x[1] + from[1], x[2] + from[2]);
default_type sum(0.0);
internal_type sum(0.0);
Vector3d s;
for (uint32_t z = 0; z < OS[2]; ++z) {
s[2] = d[2] + z * inc[2];
Expand Down
Loading