17#ifndef __filter_warp_h__
18#define __filter_warp_h__
37 template <
class InputImageType,
class OutputImageType>
39 out.row(3) = in.row(3);
64 template <
template <
class VoxelType>
class Interpolator,
class ImageTypeDestination,
class ImageTypeSource,
class WarpType>
66 ImageTypeSource& source,
67 ImageTypeDestination& destination,
71 const bool jacobian_modulate =
false )
75 if (
warp.transform().matrix() != destination.transform().matrix() ||
76 !dimensions_match (
warp, destination, 0, 3) ||
77 !spacings_match (
warp, destination, 0, 3)) {
79 Header header (destination);
88 if (destination.ndim() == 4)
89 ThreadedLoop (
"warping \"" + source.name() +
"\"" + (jacobian_modulate?
" with Jacobian intensity modulation" :
""), interp, 0, 3, 1).run (
CopyKernel4D(), interp, destination);
96 if (destination.ndim() == 4 && destination.is_direct_io())
97 ThreadedLoop (
"warping \"" + source.name() +
"\"" + (jacobian_modulate?
" with Jacobian intensity modulation" :
""), interp, 0, 3, 1).run (
CopyKernel4D(), interp, destination);
99 threaded_copy_with_progress_message (
"warping \"" + source.name() +
"\"" + (jacobian_modulate?
" with Jacobian intensity modulation" :
""), interp, destination, 0, destination.ndim(), 2);
an Image providing interpolated values from another Image
FORCE_INLINE void operator()(InputImageType &in, OutputImageType &out) const
static Image scratch(const Header &template_header, const std::string &label="scratch image")
const vector< uint32_t > AutoOverSample
const transform_type NoTransform
void warp(ImageTypeSource &source, ImageTypeDestination &destination, WarpType &warp, const typename ImageTypeDestination::value_type value_when_out_of_bounds=Interpolator< ImageTypeSource >::default_out_of_bounds_value(), const vector< uint32_t > oversample=Adapter::AutoOverSample, const bool jacobian_modulate=false)
convenience function to warp one image onto another
MR::default_type value_type
List contiguous_along_axis(size_t axis)
convenience function to get volume-contiguous strides
void set(HeaderType &header, const List &stride)
set the strides of header from a vector<ssize_t>
ThreadedLoopRunOuter< decltype(Loop(vector< size_t >()))> ThreadedLoop(const HeaderType &source, const vector< size_t > &outer_axes, const vector< size_t > &inner_axes)
Multi-threaded loop object.
void threaded_copy_with_progress_message(const std::string &message, InputImageType &source, OutputImageType &destination, const vector< size_t > &axes, size_t num_axes_in_thread=1)