Example #1
0
def test_inv_trsf():
    #--- inverse transformation
    trsf_inp, trsf_ref  = BalTransformation(), BalTransformation()
    trsf_inp.read(trsf_arbitrary_path) #--- trsf_1
    trsf_ref.read(inv_trsf_ref_path) #--- inv(trsf_1)
    trsf_out = inv_trsf(trsf_inp)
    ref, out = trsf_ref.mat.to_np_array(), trsf_out.mat.to_np_array()
    np.testing.assert_array_almost_equal(ref, out, decimal=8)
    trsf_inp.free()
    trsf_ref.free()
    trsf_out.free()
Example #2
0
def test_inv_trsf():
    #--- inverse transformation
    trsf_inp, trsf_ref = BalTransformation(), BalTransformation()
    trsf_inp.read(trsf_arbitrary_path)  #--- trsf_1
    trsf_ref.read(inv_trsf_ref_path)  #--- inv(trsf_1)
    trsf_out = inv_trsf(trsf_inp)
    ref, out = trsf_ref.mat.to_np_array(), trsf_out.mat.to_np_array()
    np.testing.assert_array_almost_equal(ref, out, decimal=8)
    trsf_inp.free()
    trsf_ref.free()
    trsf_out.free()
 def test_plugin_deformable(self):
     #--- deformable registration
     floating_img = imread(data_path('time_0_cut.inr'))
     reference_img = imread(data_path('time_1_cut.inr'))
     deformable_trsf = data_path("deformable_0_1.trsf")
     trsf_inp = BalTransformation()
     trsf_inp.read(deformable_trsf)
     trsf_out, res = registration(floating_img, reference_img, method='deformable_registration')
     np.testing.assert_array_almost_equal(trsf_out.mat.to_np_array(), trsf_inp.mat.to_np_array(), decimal=6)
     trsf_out.free()
     trsf_inp.free()
     return
        def test_blockmatching_rigid(self):
            #--- rigid registration
            floating_img = imread(data_path('time_0_cut.inr'))
            reference_img = imread(data_path('time_1_cut.inr'))
            rigid_trsf = data_path("rigid_0_1.trsf")

            trsf_out, res = blockmatching(floating_img, reference_img)
            trsf_inp = BalTransformation()
            trsf_inp.read(rigid_trsf)
            np.testing.assert_array_almost_equal(trsf_out.mat.to_np_array(), trsf_inp.mat.to_np_array(), decimal=6)
            trsf_out.free()
            trsf_inp.free()
            return
Example #5
0
        def test_blockmatching_rigid(self):
            #--- rigid registration
            floating_img = imread(data_path('time_0_cut.inr'))
            reference_img = imread(data_path('time_1_cut.inr'))
            rigid_trsf = data_path("rigid_0_1.trsf")

            trsf_out, res = blockmatching(floating_img, reference_img)
            trsf_inp = BalTransformation()
            trsf_inp.read(rigid_trsf)
            np.testing.assert_array_almost_equal(trsf_out.mat.to_np_array(),
                                                 trsf_inp.mat.to_np_array(),
                                                 decimal=6)
            trsf_out.free()
            trsf_inp.free()
            return
Example #6
0
 def test_plugin_deformable(self):
     #--- deformable registration
     floating_img = imread(data_path('time_0_cut.inr'))
     reference_img = imread(data_path('time_1_cut.inr'))
     deformable_trsf = data_path("deformable_0_1.trsf")
     trsf_inp = BalTransformation()
     trsf_inp.read(deformable_trsf)
     trsf_out, res = registration(floating_img,
                                  reference_img,
                                  method='deformable_registration')
     np.testing.assert_array_almost_equal(trsf_out.mat.to_np_array(),
                                          trsf_inp.mat.to_np_array(),
                                          decimal=6)
     trsf_out.free()
     trsf_inp.free()
     return
 def test_blockmatching_deformable(self):
     #--- deformable registration
     floating_img = imread(data_path('time_0_cut.inr'))
     reference_img = imread(data_path('time_1_cut.inr'))
     rigid_trsf = data_path("rigid_0_1.trsf")
     deformable_trsf = data_path("deformable_0_1.trsf")
     init_result_transformation = BalTransformation()
     init_result_transformation.read(rigid_trsf)
     param_str_2 = '-trsf-type vectorfield'
     trsf_out, res = blockmatching(floating_img, reference_img,
                                   init_result_transformation=init_result_transformation,
                                   left_transformation=None,
                                   param_str_2=param_str_2)
     trsf_inp = BalTransformation()
     trsf_inp.read(deformable_trsf)
     np.testing.assert_array_almost_equal(trsf_out.mat.to_np_array(), trsf_inp.mat.to_np_array(), decimal=6)
     trsf_out.free()
     trsf_inp.free()
     return
Example #8
0
 def test_blockmatching_deformable(self):
     #--- deformable registration
     floating_img = imread(data_path('time_0_cut.inr'))
     reference_img = imread(data_path('time_1_cut.inr'))
     rigid_trsf = data_path("rigid_0_1.trsf")
     deformable_trsf = data_path("deformable_0_1.trsf")
     init_result_transformation = BalTransformation()
     init_result_transformation.read(rigid_trsf)
     param_str_2 = '-trsf-type vectorfield'
     trsf_out, res = blockmatching(
         floating_img,
         reference_img,
         init_result_transformation=init_result_transformation,
         left_transformation=None,
         param_str_2=param_str_2)
     trsf_inp = BalTransformation()
     trsf_inp.read(deformable_trsf)
     np.testing.assert_array_almost_equal(trsf_out.mat.to_np_array(),
                                          trsf_inp.mat.to_np_array(),
                                          decimal=6)
     trsf_out.free()
     trsf_inp.free()
     return