Skip to content

Commit

Permalink
ENH: Make double precision the default
Browse files Browse the repository at this point in the history
  • Loading branch information
cookpa committed Mar 21, 2024
1 parent 0353a28 commit ec7a9c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions ants/registration/apply_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def apply_transforms(fixed, moving, transformlist,
interpolator='linear', imagetype=0,
whichtoinvert=None, compose=None,
defaultvalue=0, singleprecision=True, verbose=False, **kwargs):
defaultvalue=0, singleprecision=False, verbose=False, **kwargs):
"""
Apply a transform list to map an image from one domain to another.
In image registration, one computes mappings between (usually) pairs
Expand Down Expand Up @@ -68,9 +68,8 @@ def apply_transforms(fixed, moving, transformlist,
Default voxel value for mappings outside the image domain.
singleprecision : boolean
if True, use float32 for computations and output data storage type. This reduces
memory storage and computational time for large images, but may result in a loss
of precision. Set to False to use double precision.
if True, use float32 for computations. This is useful for reducing memory
usage for large datasets, at the cost of precision.
verbose : boolean
print command and run verbose application of transform.
Expand Down
4 changes: 2 additions & 2 deletions tests/test_registation.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def test_example(self):
self.assertTrue(ants.ants_image.image_physical_space_consistency(fixed, mywarpedimage,
0.0001, datatype = False))

# Call with double precision for transforms, but should still return input type
# Call with float precision for transforms, but should still return input type
mywarpedimage2 = ants.apply_transforms(
fixed=fixed, moving=moving, transformlist=mytx["fwdtransforms"], singleprecision=False
fixed=fixed, moving=moving, transformlist=mytx["fwdtransforms"], singleprecision=True
)
self.assertEqual(mywarpedimage2.pixeltype, moving.pixeltype)
self.assertAlmostEqual(mywarpedimage.sum(), mywarpedimage2.sum(), places=3)
Expand Down

0 comments on commit ec7a9c8

Please sign in to comment.