From e6472c94c6bb91b558bb0b64335e658aa8e05099 Mon Sep 17 00:00:00 2001 From: ALEXJAZZ008008 Date: Sat, 5 Jun 2021 23:36:49 +0100 Subject: [PATCH 01/10] added code to use reg_f3d2 in NiftyF3dSym which uses a velocity field paramatarisation --- src/Registration/cReg/NiftyF3dSym.cpp | 18 +++++++++++++++--- .../cReg/include/sirf/Reg/NiftyF3dSym.h | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Registration/cReg/NiftyF3dSym.cpp b/src/Registration/cReg/NiftyF3dSym.cpp index 8a247715a..db40154db 100644 --- a/src/Registration/cReg/NiftyF3dSym.cpp +++ b/src/Registration/cReg/NiftyF3dSym.cpp @@ -33,6 +33,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 +51,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_symmetric) + { + _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_velocity) + { + _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()); diff --git a/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h b/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h index c7e1f36bb..af0806e33 100644 --- a/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h +++ b/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h @@ -107,6 +107,8 @@ 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; }; From 14b0d7db9aba64782597ca90536b371760d8af1b Mon Sep 17 00:00:00 2001 From: ALEXJAZZ008008 Date: Sun, 6 Jun 2021 00:23:24 +0100 Subject: [PATCH 02/10] removed forward declaration fixed bug where no objective function other than nmi would be used --- src/Registration/cReg/NiftyF3dSym.cpp | 14 ++++++++++---- .../cReg/include/sirf/Reg/NiftyF3dSym.h | 3 +-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Registration/cReg/NiftyF3dSym.cpp b/src/Registration/cReg/NiftyF3dSym.cpp index db40154db..1ab4500f9 100644 --- a/src/Registration/cReg/NiftyF3dSym.cpp +++ b/src/Registration/cReg/NiftyF3dSym.cpp @@ -32,6 +32,7 @@ limitations under the License. #include "sirf/Reg/AffineTransformation.h" #include "sirf/Reg/NiftiImageData3D.h" #include "sirf/Reg/NiftiImageData3DDisplacement.h" +#include <_reg_f3d.h> #include <_reg_f3d_sym.h> #include <_reg_f3d2.h> @@ -249,6 +250,11 @@ void NiftyF3dSym::parse_parameter_file() parser.parse(); } + +// currently SetSSDWeight SetLNCCWeight and SetKLDWeight set their respective bool for the first time point only +// currently SetSSDWeight does not normalise +// currently SetLNCCWeight uses a sd of 1.0 + template void NiftyF3dSym::set_parameters() { @@ -272,10 +278,10 @@ 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->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(),"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/include/sirf/Reg/NiftyF3dSym.h b/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h index af0806e33..ab766a8b3 100644 --- a/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h +++ b/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h @@ -35,8 +35,6 @@ in the symmetric version, and therefore do not recommend using it until that iss #include "sirf/Reg/NiftyRegistration.h" -template class reg_f3d; - namespace sirf { /// Forward declarations @@ -52,6 +50,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 From 8b3facdf648f1f55629ae78b0c28ee54896b5a47 Mon Sep 17 00:00:00 2001 From: ALEXJAZZ008008 Date: Sun, 6 Jun 2021 00:54:48 +0100 Subject: [PATCH 03/10] replaced forward declaration --- src/Registration/cReg/NiftyF3dSym.cpp | 1 - src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Registration/cReg/NiftyF3dSym.cpp b/src/Registration/cReg/NiftyF3dSym.cpp index 1ab4500f9..00e58f610 100644 --- a/src/Registration/cReg/NiftyF3dSym.cpp +++ b/src/Registration/cReg/NiftyF3dSym.cpp @@ -32,7 +32,6 @@ limitations under the License. #include "sirf/Reg/AffineTransformation.h" #include "sirf/Reg/NiftiImageData3D.h" #include "sirf/Reg/NiftiImageData3DDisplacement.h" -#include <_reg_f3d.h> #include <_reg_f3d_sym.h> #include <_reg_f3d2.h> diff --git a/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h b/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h index ab766a8b3..679947a64 100644 --- a/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h +++ b/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h @@ -35,6 +35,8 @@ in the symmetric version, and therefore do not recommend using it until that iss #include "sirf/Reg/NiftyRegistration.h" +template class reg_f3d; + namespace sirf { /// Forward declarations From 5c96834110eaa2385065e41118ad0fc087f0d100 Mon Sep 17 00:00:00 2001 From: ALEXJAZZ008008 Date: Sun, 6 Jun 2021 01:51:55 +0100 Subject: [PATCH 04/10] added ability to set number of bins for nmi --- requirements.txt | 8 -------- src/Registration/cReg/NiftyF3dSym.cpp | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 318ce67ed..000000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -numpy>=1.18.0 --only-binary=numpy -scipy --only-binary=scipy -matplotlib --only-binary=matplotlib -docopt -psutil -nose -deprecation -nibabel # optional diff --git a/src/Registration/cReg/NiftyF3dSym.cpp b/src/Registration/cReg/NiftyF3dSym.cpp index 00e58f610..f98e0501a 100644 --- a/src/Registration/cReg/NiftyF3dSym.cpp +++ b/src/Registration/cReg/NiftyF3dSym.cpp @@ -213,6 +213,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() { @@ -240,6 +242,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); @@ -251,6 +255,7 @@ void NiftyF3dSym::parse_parameter_file() } // 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 @@ -280,6 +285,8 @@ void NiftyF3dSym::set_parameters() 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))); From 31354f5d5fcf657247ec7e395fa676f5ff39205c Mon Sep 17 00:00:00 2001 From: ALEXJAZZ008008 Date: Tue, 29 Jun 2021 23:35:56 +0100 Subject: [PATCH 05/10] fix for transformation types outside 1-3 is compose needed in input is less than one --- src/Registration/cReg/NiftyResampler.cpp | 8 +++++--- src/Registration/cReg/cReg.cpp | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Registration/cReg/NiftyResampler.cpp b/src/Registration/cReg/NiftyResampler.cpp index 669323bbf..7fbf6109d 100644 --- a/src/Registration/cReg/NiftyResampler.cpp +++ b/src/Registration/cReg/NiftyResampler.cpp @@ -118,9 +118,11 @@ 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())); + if (this->_transformations.size() > 1) { + this->_deformation_sptr = std::make_shared >( + 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..72ca958d3 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 From b6947c09fadb5e78a1d883c34d4a38198498e441 Mon Sep 17 00:00:00 2001 From: ALEXJAZZ008008 Date: Wed, 30 Jun 2021 00:38:11 +0100 Subject: [PATCH 06/10] compse was easier than initialisaing an object manually get def from cpp needed to get from spline then vel due to f3d2 --- .../cReg/NiftiImageData3DDeformation.cpp | 17 +++++++++++------ src/Registration/cReg/NiftyResampler.cpp | 5 ++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Registration/cReg/NiftiImageData3DDeformation.cpp b/src/Registration/cReg/NiftiImageData3DDeformation.cpp index 9cbfe554e..a33807ef8 100644 --- a/src/Registration/cReg/NiftiImageData3DDeformation.cpp +++ b/src/Registration/cReg/NiftiImageData3DDeformation.cpp @@ -58,12 +58,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/NiftyResampler.cpp b/src/Registration/cReg/NiftyResampler.cpp index 7fbf6109d..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 */ @@ -118,11 +119,9 @@ void NiftyResampler::set_up() // If there are multiple transformations, compose them into single transformation. // Use the reference regardless of forward/adjoint. - if (this->_transformations.size() > 1) { - this->_deformation_sptr = std::make_shared >( + this->_deformation_sptr = std::make_shared >( NiftiImageData3DDeformation::compose_single_deformation( this->_transformations,*this->_reference_image_niftis.real())); - } this->_need_to_set_up = false; } From b374f9dbe5d3ef48dd8d92f39ed2b114bf6e13aa Mon Sep 17 00:00:00 2001 From: ALEXJAZZ008008 Date: Wed, 10 Nov 2021 05:31:55 +0000 Subject: [PATCH 07/10] added support for cpp and init from cpp --- .../cReg/NiftiImageData3DDeformation.cpp | 1 + src/Registration/cReg/NiftyF3dSym.cpp | 27 +++++++++++--- src/Registration/cReg/cReg.cpp | 36 +++++++++++++++++++ .../cReg/include/sirf/Reg/NiftyF3dSym.h | 12 +++++++ src/Registration/cReg/include/sirf/Reg/cReg.h | 5 +++ src/Registration/pReg/Reg.py | 36 +++++++++++++++++++ 6 files changed, 112 insertions(+), 5 deletions(-) diff --git a/src/Registration/cReg/NiftiImageData3DDeformation.cpp b/src/Registration/cReg/NiftiImageData3DDeformation.cpp index a33807ef8..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 */ diff --git a/src/Registration/cReg/NiftyF3dSym.cpp b/src/Registration/cReg/NiftyF3dSym.cpp index f98e0501a..98b06fdce 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 */ @@ -74,10 +75,20 @@ void NiftyF3dSym::process() // By default, use a padding value of 0 _registration_sptr->SetWarpedPaddingValue(0.f); - // 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); + nifti_image* init_cpp; + + // If there is an initial transformation matrix, set it + if (_initial_cpp_sptr) { + 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 @@ -124,7 +135,11 @@ void NiftyF3dSym::process() 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); @@ -140,6 +155,8 @@ void NiftyF3dSym::process() this->_warped_images.at(0) = this->_warped_images_nifti.at(0); std::cout << "\n\nRegistration finished!\n\n"; + + nifti_image_free(init_cpp); } template diff --git a/src/Registration/cReg/cReg.cpp b/src/Registration/cReg/cReg.cpp index 72ca958d3..81b458443 100644 --- a/src/Registration/cReg/cReg.cpp +++ b/src/Registration/cReg/cReg.cpp @@ -618,6 +618,18 @@ void* cReg_NiftiImageData3DDeformation_get_inverse(const void* def_ptr, const vo } CATCH; } +extern "C" +void* cReg_NiftiImageData3DDeformation_create_from_cpp(const void* cpp_ptr, const void* ref_ptr) +{ + try { + NiftiImageData3DTensor& cpp = objectFromHandle >(cpp_ptr); + const NiftiImageData& ref = objectFromHandle >(ref_ptr); + std::shared_ptr > def_sptr = std::make_shared >(ref); + def_sptr->create_from_cpp(cpp, ref); + return newObjectHandle(def_sptr); + } + CATCH; +} // -------------------------------------------------------------------------------- // // NiftiImageData3DDisplacement // -------------------------------------------------------------------------------- // @@ -751,6 +763,30 @@ 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(const void* ptr, const void* cpp_ptr) +{ + try { + NiftyF3dSym& reg = objectFromHandle>(ptr); + const NiftiImageData& cpp = objectFromHandle >(cpp_ptr); + std::shared_ptr > cpp_sptr = std::make_shared >(cpp); + reg.set_initial_cpp(cpp_sptr); + return new DataHandle; + } + 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 679947a64..9c79432cc 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; @@ -64,6 +65,7 @@ template class NiftyF3dSym : public NiftyRegistration { _floating_time_point = 1; _reference_time_point = 1; + this->_cpp_fwd_images.resize(1); } /// Process @@ -81,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 CPP + void set_initial_cpp(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; @@ -112,5 +120,9 @@ template class NiftyF3dSym : public NiftyRegistration 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..7cd5998a1 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* cpp_ptr, const void* def_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(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..a80d3c779 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,13 @@ def get_inverse(self, floating=None): self.handle, floating.handle) check_status(output.handle) return output + + def create_from_cpp(self, cpp): + """create from cpp""" + output.handle = pyreg.cReg_NiftiImageData3DDeformation_create_from_cpp( + cpp.handle, self.handle) + check_status(output.handle) + return output @staticmethod def compose_single_deformation(trans, ref): @@ -990,6 +1009,23 @@ def set_initial_affine_transformation(self, src): raise AssertionError() parms.set_parameter(self.handle, self.name, 'initial_affine_transformation', src.handle) + + def set_initial_cpp(self, cpp): + """Set initial affine transformation.""" + if not isinstance(cpp, NiftiImageData3DTensor): + raise AssertionError() + pyreg.\ + cReg_NiftyF3d2_set_initial_cpp( + self.handle, cpp) + + 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(): From befc3959fa10c1577cd3d63155ec711a7608802c Mon Sep 17 00:00:00 2001 From: ALEXJAZZ008008 Date: Wed, 10 Nov 2021 06:46:29 +0000 Subject: [PATCH 08/10] issue with def not initialised --- src/Registration/cReg/cReg.cpp | 5 +++-- src/Registration/cReg/include/sirf/Reg/cReg.h | 2 +- src/Registration/pReg/Reg.py | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Registration/cReg/cReg.cpp b/src/Registration/cReg/cReg.cpp index 81b458443..c7deb8c38 100644 --- a/src/Registration/cReg/cReg.cpp +++ b/src/Registration/cReg/cReg.cpp @@ -619,12 +619,13 @@ void* cReg_NiftiImageData3DDeformation_get_inverse(const void* def_ptr, const vo CATCH; } extern "C" -void* cReg_NiftiImageData3DDeformation_create_from_cpp(const void* cpp_ptr, const void* ref_ptr) +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); - std::shared_ptr > def_sptr = std::make_shared >(ref); def_sptr->create_from_cpp(cpp, ref); return newObjectHandle(def_sptr); } diff --git a/src/Registration/cReg/include/sirf/Reg/cReg.h b/src/Registration/cReg/include/sirf/Reg/cReg.h index 7cd5998a1..f3f75df9c 100644 --- a/src/Registration/cReg/include/sirf/Reg/cReg.h +++ b/src/Registration/cReg/include/sirf/Reg/cReg.h @@ -79,7 +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* cpp_ptr, const void* def_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); diff --git a/src/Registration/pReg/Reg.py b/src/Registration/pReg/Reg.py index a80d3c779..3ed0de100 100644 --- a/src/Registration/pReg/Reg.py +++ b/src/Registration/pReg/Reg.py @@ -744,10 +744,11 @@ def get_inverse(self, floating=None): check_status(output.handle) return output - def create_from_cpp(self, cpp): + def create_from_cpp(self, cpp, ref): """create from cpp""" + output = NiftiImageData3DDeformation() output.handle = pyreg.cReg_NiftiImageData3DDeformation_create_from_cpp( - cpp.handle, self.handle) + self.handle, cpp.handle, ref.handle) check_status(output.handle) return output From 81c848cfc3f37fff82e7b75e226d3c3d7d90dfe7 Mon Sep 17 00:00:00 2001 From: ALEXJAZZ008008 Date: Thu, 18 Nov 2021 14:06:00 +0000 Subject: [PATCH 09/10] moving to change f3d to use non 3d image --- requirements.txt | 8 +++ src/Registration/cReg/NiftyF3dSym.cpp | 25 +++++--- src/Registration/cReg/cReg.cpp | 13 ++-- .../cReg/include/sirf/Reg/NiftyF3dSym.h | 6 +- src/Registration/cReg/include/sirf/Reg/cReg.h | 2 +- src/Registration/pReg/Reg.py | 62 ++++++++++--------- 6 files changed, 67 insertions(+), 49 deletions(-) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..318ce67ed --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +numpy>=1.18.0 --only-binary=numpy +scipy --only-binary=scipy +matplotlib --only-binary=matplotlib +docopt +psutil +nose +deprecation +nibabel # optional diff --git a/src/Registration/cReg/NiftyF3dSym.cpp b/src/Registration/cReg/NiftyF3dSym.cpp index 98b06fdce..ecbcf5412 100644 --- a/src/Registration/cReg/NiftyF3dSym.cpp +++ b/src/Registration/cReg/NiftyF3dSym.cpp @@ -52,15 +52,15 @@ void NiftyF3dSym::process() NiftiImageData3D flo = *this->_floating_images_nifti.at(0); // Create the registration object - if(_use_symmetric) + if(_use_velocity) { - _registration_sptr = std::make_shared>(_reference_time_point, _floating_time_point); + _registration_sptr = std::make_shared>(_reference_time_point, _floating_time_point); } else { - if(_use_velocity) + if(_use_symmetric) { - _registration_sptr = std::make_shared>(_reference_time_point, _floating_time_point); + _registration_sptr = std::make_shared>(_reference_time_point, _floating_time_point); } else { @@ -75,10 +75,13 @@ void NiftyF3dSym::process() // By default, use a padding value of 0 _registration_sptr->SetWarpedPaddingValue(0.f); - nifti_image* init_cpp; + nifti_image* init_cpp = NULL; - // If there is an initial transformation matrix, set it - if (_initial_cpp_sptr) { + // If there is an initial transformation matrix, set it + 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); } @@ -132,7 +135,7 @@ 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); @@ -156,7 +159,11 @@ void NiftyF3dSym::process() std::cout << "\n\nRegistration finished!\n\n"; - nifti_image_free(init_cpp); + if(init_cpp != NULL) + { + delete init_cpp; + init_cpp = NULL; + } } template diff --git a/src/Registration/cReg/cReg.cpp b/src/Registration/cReg/cReg.cpp index c7deb8c38..e7e97894d 100644 --- a/src/Registration/cReg/cReg.cpp +++ b/src/Registration/cReg/cReg.cpp @@ -776,14 +776,15 @@ void* cReg_NiftyF3d2_get_cpp_image(const void* ptr, const int idx) CATCH; } extern "C" -void* cReg_NiftyF3d2_set_initial_cpp(const void* ptr, const void* cpp_ptr) +void* cReg_NiftyF3d2_set_initial_cpp_image(const void* reg_ptr, const void* cpp_ptr) { try { - NiftyF3dSym& reg = objectFromHandle>(ptr); - const NiftiImageData& cpp = objectFromHandle >(cpp_ptr); - std::shared_ptr > cpp_sptr = std::make_shared >(cpp); - reg.set_initial_cpp(cpp_sptr); - return new DataHandle; + 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; } diff --git a/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h b/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h index 9c79432cc..f5a1b20f9 100644 --- a/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h +++ b/src/Registration/cReg/include/sirf/Reg/NiftyF3dSym.h @@ -84,8 +84,8 @@ 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 CPP - void set_initial_cpp(const std::shared_ptr > cpp) { _initial_cpp_sptr = cpp; } + /// 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); } @@ -123,6 +123,6 @@ template class NiftyF3dSym : public NiftyRegistration /// Transformation matrix std::shared_ptr > _initial_cpp_sptr; /// CPP - std::vector > > _cpp_fwd_images; + 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 f3f75df9c..582219cff 100644 --- a/src/Registration/cReg/include/sirf/Reg/cReg.h +++ b/src/Registration/cReg/include/sirf/Reg/cReg.h @@ -100,7 +100,7 @@ extern "C" { //NiftyF3d2 void* cReg_NiftyF3d2_get_cpp_image(const void* ptr, const int idx); - void* cReg_NiftyF3d2_set_initial_cpp(const void* ptr, const void* cpp_ptr); + 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 3ed0de100..d555c4573 100644 --- a/src/Registration/pReg/Reg.py +++ b/src/Registration/pReg/Reg.py @@ -803,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.""" @@ -910,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. @@ -996,28 +996,30 @@ 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_cpp(self, cpp): - """Set initial affine transformation.""" + def set_initial_control_point_grid(self, cpp): + """Set initial control point grid.""" if not isinstance(cpp, NiftiImageData3DTensor): raise AssertionError() - pyreg.\ - cReg_NiftyF3d2_set_initial_cpp( - self.handle, cpp) + 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.""" @@ -1122,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. @@ -1134,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.""" @@ -1164,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. From 2e956d393c480f348b35af8e179d7e58cc6b857d Mon Sep 17 00:00:00 2001 From: ALEXJAZZ008008 Date: Tue, 1 Feb 2022 02:59:30 +0000 Subject: [PATCH 10/10] set reg weight was wrong --- src/Registration/cReg/NiftyF3dSym.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Registration/cReg/NiftyF3dSym.cpp b/src/Registration/cReg/NiftyF3dSym.cpp index ecbcf5412..516cdc979 100644 --- a/src/Registration/cReg/NiftyF3dSym.cpp +++ b/src/Registration/cReg/NiftyF3dSym.cpp @@ -306,12 +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)); _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(),"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(),"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)));