diff --git a/brainglobe_registration/elastix/register.py b/brainglobe_registration/elastix/register.py index 51e0fab..f38f3ff 100644 --- a/brainglobe_registration/elastix/register.py +++ b/brainglobe_registration/elastix/register.py @@ -115,10 +115,17 @@ def run_registration( )[..., ::-1] if output_directory: - # Remove the deformationField.tiff file generated by elastix - os.unlink(output_directory / "deformationField.tiff") + working_directory = output_directory else: - os.unlink("deformationField.tiff") + working_directory = Path.cwd() + + # Cleanup files generated by elastix + os.remove(working_directory / "deformationField.tiff") + for i in range(len(parameter_lists)): + try: + os.remove(working_directory / f"result.{i}.tiff") + except FileNotFoundError: + continue return ( np.asarray(result_image), diff --git a/brainglobe_registration/parameters/ara_tools/affine.txt b/brainglobe_registration/parameters/ara_tools/affine.txt index cabe450..b6f281e 100644 --- a/brainglobe_registration/parameters/ara_tools/affine.txt +++ b/brainglobe_registration/parameters/ara_tools/affine.txt @@ -4,9 +4,9 @@ //ImageTypes (FixedInternalImagePixelType "float") -(FixedImageDimension 3) +(FixedImageDimension 2) (MovingInternalImagePixelType "float") -(MovingImageDimension 3) +(MovingImageDimension 2) //Components (Registration "MultiResolutionRegistration") diff --git a/brainglobe_registration/parameters/ara_tools/bspline.txt b/brainglobe_registration/parameters/ara_tools/bspline.txt index e87a225..a7a51f9 100644 --- a/brainglobe_registration/parameters/ara_tools/bspline.txt +++ b/brainglobe_registration/parameters/ara_tools/bspline.txt @@ -2,9 +2,9 @@ //ImageTypes (FixedInternalImagePixelType "float") -(FixedImageDimension 3) +(FixedImageDimension 2) (MovingInternalImagePixelType "float") -(MovingImageDimension 3) +(MovingImageDimension 2) //Components (Registration "MultiResolutionRegistration") diff --git a/brainglobe_registration/parameters/elastix_default/affine.txt b/brainglobe_registration/parameters/elastix_default/affine.txt index f53b17b..dfd5765 100644 --- a/brainglobe_registration/parameters/elastix_default/affine.txt +++ b/brainglobe_registration/parameters/elastix_default/affine.txt @@ -21,4 +21,4 @@ (ResultImageFormat "tiff") (Transform "AffineTransform") (WriteIterationInfo "false") -(WriteResultImage "false") +(WriteResultImage "true") diff --git a/brainglobe_registration/parameters/elastix_default/bspline.txt b/brainglobe_registration/parameters/elastix_default/bspline.txt index 6e2d6d7..16b7736 100644 --- a/brainglobe_registration/parameters/elastix_default/bspline.txt +++ b/brainglobe_registration/parameters/elastix_default/bspline.txt @@ -24,4 +24,4 @@ (ResultImageFormat "tiff") (Transform "BSplineTransform") (WriteIterationInfo "false") -(WriteResultImage "false") +(WriteResultImage "true") diff --git a/brainglobe_registration/parameters/elastix_default/rigid.txt b/brainglobe_registration/parameters/elastix_default/rigid.txt index 9213652..5339da1 100644 --- a/brainglobe_registration/parameters/elastix_default/rigid.txt +++ b/brainglobe_registration/parameters/elastix_default/rigid.txt @@ -21,4 +21,4 @@ (ResultImageFormat "tiff") (Transform "EulerTransform") (WriteIterationInfo "false") -(WriteResultImage "false") +(WriteResultImage "true")