17#ifndef __adapter_replicate_h__
18#define __adapter_replicate_h__
29 template <
class ImageType>
31 public Base<Replicate<ImageType>,ImageType>
39 using base_type::ndim;
40 using base_type::spacing;
45 pos_ (std::max<size_t> (parent().ndim(),
header_.ndim()), 0)
47 for (
size_t n = 0; n < std::min<size_t> (parent().ndim(),
header_.ndim()); ++n) {
48 if (n < parent().ndim())
49 parent().index(n) = 0;
50 if (parent().size(n) > 1 && parent().size(n) !=
header_.size(n))
51 throw Exception (
"cannot replicate over non-singleton dimensions");
55 size_t ndim ()
const {
58 ssize_t size (
size_t axis)
const {
61 float spacing (
size_t axis)
const {
64 ssize_t stride (
size_t axis)
const {
65 return axis < parent().ndim() ? parent().stride (
axis) : 0;
68 ssize_t get_index (
size_t axis)
const {
71 void move_index (
size_t axis, ssize_t increment) {
73 if (
axis < parent().ndim())
74 if (parent().size(
axis) > 1)
75 parent().index(
axis) += increment;
79 using base_type::parent;
MR::default_type value_type