# How pixel position changes after sampling ?

**URL:** <https://discourse.itk.org/t/how-pixel-position-changes-after-sampling/829>\
**Category:** Uncategorized\
**Created:** [April 6, 2018, 5:39pm UTC](https://discourse.itk.org/t/how-pixel-position-changes-after-sampling/829 "2018-04-06T17:39:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![srbn.ghosh89](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@srbn.ghosh89](https://discourse.itk.org/u/srbn.ghosh89)\
**Post date:** [April 6, 2018, 5:39pm UTC](https://discourse.itk.org/t/how-pixel-position-changes-after-sampling/829/1 "2018-04-06T17:39:16Z")

</div>

1m  
Lets suppose, I have a 2D image of spacing value 1.0 with dimension of 512x546.  
for this image i have a pixel value of 255 in position (218,141)

after doing a sampling on the 2D image with spacing 1.5 , the dimension becomes 341x364.  
Now what will the position of the same pixel value of 255 ?

---

<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:** [April 6, 2018, 6:11pm UTC](https://discourse.itk.org/t/how-pixel-position-changes-after-sampling/829/2 "2018-04-06T18:11:22Z")

</div>

The documentation should be helpful:  
[https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch4.html#x38-490004.1](https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch4.html#x38-490004.1)  
[https://itk.org/ITKSoftwareGuide/html/Book2/ITKSoftwareGuide-Book2ch2.html#x17-800002.9](https://itk.org/ITKSoftwareGuide/html/Book2/ITKSoftwareGuide-Book2ch2.html#x17-800002.9)

---

<div class="post-metadata">

**Author:** ![srbn.ghosh89](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/3ec8ea/32.png) [@srbn.ghosh89](https://discourse.itk.org/u/srbn.ghosh89)\
**Post date:** [April 6, 2018, 6:55pm UTC](https://discourse.itk.org/t/how-pixel-position-changes-after-sampling/829/3 "2018-04-06T18:55:12Z")

</div>

In this links, they calculated using their origin value. In my case, my origin value after sampling is also {0,0}. In that case, how to calculate it?

---

<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:** [April 6, 2018, 10:22pm UTC](https://discourse.itk.org/t/how-pixel-position-changes-after-sampling/829/4 "2018-04-06T22:22:47Z")

</div>

Origin = `[0,0]` is a trivial case, which requires even less computation than the case of origin different from `[0,0]`. Just use 0 instead of examples’ value of origin.
