# Can the spatial domain of the sampling point set be specified for registration?

**URL:** <https://discourse.itk.org/t/can-the-spatial-domain-of-the-sampling-point-set-be-specified-for-registration/3610>\
**Category:** Algorithms\
**Created:** [November 12, 2020, 9:04pm UTC](https://discourse.itk.org/t/can-the-spatial-domain-of-the-sampling-point-set-be-specified-for-registration/3610 "2020-11-12T21:04:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![spencermanwell](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/eada6e/32.png) [@spencermanwell](https://discourse.itk.org/u/spencermanwell)\
**Post date:** [November 12, 2020, 9:04pm UTC](https://discourse.itk.org/t/can-the-spatial-domain-of-the-sampling-point-set-be-specified-for-registration/3610/1 "2020-11-12T21:04:19Z")

</div>

Hi there,

I am looking at registration of whole-body CT image volumes, repeat scans of the same individual over several month span. My primary concern is efficiency, secondary concern is accuracy and so I am tuning carefully to makes sure the registration workflow is fast. Not surprisingly, I am having a really hard time tuning the registration (just rigid transformation) to consistently converge on a reasonable solution.

These images contain a lot of air outside of the body and I am concerned that the alignment of air regions creates a lot of local minima in the parameter space in which the optimizer is getting stuck.

I am curious about whether imposing limits of the point sample space to more closely align with the limits of the body contour will help constrain the optimization. Is there ITK API that supports setting limits on the sampling point set domain that is used to determine the similarity metric (Mattes MI) at each iteration? If not I suppose I could also trim the image volume prior to registration, but the former seems like a nicer option to me.

Any feedback/discussion would be much appreciated.

Thanks,  
Spencer

---

<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:** [November 12, 2020, 9:49pm UTC](https://discourse.itk.org/t/can-the-spatial-domain-of-the-sampling-point-set-be-specified-for-registration/3610/2 "2020-11-12T21:49:34Z")

</div>

Setting the image masks might work for your case. Look at metric’s [SetMovingImageMask()](https://itk.org/Doxygen/html/classitk_1_1ImageToImageMetric.html#ad1ea9c7f8c965fed73f5ddb107ff138d) and friends.

---

<div class="post-metadata">

**Author:** ![spencermanwell](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/eada6e/32.png) [@spencermanwell](https://discourse.itk.org/u/spencermanwell)\
**Post date:** [November 13, 2020, 2:51pm UTC](https://discourse.itk.org/t/can-the-spatial-domain-of-the-sampling-point-set-be-specified-for-registration/3610/3 "2020-11-13T14:51:10Z")

</div>

Thanks for your reply, it does seem like that would be useful.

Can you comment on the difference between the SetFixed(Moving)ImageRegion() and SetFixed(Moving)ImageMask()?

I am not sure yet about how the masks will be generated, but if they’re more simple volume constraints, say limits on x, y, and z. I’d like to make to use of the most simple option.

Thank you.

Spencer

---

<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:** [November 13, 2020, 3:05pm UTC](https://discourse.itk.org/t/can-the-spatial-domain-of-the-sampling-point-set-be-specified-for-registration/3610/4 "2020-11-13T15:05:49Z")

</div>

Region gives you the option of limits on IJK (which corresponds to XYZ in case of identity direction). Mask can be arbitrarily shaped, and are usually derived by segmenting out the air from CT images.

---

<div class="post-metadata">

**Author:** ![spencermanwell](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/eada6e/32.png) [@spencermanwell](https://discourse.itk.org/u/spencermanwell)\
**Post date:** [November 13, 2020, 3:46pm UTC](https://discourse.itk.org/t/can-the-spatial-domain-of-the-sampling-point-set-be-specified-for-registration/3610/5 "2020-11-13T15:46:11Z")

</div>

Hi Dženan,

That’s very helpful information, thank you very much.

Best,  
Spencer

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [November 13, 2020, 8:01pm UTC](https://discourse.itk.org/t/can-the-spatial-domain-of-the-sampling-point-set-be-specified-for-registration/3610/6 "2020-11-13T20:01:42Z")

</div>

> [@spencermanwell](#):
>
> I am not sure yet about how the masks will be generated, but if they’re more simple volume constraints, say limits on x, y, and z. I’d like to make to use of the most simple option.

You can crop the fixed image, the moving image, and/or the virtual domain. Cropping the virtual domain ( which defaults to the fixed image) may be the most efficient as it is the domain used to generate the sample points.
