diff --git a/src/Registration/cReg/NiftiImageData3DDeformation.cpp b/src/Registration/cReg/NiftiImageData3DDeformation.cpp index 9cbfe554e..34b4e0144 100644 --- a/src/Registration/cReg/NiftiImageData3DDeformation.cpp +++ b/src/Registration/cReg/NiftiImageData3DDeformation.cpp @@ -24,6 +24,7 @@ limitations under the License. \brief Class for deformation field transformations. \author Richard Brown +\author Alexander C. Whitehead \author SyneRBI */ @@ -58,12 +59,17 @@ void NiftiImageData3DDeformation::create_from_cpp(NiftiImageData3DTens { this->create_from_3D_image(ref); - reg_spline_getDeformationField(cpp.get_raw_nifti_sptr().get(), - this->_nifti_image.get(), - NULL, - false, //composition - true // bspline - ); + // reg_spline_getDeformationField(cpp.get_raw_nifti_sptr().get(), + // this->_nifti_image.get(), + // NULL, + // false, //composition + // true // bspline + // ); + + reg_spline_getDefFieldFromVelocityGrid(cpp.get_raw_nifti_sptr().get(), + this->_nifti_image.get(), + false // the number of step is not automatically updated + ); } template diff --git a/src/Registration/cReg/NiftyF3dSym.cpp b/src/Registration/cReg/NiftyF3dSym.cpp index 8a247715a..516cdc979 100644 --- a/src/Registration/cReg/NiftyF3dSym.cpp +++ b/src/Registration/cReg/NiftyF3dSym.cpp @@ -24,6 +24,7 @@ limitations under the License. \brief NiftyReg's f3d class for non-rigid registrations. \author Richard Brown +\author Alexander C. Whitehead \author SyneRBI */ @@ -33,6 +34,7 @@ limitations under the License. #include "sirf/Reg/NiftiImageData3D.h" #include "sirf/Reg/NiftiImageData3DDisplacement.h" #include <_reg_f3d_sym.h> +#include <_reg_f3d2.h> using namespace sirf; @@ -50,10 +52,21 @@ void NiftyF3dSym::process() NiftiImageData3D flo = *this->_floating_images_nifti.at(0); // Create the registration object - if (_use_symmetric) - _registration_sptr = std::make_shared >(_reference_time_point, _floating_time_point); + if(_use_velocity) + { + _registration_sptr = std::make_shared>(_reference_time_point, _floating_time_point); + } else - _registration_sptr = std::make_shared >(_reference_time_point, _floating_time_point); + { + if(_use_symmetric) + { + _registration_sptr = std::make_shared>(_reference_time_point, _floating_time_point); + } + else + { + _registration_sptr = std::make_shared>(_reference_time_point, _floating_time_point); + } + } // Set reference and floating images _registration_sptr->SetReferenceImage(ref.get_raw_nifti_sptr().get()); @@ -62,10 +75,23 @@ void NiftyF3dSym::process() // By default, use a padding value of 0 _registration_sptr->SetWarpedPaddingValue(0.f); + nifti_image* init_cpp = NULL; + // If there is an initial transformation matrix, set it - if (_initial_transformation_sptr) { - mat44 init_tm = _initial_transformation_sptr->get_as_mat44(); - _registration_sptr->SetAffineTransformation(&init_tm); + if (_initial_cpp_sptr) + { + std::cout << "\n\nSetting initial cpp...\n\n"; + + init_cpp = new nifti_image(*_initial_cpp_sptr->get_raw_nifti_sptr()); + _registration_sptr->SetControlPointGridImage(init_cpp); + } + else + { + // If there is an initial transformation matrix, set it + if (_initial_transformation_sptr) { + mat44 init_tm = _initial_transformation_sptr->get_as_mat44(); + _registration_sptr->SetAffineTransformation(&init_tm); + } } // Set masks (if present). Again, need to copy to get rid of const @@ -109,10 +135,14 @@ void NiftyF3dSym::process() this->_warped_images_nifti.at(0)->get_raw_nifti_sptr()->pixdim[4] = this->_warped_images_nifti.at(0)->get_raw_nifti_sptr()->dt = 0.F; // Get the CPP images - nifti_image * cpp_fwd_ptr = _registration_sptr->GetControlPointPositionImage(); + nifti_image* cpp_fwd_ptr = _registration_sptr->GetControlPointPositionImage(); NiftiImageData3DTensor cpp_forward(*cpp_fwd_ptr); nifti_image_free(cpp_fwd_ptr); - + + // Store CPP + std::shared_ptr > cpp_fwd_sptr = std::make_shared >(cpp_forward); + this->_cpp_fwd_images.at(0) = cpp_fwd_sptr; + // Get deformation fields from cpp std::shared_ptr > def_fwd_sptr = std::make_shared >(); def_fwd_sptr->create_from_cpp(cpp_forward, ref); @@ -128,6 +158,12 @@ void NiftyF3dSym::process() this->_warped_images.at(0) = this->_warped_images_nifti.at(0); std::cout << "\n\nRegistration finished!\n\n"; + + if(init_cpp != NULL) + { + delete init_cpp; + init_cpp = NULL; + } } template @@ -201,6 +237,8 @@ void NiftyF3dSym::check_parameters() const throw std::runtime_error("Reference time point has not been set."); } } +// currently UseNMISetReferenceBinNumber and UseNMISetFloatingBinNumber set their respective number of bins for the first time point only + template void NiftyF3dSym::parse_parameter_file() { @@ -228,6 +266,8 @@ void NiftyF3dSym::parse_parameter_file() parser.add_key("SetSSDWeight",®_f3d::SetSSDWeight); parser.add_key("SetLNCCWeight",®_f3d::SetLNCCWeight); parser.add_key("SetNMIWeight",®_f3d::SetNMIWeight); + parser.add_key("UseNMISetReferenceBinNumber",®_f3d::UseNMISetReferenceBinNumber); + parser.add_key("UseNMISetFloatingBinNumber",®_f3d::UseNMISetFloatingBinNumber); parser.add_key("SetKLDWeight",®_f3d::SetKLDWeight); parser.add_key("SetFloatingThresholdUp",®_f3d::SetFloatingThresholdUp); parser.add_key("SetFloatingThresholdLow",®_f3d::SetFloatingThresholdLow); @@ -237,6 +277,12 @@ void NiftyF3dSym::parse_parameter_file() parser.parse(); } + +// currently SetSSDWeight SetLNCCWeight and SetKLDWeight set their respective bool for the first time point only +// currently UseNMISetReferenceBinNumber and UseNMISetFloatingBinNumber set their respective number of bins for the first time point only +// currently SetSSDWeight does not normalise +// currently SetLNCCWeight uses a sd of 1.0 + template void NiftyF3dSym::set_parameters() { @@ -260,10 +306,15 @@ void NiftyF3dSym::set_parameters() else if (strcmp(par.c_str(),"SetLevelToPerform")== 0) _registration_sptr->SetLevelToPerform(unsigned(stoi(arg1))); else if (strcmp(par.c_str(),"SetMaximalIterationNumber")== 0) _registration_sptr->SetMaximalIterationNumber(unsigned(stoi(arg1))); else if (strcmp(par.c_str(),"SetPerturbationNumber")== 0) _registration_sptr->SetPerturbationNumber(unsigned(stoi(arg1))); - else if (strcmp(par.c_str(),"SetSSDWeight")== 0) _registration_sptr->SetSSDWeight(stoi(arg1), stoi(arg2)); - else if (strcmp(par.c_str(),"SetLNCCWeight")== 0) _registration_sptr->SetLNCCWeight(stoi(arg1), stod(arg2)); - else if (strcmp(par.c_str(),"SetNMIWeight")== 0) _registration_sptr->SetNMIWeight(stoi(arg1), stod(arg2)); - else if (strcmp(par.c_str(),"SetKLDWeight")== 0) _registration_sptr->SetKLDWeight(stoi(arg1), unsigned(stoi(arg2))); + else if (strcmp(par.c_str(),"SetSSDWeight")== 0) _registration_sptr->UseSSD(stoi(arg1), stoi(arg2)); + else if (strcmp(par.c_str(),"SetLNCCWeight")== 0) _registration_sptr->UseLNCC(stoi(arg1), stod(arg2)); + else if (strcmp(par.c_str(),"SetKLDWeight")== 0) _registration_sptr->UseKLDivergence(stoi(arg1)); + // else if (strcmp(par.c_str(),"SetSSDWeight")== 0){ _registration_sptr->SetSSDWeight(stoi(arg1), stoi(arg2)); _registration_sptr->UseSSD(0, 0); } + // else if (strcmp(par.c_str(),"SetLNCCWeight")== 0){ _registration_sptr->SetLNCCWeight(stoi(arg1), stod(arg2)); _registration_sptr->UseLNCC(0, 1.0); } + // else if (strcmp(par.c_str(),"SetNMIWeight")== 0){ _registration_sptr->SetNMIWeight(stoi(arg1), stod(arg2)); } + else if (strcmp(par.c_str(),"UseNMISetReferenceBinNumber")== 0) _registration_sptr->UseNMISetReferenceBinNumber(0, stod(arg1)); + else if (strcmp(par.c_str(),"UseNMISetFloatingBinNumber")== 0) _registration_sptr->UseNMISetFloatingBinNumber(0, stod(arg1)); + // else if (strcmp(par.c_str(),"SetKLDWeight")== 0){ _registration_sptr->SetKLDWeight(stoi(arg1), unsigned(stoi(arg2))); _registration_sptr->UseKLDivergence(0); } else if (strcmp(par.c_str(),"SetFloatingThresholdUp")== 0) _registration_sptr->SetFloatingThresholdUp(unsigned(stoi(arg1)), dataType(stod(arg2))); else if (strcmp(par.c_str(),"SetFloatingThresholdLow")== 0) _registration_sptr->SetFloatingThresholdLow(unsigned(stoi(arg1)), dataType(stod(arg2))); else if (strcmp(par.c_str(),"SetReferenceThresholdUp")== 0) _registration_sptr->SetReferenceThresholdUp(unsigned(stoi(arg1)), dataType(stod(arg2))); diff --git a/src/Registration/cReg/NiftyResampler.cpp b/src/Registration/cReg/NiftyResampler.cpp index 669323bbf..19d40f237 100644 --- a/src/Registration/cReg/NiftyResampler.cpp +++ b/src/Registration/cReg/NiftyResampler.cpp @@ -24,6 +24,7 @@ limitations under the License. \brief Resampling class based on nifty resample \author Richard Brown +\author Alexander C. Whitehead \author SyneRBI */ @@ -119,8 +120,8 @@ void NiftyResampler::set_up() // If there are multiple transformations, compose them into single transformation. // Use the reference regardless of forward/adjoint. this->_deformation_sptr = std::make_shared >( - NiftiImageData3DDeformation::compose_single_deformation( - this->_transformations,*this->_reference_image_niftis.real())); + NiftiImageData3DDeformation::compose_single_deformation( + this->_transformations,*this->_reference_image_niftis.real())); this->_need_to_set_up = false; } diff --git a/src/Registration/cReg/cReg.cpp b/src/Registration/cReg/cReg.cpp index d3c4282f1..e7e97894d 100644 --- a/src/Registration/cReg/cReg.cpp +++ b/src/Registration/cReg/cReg.cpp @@ -587,6 +587,8 @@ void* cReg_NiftiImageData3DDeformation_compose_single_deformation(const void* im trans_vec.push_back(&objectFromHandle >(vec.at(i))); else if (types[i] == '3') trans_vec.push_back(&objectFromHandle >(vec.at(i))); + else + throw std::runtime_error("cReg_NiftiImageData3DDeformation_compose_single_deformation: Bad tranformation type."); const NiftiImageData3D& ref = objectFromHandle >(im); const std::shared_ptr > def_sptr @@ -616,6 +618,19 @@ void* cReg_NiftiImageData3DDeformation_get_inverse(const void* def_ptr, const vo } CATCH; } +extern "C" +void* cReg_NiftiImageData3DDeformation_create_from_cpp(const void* def_ptr, const void* cpp_ptr, const void* ref_ptr) +{ + try { + std::shared_ptr > def_sptr; + getObjectSptrFromHandle >(def_ptr, def_sptr); + NiftiImageData3DTensor& cpp = objectFromHandle >(cpp_ptr); + const NiftiImageData& ref = objectFromHandle >(ref_ptr); + def_sptr->create_from_cpp(cpp, ref); + return newObjectHandle(def_sptr); + } + CATCH; +} // -------------------------------------------------------------------------------- // // NiftiImageData3DDisplacement // -------------------------------------------------------------------------------- // @@ -749,6 +764,31 @@ void* cReg_NiftyRegistration_print_all_wrapped_methods(const char* name) CATCH; } // -------------------------------------------------------------------------------- // +// NiftyF3d2 +// -------------------------------------------------------------------------------- // +extern "C" +void* cReg_NiftyF3d2_get_cpp_image(const void* ptr, const int idx) +{ + try { + NiftyF3dSym& reg = objectFromHandle>(ptr); + return newObjectHandle(std::dynamic_pointer_cast >(reg.get_cpp_forward_sptr(unsigned(idx)))); + } + CATCH; +} +extern "C" +void* cReg_NiftyF3d2_set_initial_cpp_image(const void* reg_ptr, const void* cpp_ptr) +{ + try { + std::shared_ptr > reg_sptr; + getObjectSptrFromHandle >(reg_ptr, reg_sptr); + std::shared_ptr > cpp_sptr; + getObjectSptrFromHandle >(cpp_ptr, cpp_sptr); + reg_sptr->set_initial_control_point_grid(cpp_sptr); + return newObjectHandle(reg_sptr); + } + CATCH; +} +// -------------------------------------------------------------------------------- // // NiftyAladinSym // -------------------------------------------------------------------------------- // extern "C" diff --git a/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h b/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h index c7e1f36bb..f5a1b20f9 100644 --- a/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h +++ b/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h @@ -34,6 +34,7 @@ in the symmetric version, and therefore do not recommend using it until that iss #pragma once #include "sirf/Reg/NiftyRegistration.h" +#include "sirf/Reg/NiftiImageData3DTensor.h" template class reg_f3d; @@ -52,6 +53,7 @@ In theory, multiple time points can be used, but thus far has only been tested f t == 1 for both reference and floating images. \author Richard Brown +\author Alexander C. Whitehead \author SyneRBI */ template class NiftyF3dSym : public NiftyRegistration @@ -63,6 +65,7 @@ template class NiftyF3dSym : public NiftyRegistration { _floating_time_point = 1; _reference_time_point = 1; + this->_cpp_fwd_images.resize(1); } /// Process @@ -80,6 +83,12 @@ template class NiftyF3dSym : public NiftyRegistration /// Set initial affine transformation void set_initial_affine_transformation(const std::shared_ptr > mat) { _initial_transformation_sptr = mat; } + + /// Set initial control_point_grid + void set_initial_control_point_grid(const std::shared_ptr > cpp) { _initial_cpp_sptr = cpp; } + + /// Get forward CPP image + virtual const std::shared_ptr > get_cpp_forward_sptr(const unsigned idx = 0) const { return _cpp_fwd_images.at(idx); } /// Get inverse deformation field image virtual const std::shared_ptr > get_deformation_field_inverse_sptr(const unsigned idx = 0) const; @@ -107,7 +116,13 @@ template class NiftyF3dSym : public NiftyRegistration int _reference_time_point; /// Use symmetric bool bool _use_symmetric = false; + /// Use velocity bool + bool _use_velocity = true; /// Transformation matrix std::shared_ptr > _initial_transformation_sptr; + /// Transformation matrix + std::shared_ptr > _initial_cpp_sptr; + /// CPP + std::vector > > _cpp_fwd_images; }; } diff --git a/src/Registration/cReg/include/sirf/Reg/cReg.h b/src/Registration/cReg/include/sirf/Reg/cReg.h index 2466296b2..582219cff 100644 --- a/src/Registration/cReg/include/sirf/Reg/cReg.h +++ b/src/Registration/cReg/include/sirf/Reg/cReg.h @@ -79,6 +79,7 @@ extern "C" { void* cReg_NiftiImageData3DDeformation_compose_single_deformation(const void* im, const char* types, const void* trans_vector_ptr); void* cReg_NiftiImageData3DDeformation_create_from_disp(const void* disp_ptr); void* cReg_NiftiImageData3DDeformation_get_inverse(const void* def_ptr, const void* floating_ptr); + void* cReg_NiftiImageData3DDeformation_create_from_cpp(const void* def_ptr, const void* cpp_ptr, const void* ref_ptr); // NiftiImageData3DDisplacement void* cReg_NiftiImageData3DDisplacement_create_from_def(const void* def_ptr); @@ -96,6 +97,10 @@ extern "C" { // NiftyReg-based registration void* cReg_NiftyRegistration_set_parameter(const void* ptr, const char* par, const char* arg1, const char* arg2); void* cReg_NiftyRegistration_print_all_wrapped_methods(const char* name); + + //NiftyF3d2 + void* cReg_NiftyF3d2_get_cpp_image(const void* ptr, const int idx); + void* cReg_NiftyF3d2_set_initial_cpp_image(const void* ptr, const void* cpp_ptr); // Aladin methods void* cReg_NiftyAladin_get_TM(const void* ptr, const char* dir); diff --git a/src/Registration/pReg/Reg.py b/src/Registration/pReg/Reg.py index 7ad7e0c2e..d555c4573 100644 --- a/src/Registration/pReg/Reg.py +++ b/src/Registration/pReg/Reg.py @@ -592,6 +592,10 @@ def __init__(self, src1=None, src2=None, src3=None): self.handle = pyreg.\ cReg_NiftiImageData3DTensor_construct_from_3_components( self.name, src1.handle, src2.handle, src3.handle) + elif isinstance(src1, NiftiImageData3D): + self.handle = pyreg.\ + cReg_NiftiImageData3DTensor_construct_from_3_components( + self.name, src1.handle, src1.handle, src1.handle) else: raise error('Wrong source in NiftiImageData3DTensor constructor') check_status(self.handle) @@ -658,6 +662,10 @@ def __init__(self, src1=None, src2=None, src3=None): self.handle = pyreg.\ cReg_NiftiImageData3DTensor_construct_from_3_components( self.name, src1.handle, src2.handle, src3.handle) + elif isinstance(src1, NiftiImageData3D): + self.handle = pyreg.\ + cReg_NiftiImageData3DTensor_construct_from_3_components( + self.name, src1.handle, src1.handle, src1.handle) elif isinstance(src1, NiftiImageData3DDeformation): self.handle = pyreg.\ cReg_NiftiImageData3DDisplacement_create_from_def(src1.handle) @@ -696,6 +704,10 @@ def __init__(self, src1=None, src2=None, src3=None): self.handle = pyreg.\ cReg_NiftiImageData3DTensor_construct_from_3_components( self.name, src1.handle, src2.handle, src3.handle) + elif isinstance(src1, NiftiImageData3D): + self.handle = pyreg.\ + cReg_NiftiImageData3DTensor_construct_from_3_components( + self.name, src1.handle, src1.handle, src1.handle) elif isinstance(src1, NiftiImageData3DDisplacement): self.handle = pyreg.\ cReg_NiftiImageData3DDeformation_create_from_disp(src1.handle) @@ -731,6 +743,14 @@ def get_inverse(self, floating=None): self.handle, floating.handle) check_status(output.handle) return output + + def create_from_cpp(self, cpp, ref): + """create from cpp""" + output = NiftiImageData3DDeformation() + output.handle = pyreg.cReg_NiftiImageData3DDeformation_create_from_cpp( + self.handle, cpp.handle, ref.handle) + check_status(output.handle) + return output @staticmethod def compose_single_deformation(trans, ref): @@ -783,15 +803,15 @@ def set_reference_image(self, reference_image): if not isinstance(reference_image, SIRF.ImageData): raise AssertionError() self.reference_image = reference_image - parms.set_parameter(self.handle, 'Registration', 'reference_image', - reference_image.handle) + parms.set_parameter(self.handle, 'Registration', + 'reference_image', reference_image.handle) def set_floating_image(self, floating_image): """Set the floating image. Will clear any previous floating images.""" if not isinstance(floating_image, SIRF.ImageData): raise AssertionError() - parms.set_parameter(self.handle, 'Registration', 'floating_image', - floating_image.handle) + parms.set_parameter(self.handle, 'Registration', + 'floating_image', floating_image.handle) def add_floating_image(self, floating_image): """Add floating image.""" @@ -890,22 +910,22 @@ def __del__(self): def set_parameter_file(self, filename): """Set the parameter filename.""" - parms.set_char_par(self.handle, 'NiftyRegistration', 'parameter_file', - filename) + parms.set_char_par(self.handle, 'NiftyRegistration', + 'parameter_file', filename) def set_reference_mask(self, reference_mask): """Set the reference mask.""" if not isinstance(reference_mask, SIRF.ImageData): raise AssertionError() - parms.set_parameter(self.handle, 'NiftyRegistration', 'reference_mask', - reference_mask.handle) + parms.set_parameter(self.handle, 'NiftyRegistration', + 'reference_mask', reference_mask.handle) def set_floating_mask(self, floating_mask): """Set the floating mask.""" if not isinstance(floating_mask, SIRF.ImageData): raise AssertionError() - parms.set_parameter(self.handle, 'NiftyRegistration', 'floating_mask', - floating_mask.handle) + parms.set_parameter(self.handle, 'NiftyRegistration', + 'floating_mask', floating_mask.handle) def set_parameter(self, par, arg1="", arg2=""): """Set string parameter. @@ -976,20 +996,39 @@ def __del__(self): def set_floating_time_point(self, floating_time_point): """Set floating time point.""" - parms.set_int_par(self.handle, self.name, 'floating_time_point', - floating_time_point) + parms.set_int_par(self.handle, 'NiftyF3dSym', + 'floating_time_point', floating_time_point) def set_reference_time_point(self, reference_time_point): """Set reference time point.""" - parms.set_int_par(self.handle, self.name, 'reference_time_point', - reference_time_point) + parms.set_int_par(self.handle, 'NiftyF3dSym', + 'reference_time_point', reference_time_point) def set_initial_affine_transformation(self, src): """Set initial affine transformation.""" if not isinstance(src, AffineTransformation): raise AssertionError() - parms.set_parameter(self.handle, self.name, + parms.set_parameter(self.handle, 'NiftyF3dSym', 'initial_affine_transformation', src.handle) + + def set_initial_control_point_grid(self, cpp): + """Set initial control point grid.""" + if not isinstance(cpp, NiftiImageData3DTensor): + raise AssertionError() + output = NiftyF3dSym() + output.handle = pyreg.cReg_NiftyF3d2_set_initial_cpp_image( + self.handle, cpp.handle) + check_status(output.handle) + return output + + def get_cpp_image(self, idx=0): + """Get the forward deformation field image.""" + output = NiftiImageData3DTensor() + output.handle = pyreg.\ + cReg_NiftyF3d2_get_cpp_image( + self.handle, int(idx)) + check_status(output.handle) + return output @staticmethod def print_all_wrapped_methods(): @@ -1085,8 +1124,8 @@ def set_reference_image(self, reference_image): if not isinstance(reference_image, SIRF.ImageData): raise AssertionError() self.reference_image = reference_image - parms.set_parameter( - self.handle, self.name, 'reference_image', reference_image.handle) + parms.set_parameter(self.handle, 'NiftyResampler', + 'reference_image', reference_image.handle) def set_floating_image(self, floating_image): """Set floating image. @@ -1097,8 +1136,8 @@ def set_floating_image(self, floating_image): if not isinstance(floating_image, SIRF.ImageData): raise AssertionError() self.floating_image = floating_image - parms.set_parameter( - self.handle, self.name, 'floating_image', floating_image.handle) + parms.set_parameter(self.handle, 'NiftyResampler', + 'floating_image', floating_image.handle) def add_transformation(self, src): """Add transformation.""" @@ -1127,28 +1166,28 @@ def set_interpolation_type(self, interp_type): """ if not isinstance(interp_type, int): raise AssertionError() - parms.set_int_par(self.handle, self.name, + parms.set_int_par(self.handle, 'NiftyResampler', 'interpolation_type', interp_type) def set_interpolation_type_to_nearest_neighbour(self): """Set interpolation type to nearest neighbour.""" - parms.set_int_par(self.handle, self.name, 'interpolation_type', 0) + parms.set_int_par(self.handle, 'NiftyResampler', 'interpolation_type', 0) def set_interpolation_type_to_linear(self): """Set interpolation type to linear.""" - parms.set_int_par(self.handle, self.name, 'interpolation_type', 1) + parms.set_int_par(self.handle, 'NiftyResampler', 'interpolation_type', 1) def set_interpolation_type_to_cubic_spline(self): """Set interpolation type to cubic spline.""" - parms.set_int_par(self.handle, self.name, 'interpolation_type', 3) + parms.set_int_par(self.handle, 'NiftyResampler', 'interpolation_type', 3) def set_interpolation_type_to_sinc(self): """Set interpolation type to sinc.""" - parms.set_int_par(self.handle, self.name, 'interpolation_type', 4) + parms.set_int_par(self.handle, 'NiftyResampler', 'interpolation_type', 4) def set_padding_value(self, val): """Set padding value.""" - parms.set_float_par(self.handle, self.name, 'padding', val) + parms.set_float_par(self.handle, 'NiftyResampler', 'padding', val) def process(self): """Process.