ants.math.averaging
Functions
|
average a list of images |
- average_images(x, normalize=True, mask=None, imagetype=0, sum_image_threshold=3, return_sum_image=False, verbose=False)[source]
average a list of images
images will be resampled automatically to the largest image space; this is not a registration so images should be in the same physical space to begin with.
x : a list containing either filenames or antsImages
normalize : boolean
- maskNone or integer; this will perform a masked averaging which can
be useful when images have only partial coverage. integer greater than zero will perform morphological closing.
- imagetypeinteger
choose 0/1/2/3 mapping to scalar/vector/tensor/time-series
- sum_image_thresholdinteger
only average regions with overlap greater than or equal to this value
- return_sum_imageboolean
returns the average and the image that show ROI overlap; primarily for debugging
- verboseboolean
will print progress
- Return type:
ants.core.ANTsImage
Example
>>> import ants >>> x0=[ ants.get_data('r16'), ants.get_data('r27'), ants.get_data('r62'), ants.get_data('r64') ] >>> x1=[] >>> for k in range(len(x0)): >>> x1.append( ants.image_read( x0[k] ) ) >>> avg=ants.average_images(x0) >>> avg1=ants.average_images(x1) >>> avg2=ants.average_images(x1,mask=0) >>> avg3=ants.average_images(x1,mask=1,normalize=True)