# Resample Image

**URL:** <https://discourse.itk.org/t/resample-image/820>\
**Category:** Uncategorized\
**Created:** [April 2, 2018, 7:18pm UTC](https://discourse.itk.org/t/resample-image/820 "2018-04-02T19:18:50Z")\
**Posts on this page:** 3\
**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 2, 2018, 7:18pm UTC](https://discourse.itk.org/t/resample-image/820/1 "2018-04-02T19:18:51Z")

</div>

I have a data set of 2d images. I want to resample it with given space value. like spacing with 1.2 or 1.5.  
Most of the itk resampling examples are based on given image size. Which example works like that?

---

<div class="post-metadata">

**Author:** ![fbudin](https://discourse.itk.org/user_avatar/discourse.itk.org/fbudin/32/14_2.png) [@fbudin](https://discourse.itk.org/u/fbudin)\
**Post date:** [April 2, 2018, 8:02pm UTC](https://discourse.itk.org/t/resample-image/820/2 "2018-04-02T20:02:45Z")

</div>

I wrote a small command line tool a few years ago that allows to deal with ITK transform. Part of the tool does exactly what you are talking about. You can look at the source code [here](https://github.com/fbudin69500/ITKTransformTools/blob/master/GetNewSizeAndOrigin.cxx#L235). Sorry about the lack of comments and documentation in the code…

---

<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:38pm UTC](https://discourse.itk.org/t/resample-image/820/3 "2018-04-06T17:38:38Z")

</div>

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 ?
