Skip to content

Commit

Permalink
separate registration and transform test
Browse files Browse the repository at this point in the history
Signed-off-by: neuronflow <[email protected]>
  • Loading branch information
neuronflow committed Apr 4, 2024
1 parent ffef980 commit c5db080
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Binary file added data/tcia_aaac_t1ce_transform.mat
Binary file not shown.
23 changes: 22 additions & 1 deletion unit_tests/test_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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()
Expand Down

0 comments on commit c5db080

Please sign in to comment.