From 19aea8d7f5f33bef5d3031f5516bbb642eea1c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Thu, 19 Sep 2024 16:26:02 -0400 Subject: [PATCH] ENH: Add ANTsPy analog for Faces example --- Faces/templateCommand.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Faces/templateCommand.py diff --git a/Faces/templateCommand.py b/Faces/templateCommand.py new file mode 100644 index 0000000..646baa7 --- /dev/null +++ b/Faces/templateCommand.py @@ -0,0 +1,23 @@ +import ants +import os +import glob + +dataDirectory = './' +populationFiles = glob.glob( dataDirectory + "face*.nii.gz" ) + +population = list() +for i in range( len( populationFiles ) ): + population.append( ants.image_read( populationFiles[i], dimension = 2 ) ) + +btp = ants.build_template( initialTemplate = None, + image_list = population, + iterations = 4, + gradient_step = 0.15, + verbose = False, + syn_metric = 'CC', + reg_iterations = ( 100, 100, 100, 70, 50, 10 ), + type_of_transform = "SyNCC", + ) + +ants.image_write( btp, "templatePy.nrrd" ) +ants.plot( btp )