# question about metric setter

**URL:** <https://discourse.itk.org/t/question-about-metric-setter/3251>\
**Category:** Engineering\
**Created:** [July 2, 2020, 10:51am UTC](https://discourse.itk.org/t/question-about-metric-setter/3251 "2020-07-02T10:51:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierrectl](https://discourse.itk.org/user_avatar/discourse.itk.org/pierrectl/32/1420_2.png) [@pierrectl](https://discourse.itk.org/u/pierrectl)\
**Post date:** [July 2, 2020, 10:51am UTC](https://discourse.itk.org/t/question-about-metric-setter/3251/1 "2020-07-02T10:51:39Z")

</div>

Hi everyone,  
I went through itkMeanSquaresImageToImageMetric.hxx file, and I was wondering what is the effect of changing this-\>SetUseAllPixels(true) to this-\>SetUseAllPixels(false)?

> <https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.hxx#L44>

  
Thank you in advance for your reply!

---

<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:** [July 2, 2020, 2:28pm UTC](https://discourse.itk.org/t/question-about-metric-setter/3251/2 "2020-07-02T14:28:14Z")

</div>

It probably controls whether to evaluate the metric on all the pixels or just the selected subset (which is usually faster).

---

<div class="post-metadata">

**Author:** ![pierrectl](https://discourse.itk.org/user_avatar/discourse.itk.org/pierrectl/32/1420_2.png) [@pierrectl](https://discourse.itk.org/u/pierrectl)\
**Post date:** [July 2, 2020, 2:47pm UTC](https://discourse.itk.org/t/question-about-metric-setter/3251/3 "2020-07-02T14:47:29Z")

</div>

ok thank you. So how does this “selected subset” work? I mean, it divides the whole image in a few parts? And how many parts? And what is the shape of these parts? A cube?

---

<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:** [July 2, 2020, 3:15pm UTC](https://discourse.itk.org/t/question-about-metric-setter/3251/4 "2020-07-02T15:15:54Z")

</div>

Usually randomly sampled. See this [discussion](https://discourse.itk.org/t/sampling-strategy-in-imageregistrationmethodv4/1038).

---

<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:** [July 2, 2020, 4:11pm UTC](https://discourse.itk.org/t/question-about-metric-setter/3251/5 "2020-07-02T16:11:50Z")

</div>

> [@pierrectl](#):
>
> ok thank you. So how does this “selected subset” work? I mean, it divides the whole image in a few parts? And how many parts? And what is the shape of these parts? A cube?

You are looking at an ITKv3 registration metric. The discussion @dzenanz linked too was for the ITKv4 registration framework. All that I recall about the ITKv3 sampling is that the point set changed each iteration, but I haven’t looked at that code for a very long time!

---

<div class="post-metadata">

**Author:** ![pierrectl](https://discourse.itk.org/user_avatar/discourse.itk.org/pierrectl/32/1420_2.png) [@pierrectl](https://discourse.itk.org/u/pierrectl)\
**Post date:** [July 3, 2020, 6:42am UTC](https://discourse.itk.org/t/question-about-metric-setter/3251/6 "2020-07-03T06:42:49Z")

</div>

ok, thanks to both of you.

> [@blowekamp](#):
>
> You are looking at an ITKv3 registration metric.

Is there any difference between using the metric v3 or metric v4 regarding registration performance? Actually, I thought I was using v5 of this metric…
