Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ANTsX/ANTsPy
Browse files Browse the repository at this point in the history
...
  • Loading branch information
stnava committed Jul 8, 2019
2 parents 3d24aac + 41ed8d0 commit c3986e2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ants/registration/build_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ def build_template(
>>> image3 = ants.image_read( ants.get_ants_data('r85') , 'float')
>>> timage = ants.build_template( image_list = ( image, image2, image3 ) )
"""
if 'type_of_transform' not in kwargs:
type_of_transform = 'SyN'
else:
type_of_transform = kwargs.pop('type_of_transform')

wt = 1.0 / len( image_list )
if initial_template is None:
initial_template = image_list[ 0 ] * 0
Expand All @@ -60,7 +65,7 @@ def build_template(
for i in range( iterations ):
for k in range( len( image_list ) ):
w1 = registration( xavg, image_list[k],
type_of_transform='SyN', **kwargs )
type_of_transform=type_of_transform, **kwargs )
if k == 0:
wavg = iio.image_read( w1['fwdtransforms'][0] ) * wt
xavgNew = w1['warpedmovout'] * wt
Expand Down
9 changes: 9 additions & 0 deletions tests/test_registation.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def test_example(self):
image = ants.image_read(ants.get_ants_data('r16'))
simage = ants.symmetrize_image(image)


class TestModule_build_template(unittest.TestCase):

def setUp(self):
Expand All @@ -275,6 +276,14 @@ def test_example(self):
image2 = ants.image_read(ants.get_ants_data('r27'))
timage = ants.build_template( image_list = (image, image2 ) )

def test_type_of_transform(self):
image = ants.image_read(ants.get_ants_data('r16'))
image2 = ants.image_read(ants.get_ants_data('r27'))
timage = ants.build_template( image_list = (image, image2 ))
timage = ants.build_template( image_list = (image, image2 ),
type_of_transform='SyNCC')


class TestModule_multivar(unittest.TestCase):

def setUp(self):
Expand Down

0 comments on commit c3986e2

Please sign in to comment.