# Difference between numberofFixedImageSamples and numberofSpatialSamples

**URL:** <https://discourse.itk.org/t/difference-between-numberoffixedimagesamples-and-numberofspatialsamples/4431>\
**Category:** Algorithms\
**Tags:** mutual-information, registration\
**Created:** [September 19, 2021, 1:46pm UTC](https://discourse.itk.org/t/difference-between-numberoffixedimagesamples-and-numberofspatialsamples/4431 "2021-09-19T13:46:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![c.spanakis83](https://discourse.itk.org/user_avatar/discourse.itk.org/c.spanakis83/32/737_2.png) [@c.spanakis83](https://discourse.itk.org/u/c.spanakis83)\
**Post date:** [September 19, 2021, 1:46pm UTC](https://discourse.itk.org/t/difference-between-numberoffixedimagesamples-and-numberofspatialsamples/4431/1 "2021-09-19T13:46:49Z")

</div>

Hello I want to use Mutual Information (specifically Mattes’ Mutual Information) in order to align 2 medical images. However, I found that it has two methods:

SetNumberofFixedImageSamples (unsigned int num)  
SetNumberofSpatialSamples (unsigned int num)

What is the difference between Spatial Sample and Fixed Image Sample and how do the above methods affect the calculation of Mutual Information?

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [September 20, 2021, 1:26pm UTC](https://discourse.itk.org/t/difference-between-numberoffixedimagesamples-and-numberofspatialsamples/4431/2 "2021-09-20T13:26:58Z")

</div>

They are the same, one delegates to the other:

> <https://github.com/InsightSoftwareConsortium/ITK/blob/9961ccd672cb67ab2128390a49748104eb4459b6/Modules/Registration/Common/include/itkImageToImageMetric.h#L237-L247>
