diff --git a/data/tcia_aaac_t1ce_transform.mat b/data/tcia_aaac_t1ce_transform.mat new file mode 100644 index 0000000..7364528 Binary files /dev/null and b/data/tcia_aaac_t1ce_transform.mat differ diff --git a/unit_tests/test_full.py b/unit_tests/test_full.py index b107077..30e7054 100644 --- a/unit_tests/test_full.py +++ b/unit_tests/test_full.py @@ -92,6 +92,7 @@ def test_registration_function(): transform_file = os.path.join(temp_output_dir, "tcia_aaac_t1ce_transform.mat") log_file = os.path.join(temp_output_dir, "tcia_aaac_t1ce_registration.log") test_config = {"initialization": "moments", "bias": True} + registration_function( target_image=atlas_sri, moving_image=moving_image, @@ -100,7 +101,27 @@ def test_registration_function(): transform_file=transform_file, log_file=log_file, ) + _image_sanity_check(atlas_sri, output_image) + assert os.path.exists(transform_file), "Transform file not created." + assert os.path.exists(log_file), "Log file not created." + + # cleanup + for file_to_delete in [output_image, transform_file, log_file]: + os.remove(file_to_delete) + +def test_resample_function(): + cwd = Path.cwd() + test_data_dir = (cwd / "data").absolute().as_posix() + atlas_data_dir = (cwd / "atlases").absolute().as_posix() + moving_image = os.path.join(test_data_dir, "tcia_aaac_t1ce.nii.gz") + temp_output_dir = tempfile.gettempdir() + output_image = os.path.join(temp_output_dir, "tcia_aaac_t1ce_registered.nii.gz") + atlas_sri = os.path.join(atlas_data_dir, "sri24", "image.nii.gz") + transform_file = os.path.join(test_data_dir, "tcia_aaac_t1ce_transform.mat") + log_file = os.path.join(temp_output_dir, "tcia_aaac_t1ce_transformation.log") + test_config = {"initialization": "moments", "bias": True} + resample_function( target_image=atlas_sri, moving_image=moving_image, @@ -110,12 +131,12 @@ def test_registration_function(): log_file=log_file, ) _image_sanity_check(atlas_sri, output_image) - assert os.path.exists(transform_file), "Transform file not created." assert os.path.exists(log_file), "Log file not created." for file_to_delete in [output_image, transform_file, log_file]: os.remove(file_to_delete) + def test_bias(): cwd = Path.cwd() test_data_dir = (cwd / "data").absolute().as_posix()