20 #ifndef MIRTK_MultipleVoxelTransformation_H 21 #define MIRTK_MultipleVoxelTransformation_H 23 #include "mirtk/Float.h" 24 #include "mirtk/GenericImage.h" 25 #include "mirtk/VoxelFunction.h" 26 #include "mirtk/InterpolateImageFunction.h" 40 namespace MultipleVoxelTransformation {
74 inline T &
x_( T *p)
const {
return p[0]; }
78 inline const T &
x_(
const T *p)
const {
return p[0]; }
124 _MaxNumberOfComponents(0),
127 _Interpolators (NULL),
128 _Interpolator (NULL),
129 _PaddingValues (NULL),
131 _Transformation1 (NULL),
132 _Transformation2 (NULL),
185 if (!_Inputs || !_Interpolators || !_Outputs) {
186 if (_NumberOfImages > 1) {
187 cerr <<
"MultipleVoxelTransformation::BaseTransform: Invalid TransformData" << endl;
192 cerr <<
"MultipleVoxelTransformation::BaseTransform: Missing input image" << endl;
197 if (!_Interpolators) {
198 if (!_Interpolator) {
199 cerr <<
"MultipleVoxelTransformation::BaseTransform: Missing input interpolator" << endl;
202 _Interpolators = &_Interpolator;
206 cerr <<
"MultipleVoxelTransformation::BaseTransform: Missing output image" << endl;
214 if (!_Input) _Input = _Inputs [0];
215 if (!_Interpolator) _Interpolator = _Interpolators[0];
216 if (!_Output) _Output = _Outputs [0];
221 if (_Begin < 0) { _Begin = 0; _End = -1; }
222 if (_End < 0) _End = _NumberOfImages;
223 if (_End < _Begin) _End = _Begin;
225 if (_MaxNumberOfComponents < 1) {
226 _MaxNumberOfComponents = _Inputs[0]->GetT();
227 for (
int n = 1; n < _NumberOfImages; ++n) {
228 _MaxNumberOfComponents = max(_MaxNumberOfComponents, _Inputs[n]->GetT());
232 _v =
new double[_MaxNumberOfComponents];
241 _v =
new double[_MaxNumberOfComponents];
261 _x =
static_cast<double>(i);
262 _y =
static_cast<double>(j);
263 _z =
static_cast<double>(k);
264 _Output->ImageToWorld(_x, _y, _z);
286 if (_Invert) _Transformation1->Inverse (_x, _y, _z);
287 else _Transformation1->Transform(_x, _y, _z);
307 _Transformation1->Inverse (_x, _y, _z);
308 _Transformation2->Inverse (_x, _y, _z);
310 _Transformation1->Transform(_x, _y, _z);
311 _Transformation2->Transform(_x, _y, _z);
324 if (_Invert) _Transformation2->Inverse (_x, _y, _z);
325 else _Transformation2->Transform(_x, _y, _z);
334 _x +=
x_(disp1) +
x_(disp2);
335 _y +=
y_(disp1) +
y_(disp2);
336 _z +=
z_(disp1) +
z_(disp2);
347 _Input->WorldToImage(_x, _y, _z);
363 if (InputDomain::IsInside(GetInterpolator(), _x, _y, _z)) {
367 if (_Mask) _Mask->Put(i, j, k, static_cast<BinaryPixel>(
true));
369 x_(o2i) = numeric_limits<double>::quiet_NaN();
370 if (_Mask) _Mask->Put(i, j, k, static_cast<BinaryPixel>(
false));
387 template <
class OutputVoxelType>
392 for (
int n = _Begin; n != _End; ++n) {
393 p =
reinterpret_cast<OutputVoxelType *
>(_Outputs[n]->GetScalarPointer(i, j, k));
395 *p =
static_cast<OutputVoxelType
>(_PaddingValues ? _PaddingValues[n] : _PaddingValue);
399 if (_Mask) _Mask->Put(i, j, k, static_cast<BinaryPixel>(
false));
410 for (
int n = _Begin; n != _End; ++n) {
411 for (
int l = 0; l < _Outputs[n]->GetT(); ++l) {
412 _Outputs[n]->PutAsDouble(i, j, k, l, _PaddingValues ? _PaddingValues[n] : _PaddingValue);
416 if (_Mask) _Mask->Put(i, j, k, static_cast<BinaryPixel>(
false));
426 if (InputDomain::IsInside(GetInterpolator(), _x, _y, _z)) {
428 for (
int n = _Begin; n != _End; ++n) {
429 GetInterpolator(n)->EvaluateInside(
430 reinterpret_cast<double *>(_Outputs[n]->GetScalarPointer(i, j, k)), _x, _y, _z,
_NumberOfVoxels);
433 if (_Mask) _Mask->Put(i, j, k, static_cast<BinaryPixel>(
true));
436 PutOutsideValue<double>(i, j, k);
445 template <
class OutputVoxelType>
448 if (InputDomain::IsInside(GetInterpolator(), _x, _y, _z)) {
451 for (
int n = _Begin; n != _End; ++n) {
452 GetInterpolator(n)->EvaluateInside(_v, _x, _y, _z);
453 p =
reinterpret_cast<OutputVoxelType *
>(_Outputs[n]->GetScalarPointer(i, j, k));
455 *p =
static_cast<OutputVoxelType
>(_v[l]);
459 if (_Mask) _Mask->Put(i, j, k, static_cast<BinaryPixel>(
true));
462 PutOutsideValue<OutputVoxelType>(i, j, k);
475 if (InputDomain::IsInside(GetInterpolator(), _x, _y, _z)) {
477 for (
int n = _Begin; n != _End; ++n) {
478 GetInterpolator(n)->EvaluateInside(_v, _x, _y, _z);
479 for (
int l = 0; l < _Outputs[n]->GetT(); ++l) {
480 _Outputs[n]->PutAsDouble(i, j, k, l, _v[k]);
484 if (_Mask) _Mask->Put(i, j, k, static_cast<BinaryPixel>(
true));
487 PutOutsideValueAsDouble(i, j, k);
495 template <
class OutputVoxelType>
498 if (InputDomain::IsInside(GetInterpolator(), _x, _y, _z)) {
501 for (
int n = _Begin; n != _End; ++n) {
502 GetInterpolator(n)->EvaluateInside(_v, _x, _y, _z);
503 p =
reinterpret_cast<OutputVoxelType *
>(_Outputs[n]->GetScalarPointer(i, j, k));
505 *p =
static_cast<OutputVoxelType
>(_ScaleFactor * _v[l] + _Offset);
509 if (_Mask) _Mask->Put(i, j, k, static_cast<BinaryPixel>(
true));
512 PutOutsideValue<OutputVoxelType>(i, j, k);
526 if (InputDomain::IsInside(GetInterpolator(), _x, _y, _z)) {
528 for (
int n = _Begin; n != _End; ++n) {
529 GetInterpolator(n)->EvaluateInside(_v, _x, _y, _z);
530 for (
int l = 0; l < _Outputs[n]->GetT(); ++l) {
531 _Outputs[n]->PutAsDouble(i, j, k, l, _ScaleFactor * _v[l] + _Offset);
535 if (_Mask) _Mask->Put(i, j, k, static_cast<BinaryPixel>(
true));
538 PutOutsideValueAsDouble(i, j, k);
554 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
555 struct MapIndices :
public BaseTransform<InterpolateImageFunction, InputDomain>
561 void operator ()(
int i,
int j,
int k,
int,
double *o2i)
563 this->OutputToWorld(i, j, k);
564 this->WorldToInput();
565 this->PutVoxelTransformation(i, j, k, o2i);
568 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
double *o2i)
570 this->OutputToWorld(o2w);
571 this->WorldToInput();
572 this->PutVoxelTransformation(i, j, k, o2i);
577 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
584 void operator ()(
int i,
int j,
int k,
int,
double *o2i)
586 this->OutputToWorld(i, j, k);
587 this->ApplyTransformation();
588 this->WorldToInput();
589 this->PutVoxelTransformation(i, j, k, o2i);
592 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
double *o2i)
594 this->OutputToWorld(o2w);
595 this->ApplyTransformation();
596 this->WorldToInput();
597 this->PutVoxelTransformation(i, j, k, o2i);
602 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
603 struct Displace :
public BaseTransform<InterpolateImageFunction, InputDomain>
609 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
double *o2i)
611 this->OutputToWorld(i, j, k);
612 this->ApplyDisplacement(disp1);
613 this->WorldToInput();
614 this->PutVoxelTransformation(i, j, k, o2i);
617 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
double *o2i)
619 this->OutputToWorld(o2w);
620 this->ApplyDisplacement(disp1);
621 this->WorldToInput();
622 this->PutVoxelTransformation(i, j, k, o2i);
627 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
628 struct FluidTransform :
public BaseTransform<InterpolateImageFunction, InputDomain>
634 void operator ()(
int i,
int j,
int k,
int,
double *o2i)
636 this->OutputToWorld(i, j, k);
637 this->ApplyTransformations();
638 this->WorldToInput();
639 this->PutVoxelTransformation(i, j, k, o2i);
642 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
double *o2i)
644 this->OutputToWorld(o2w);
645 this->ApplyTransformations();
646 this->WorldToInput();
647 this->PutVoxelTransformation(i, j, k, o2i);
652 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
653 struct DisplaceTransform :
public BaseTransform<InterpolateImageFunction, InputDomain>
659 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
double *o2i)
661 this->OutputToWorld(i, j, k);
662 this->ApplyDisplacementAndTransformation(disp1);
663 this->WorldToInput();
664 this->PutVoxelTransformation(i, j, k, o2i);
667 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
double *o2i)
669 this->OutputToWorld(o2w);
670 this->ApplyDisplacementAndTransformation(disp1);
671 this->WorldToInput();
672 this->PutVoxelTransformation(i, j, k, o2i);
677 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
678 struct AddDisplacements :
public BaseTransform<InterpolateImageFunction, InputDomain>
684 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
const double *disp2,
double *o2i)
686 this->OutputToWorld(i, j, k);
687 this->ApplyDisplacements(disp1, disp2);
688 this->WorldToInput();
689 this->PutVoxelTransformation(i, j, k, o2i);
692 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
const double *disp2,
double *o2i)
694 this->OutputToWorld(o2w);
695 this->ApplyDisplacements(disp1, disp2);
696 this->WorldToInput();
697 this->PutVoxelTransformation(i, j, k, o2i);
708 template <
class InterpolateImageFunction = InterpolateImageFunction>
712 int _NumberOfComponents;
713 double _PaddingValue;
730 if (!_v) _v =
new double[_NumberOfComponents];
733 template <
class OutputVoxelType>
734 void operator ()(
int,
int,
int,
int,
const double *o2i, OutputVoxelType *out)
737 for (
int l = 0; l < _NumberOfComponents; ++l, out +=
_NumberOfVoxels) {
738 *out =
static_cast<OutputVoxelType
>(_PaddingValue);
741 if (!_v) _v =
new double[_NumberOfComponents];
743 for (
int l = 0; l < _NumberOfComponents; ++l, out +=
_NumberOfVoxels) {
744 *out =
static_cast<OutputVoxelType
>(_v[l]);
749 void operator ()(
int,
int,
int,
int,
const double *o2i,
double *out)
752 for (
int l = 0; l < _NumberOfComponents; ++l, out +=
_NumberOfVoxels) {
753 *out = _PaddingValue;
767 template <
class InterpolateImageFunction = InterpolateImageFunction>
773 template <
class OutputVoxelType>
774 void operator ()(
int,
int,
int,
int,
const double *o2i, OutputVoxelType *out)
777 for (
int l = 0; l < this->_NumberOfComponents; ++l, out += this->
_NumberOfVoxels) {
778 *out =
static_cast<OutputVoxelType
>(this->_PaddingValue);
781 this->InitializeMemory();
782 this->_Interpolator->EvaluateInside(this->_v, this->
x_(o2i), this->
y_(o2i), this->
z_(o2i));
783 for (
int l = 0; l < this->_NumberOfComponents; ++l, out += this->
_NumberOfVoxels) {
784 *out =
static_cast<OutputVoxelType
>(_ScaleFactor * this->_v[l] + _Offset);
793 template <
class InterpolateImageFunction = InterpolateImageFunction>
798 void operator ()(
int i,
int j,
int k,
int,
const double *o2i)
801 for (
int l = 0; l < this->_NumberOfComponents; ++l) {
802 this->_Output->
PutAsDouble(i, j, k, l, this->_PaddingValue);
805 this->InitializeMemory();
806 this->_Interpolator->EvaluateInside(this->_v, this->
x_(o2i), this->
y_(o2i), this->
z_(o2i));
807 for (
int l = 0; l < this->_NumberOfComponents; ++l) {
808 _Output->
PutAsDouble(i, j, k, l, this->_ScaleFactor * this->_v[l] + this->_Offset);
823 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
824 struct MapIndicesInterpolatePut :
public BaseTransform<InterpolateImageFunction, InputDomain>
830 template <
class OutputVoxelType>
831 void operator ()(
int i,
int j,
int k,
int, OutputVoxelType *out)
833 this->OutputToWorld(i, j, k);
834 this->WorldToInput();
835 this->
template InterpolatePut(i, j, k, out);
838 template <
class OutputVoxelType>
839 void operator ()(
int i,
int j,
int k,
int,
const double *o2w, OutputVoxelType *out)
841 this->OutputToWorld(o2w);
842 this->WorldToInput();
843 this->
template InterpolatePut(i, j, k, out);
848 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
855 void operator ()(
int i,
int j,
int k,
int,
void *)
857 this->OutputToWorld(i, j, k);
858 this->WorldToInput();
859 this->InterpolatePutAsDouble(i, j, k);
862 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
void *)
864 this->OutputToWorld(o2w);
865 this->WorldToInput();
866 this->InterpolatePutAsDouble(i, j, k);
871 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
878 template <
class OutputVoxelType>
879 void operator ()(
int i,
int j,
int k,
int, OutputVoxelType *out)
881 this->OutputToWorld(i, j, k);
882 this->WorldToInput();
883 this->
template InterpolateRescalePut(i, j, k, out);
886 template <
class OutputVoxelType>
887 void operator ()(
int i,
int j,
int k,
int,
const double *o2w, OutputVoxelType *out)
889 this->OutputToWorld(o2w);
890 this->WorldToInput();
891 this->
template InterpolateRescalePut(i, j, k, out);
896 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
899 MapIndicesInterpolateRescalePutAsDouble(
const TransformData &data)
903 void operator ()(
int i,
int j,
int k,
int,
void *)
905 this->OutputToWorld(i, j, k);
906 this->WorldToInput();
907 this->InterpolateRescalePutAsDouble(i, j, k);
910 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
void *)
912 this->OutputToWorld(o2w);
913 this->WorldToInput();
914 this->InterpolateRescalePutAsDouble(i, j, k);
923 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
930 template <
class OutputVoxelType>
931 void operator ()(
int i,
int j,
int k,
int, OutputVoxelType *out)
933 this->OutputToWorld(i, j, k);
934 this->ApplyTransformation();
935 this->WorldToInput();
936 this->
template InterpolatePut(i, j, k, out);
939 template <
class OutputVoxelType>
940 void operator ()(
int i,
int j,
int k,
int,
const double *o2w, OutputVoxelType *out)
942 this->OutputToWorld(o2w);
943 this->ApplyTransformation();
944 this->WorldToInput();
945 this->
template InterpolatePut(i, j, k, out);
950 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
957 void operator ()(
int i,
int j,
int k,
int,
void *)
959 this->OutputToWorld(i, j, k);
960 this->ApplyTransformation();
961 this->WorldToInput();
962 this->InterpolatePutAsDouble(i, j, k);
965 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
void *)
967 this->OutputToWorld(o2w);
968 this->ApplyTransformation();
969 this->WorldToInput();
970 this->InterpolatePutAsDouble(i, j, k);
975 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
982 template <
class OutputVoxelType>
983 void operator ()(
int i,
int j,
int k,
int, OutputVoxelType *out)
985 this->OutputToWorld(i, j, k);
986 this->ApplyTransformation();
987 this->WorldToInput();
988 this->
template InterpolateRescalePut(i, j, k, out);
991 template <
class OutputVoxelType>
992 void operator ()(
int i,
int j,
int k,
int,
const double *o2w, OutputVoxelType *out)
994 this->OutputToWorld(o2w);
995 this->ApplyTransformation();
996 this->WorldToInput();
997 this->
template InterpolateRescalePut(i, j, k, out);
1002 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1005 TransformInterpolateRescalePutAsDouble(
const TransformData &data)
1009 void operator ()(
int i,
int j,
int k,
int,
void *)
1011 this->OutputToWorld(i, j, k);
1012 this->ApplyTransformation();
1013 this->WorldToInput();
1014 this->InterpolateRescalePutAsDouble(i, j, k);
1017 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
void *)
1019 this->OutputToWorld(o2w);
1020 this->ApplyTransformation();
1021 this->WorldToInput();
1022 this->InterpolateRescalePutAsDouble(i, j, k);
1031 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1038 template <
class OutputVoxelType>
1039 void operator ()(
int i,
int j,
int k,
int,
const double *disp1, OutputVoxelType *out)
1041 this->OutputToWorld(i, j, k);
1042 this->ApplyDisplacement(disp1);
1043 this->WorldToInput();
1044 this->
template InterpolatePut(i, j, k, out);
1047 template <
class OutputVoxelType>
1048 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1, OutputVoxelType *out)
1050 this->OutputToWorld(o2w);
1051 this->ApplyDisplacement(disp1);
1052 this->WorldToInput();
1053 this->
template InterpolatePut(i, j, k, out);
1058 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1065 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
void *)
1067 this->OutputToWorld(i, j, k);
1068 this->ApplyDisplacement(disp1);
1069 this->WorldToInput();
1070 this->InterpolatePutAsDouble(i, j, k);
1073 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
void *)
1075 this->OutputToWorld(o2w);
1076 this->ApplyDisplacement(disp1);
1077 this->WorldToInput();
1078 this->InterpolatePutAsDouble(i, j, k);
1083 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1090 template <
class OutputVoxelType>
1091 void operator ()(
int i,
int j,
int k,
int,
const double *disp1, OutputVoxelType *out)
1093 this->OutputToWorld(i, j, k);
1094 this->ApplyDisplacement(disp1);
1095 this->WorldToInput();
1096 this->
template InterpolateRescalePut(i, j, k, out);
1099 template <
class OutputVoxelType>
1100 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1, OutputVoxelType *out)
1102 this->OutputToWorld(o2w);
1103 this->ApplyDisplacement(disp1);
1104 this->WorldToInput();
1105 this->
template InterpolateRescalePut(i, j, k, out);
1110 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1113 DisplaceInterpolateRescalePutAsDouble(
const TransformData &data)
1117 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
void *)
1119 this->OutputToWorld(i, j, k);
1120 this->ApplyDisplacement(disp1);
1121 this->WorldToInput();
1122 this->InterpolateRescalePutAsDouble(i, j, k);
1125 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
void *)
1127 this->OutputToWorld(o2w);
1128 this->ApplyDisplacement(disp1);
1129 this->WorldToInput();
1130 this->InterpolateRescalePutAsDouble(i, j, k);
1139 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1146 template <
class OutputVoxelType>
1147 void operator ()(
int i,
int j,
int k,
int, OutputVoxelType *out)
1149 this->OutputToWorld(i, j, k);
1150 this->ApplyTransformations();
1151 this->WorldToInput();
1152 this->
template InterpolatePut(i, j, k, out);
1155 template <
class OutputVoxelType>
1156 void operator ()(
int i,
int j,
int k,
int,
const double *o2w, OutputVoxelType *out)
1158 this->OutputToWorld(o2w);
1159 this->ApplyTransformations();
1160 this->WorldToInput();
1161 this->
template InterpolatePut(i, j, k, out);
1166 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1169 FluidTransformInterpolatePutAsDouble(
const TransformData &data)
1173 void operator ()(
int i,
int j,
int k,
int,
void *)
1175 this->OutputToWorld(i, j, k);
1176 this->ApplyTransformations();
1177 this->WorldToInput();
1178 this->InterpolatePutAsDouble(i, j, k);
1181 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
void *)
1183 this->OutputToWorld(o2w);
1184 this->ApplyTransformations();
1185 this->WorldToInput();
1186 this->InterpolatePutAsDouble(i, j, k);
1191 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1194 FluidTransformInterpolateRescalePut(
const TransformData &data)
1198 template <
class OutputVoxelType>
1199 void operator ()(
int i,
int j,
int k,
int, OutputVoxelType *out)
1201 this->OutputToWorld(i, j, k);
1202 this->ApplyTransformations();
1203 this->WorldToInput();
1204 this->
template InterpolateRescalePut(i, j, k, out);
1207 template <
class OutputVoxelType>
1208 void operator ()(
int i,
int j,
int k,
int,
const double *o2w, OutputVoxelType *out)
1210 this->OutputToWorld(o2w);
1211 this->ApplyTransformations();
1212 this->WorldToInput();
1213 this->
template InterpolateRescalePut(i, j, k, out);
1218 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1221 FluidTransformInterpolateRescalePutAsDouble(
const TransformData &data)
1225 void operator ()(
int i,
int j,
int k,
int,
void *)
1227 this->OutputToWorld(i, j, k);
1228 this->ApplyTransformations();
1229 this->WorldToInput();
1230 this->InterpolateRescalePutAsDouble(i, j, k);
1233 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
void *)
1235 this->OutputToWorld(o2w);
1236 this->ApplyTransformations();
1237 this->WorldToInput();
1238 this->InterpolateRescalePutAsDouble(i, j, k);
1247 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1253 if (this->_Transformation1 && !this->_Transformation2) {
1254 this->_Transformation2 = this->_Transformation1;
1258 template <
class OutputVoxelType>
1259 void operator ()(
int i,
int j,
int k,
int,
const double *disp1, OutputVoxelType *out)
1261 this->OutputToWorld(i, j, k);
1262 this->ApplyDisplacementAndTransformation(disp1);
1263 this->WorldToInput();
1264 this->
template InterpolatePut(i, j, k, out);
1267 template <
class OutputVoxelType>
1268 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1, OutputVoxelType *out)
1270 this->OutputToWorld(o2w);
1271 this->ApplyDisplacementAndTransformation(disp1);
1272 this->WorldToInput();
1273 this->
template InterpolatePut(i, j, k, out);
1278 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1281 DisplaceTransformInterpolatePutAsDouble(
const TransformData &data)
1284 if (this->_Transformation1 && !this->_Transformation2) {
1285 this->_Transformation2 = this->_Transformation1;
1289 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
void *)
1291 this->OutputToWorld(i, j, k);
1292 this->ApplyDisplacementAndTransformation(disp1);
1293 this->WorldToInput();
1294 this->InterpolatePutAsDouble(i, j, k);
1297 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
void *)
1299 this->OutputToWorld(o2w);
1300 this->ApplyDisplacementAndTransformation(disp1);
1301 this->WorldToInput();
1302 this->InterpolatePutAsDouble(i, j, k);
1307 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1310 DisplaceTransformInterpolateRescalePut(
const TransformData &data)
1313 if (this->_Transformation1 && !this->_Transformation2) {
1314 this->_Transformation2 = this->_Transformation1;
1318 template <
class OutputVoxelType>
1319 void operator ()(
int i,
int j,
int k,
int,
const double *disp1, OutputVoxelType *out)
1321 this->OutputToWorld(i, j, k);
1322 this->ApplyDisplacementAndTransformation(disp1);
1323 this->WorldToInput();
1324 this->
template InterpolateRescalePut(i, j, k, out);
1327 template <
class OutputVoxelType>
1328 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1, OutputVoxelType *out)
1330 this->OutputToWorld(o2w);
1331 this->ApplyDisplacementAndTransformation(disp1);
1332 this->WorldToInput();
1333 this->
template InterpolateRescalePut(i, j, k, out);
1338 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1341 DisplaceTransformInterpolateRescalePutAsDouble(
const TransformData &data)
1344 if (this->_Transformation1 && !this->_Transformation2) {
1345 this->_Transformation2 = this->_Transformation1;
1349 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
void *)
1351 this->OutputToWorld(i, j, k);
1352 this->ApplyDisplacementAndTransformation(disp1);
1353 this->WorldToInput();
1354 this->InterpolateRescalePutAsDouble(i, j, k);
1357 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
void *)
1359 this->OutputToWorld(o2w);
1360 this->ApplyDisplacementAndTransformation(disp1);
1361 this->WorldToInput();
1362 this->InterpolateRescalePutAsDouble(i, j, k);
1371 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1378 template <
class OutputVoxelType>
1379 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
const double *disp2, OutputVoxelType *out)
1381 this->OutputToWorld(i, j, k);
1382 this->ApplyDisplacements(disp1, disp2);
1383 this->WorldToInput();
1384 this->
template InterpolatePut(i, j, k, out);
1387 template <
class OutputVoxelType>
1388 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
const double *disp2, OutputVoxelType *out)
1390 this->OutputToWorld(o2w);
1391 this->ApplyDisplacements(disp1, disp2);
1392 this->WorldToInput();
1393 this->
template InterpolatePut(i, j, k, out);
1398 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1401 AddDisplacementsInterpolatePutAsDouble(
const TransformData &data)
1405 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
const double *disp2,
void *)
1407 this->OutputToWorld(i, j, k);
1408 this->ApplyDisplacements(disp1, disp2);
1409 this->WorldToInput();
1410 this->InterpolatePutAsDouble(i, j, k);
1413 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
const double *disp2,
void *)
1415 this->OutputToWorld(o2w);
1416 this->ApplyDisplacements(disp1, disp2);
1417 this->WorldToInput();
1418 this->InterpolatePutAsDouble(i, j, k);
1423 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1426 AddDisplacementsInterpolateRescalePut(
const TransformData &data)
1430 template <
class OutputVoxelType>
1431 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
const double *disp2, OutputVoxelType *out)
1433 this->OutputToWorld(i, j, k);
1434 this->ApplyDisplacements(disp1, disp2);
1435 this->WorldToInput();
1436 this->
template InterpolateRescalePut(i, j, k, out);
1439 template <
class OutputVoxelType>
1440 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
const double *disp2, OutputVoxelType *out)
1442 this->OutputToWorld(o2w);
1443 this->ApplyDisplacements(disp1, disp2);
1444 this->WorldToInput();
1445 this->
template InterpolateRescalePut(i, j, k, out);
1450 template <
class InterpolateImageFunction = InterpolateImageFunction,
class InputDomain = InterpolationDomain::Foreground>
1453 AddDisplacementsInterpolateRescalePutAsDouble(
const TransformData &data)
1457 void operator ()(
int i,
int j,
int k,
int,
const double *disp1,
const double *disp2,
void *)
1459 this->OutputToWorld(i, j, k);
1460 this->ApplyDisplacements(disp1, disp2);
1461 this->WorldToInput();
1462 this->InterpolateRescalePutAsDouble(i, j, k);
1465 void operator ()(
int i,
int j,
int k,
int,
const double *o2w,
const double *disp1,
const double *disp2,
void *)
1467 this->OutputToWorld(o2w);
1468 this->ApplyDisplacements(disp1, disp2);
1469 this->WorldToInput();
1470 this->InterpolateRescalePutAsDouble(i, j, k);
1477 #endif // MIRTK_MultipleVoxelTransformation_H
MIRTKCU_API bool IsNaN(double x)
Check if floating point value is not a number (NaN)
virtual double EvaluateInside(double, double, double=0, double=0) const =0
virtual void PutAsDouble(int, double)
Function for pixel put access.
void Transform(Array< T > &values, UnaryOperation op)
Apply unary operation for each array element in-place.