# Source code of resample function

**URL:** https://discourse.itk.org/t/source-code-of-resample-function/5047
**Category:** Beginner Questions
**Tags:** simpleitk
**Created:** [June 3, 2022, 11:46am UTC](https://discourse.itk.org/t/source-code-of-resample-function/5047 "2022-06-03T11:46:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![debapriya](https://discourse.itk.org/letter_avatar_proxy/v4/letter/d/bc79bd/32.png) [@debapriya](https://discourse.itk.org/u/debapriya)
#### Post date: [June 3, 2022, 11:46am UTC](https://discourse.itk.org/t/source-code-of-resample-function/5047/1 "2022-06-03T11:46:30Z")

</div>

Hello,

Is the source code of sitk.Resample available publicly? If yes, can someone please mention the path to the source code?

---

<div class="post-metadata">

### Author: ![zivy](https://discourse.itk.org/user_avatar/discourse.itk.org/zivy/32/1726_2.png) [@zivy](https://discourse.itk.org/u/zivy)
#### Post date: [June 3, 2022, 3:22pm UTC](https://discourse.itk.org/t/source-code-of-resample-function/5047/4 "2022-06-03T15:22:32Z")

</div>

Hello @debapriya,

The SimpleITK code for the `Resample` function is [here](https://github.com/SimpleITK/SimpleITK/blob/aff11ddc90bde4cc1669bb54a60dec52d50c0507/Code/BasicFilters/src/sitkAdditionalProcedures.cxx#L33-L91). It is only a wrapper of the ITK code which actually does the work. The ITK code is [here](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/ImageGrid/include/itkResampleImageFilter.hxx) (it is not an easy read as the code is templated, deals with n-dimensional images and requires familiarity with ITK components and concepts).

---

<div class="post-metadata">

### Author: ![debapriya](https://discourse.itk.org/letter_avatar_proxy/v4/letter/d/bc79bd/32.png) [@debapriya](https://discourse.itk.org/u/debapriya)
#### Post date: [June 3, 2022, 4:10pm UTC](https://discourse.itk.org/t/source-code-of-resample-function/5047/5 "2022-06-03T16:10:33Z")

</div>

Thank you so much!!  
I browsed through the code. It is difficult for a beginner. Are there any documentation or explanation of the code available?

---

<div class="post-metadata">

### Author: ![mauigna06](https://discourse.itk.org/letter_avatar_proxy/v4/letter/m/ccd318/32.png) [@mauigna06](https://discourse.itk.org/u/mauigna06)
#### Post date: [June 6, 2022, 8:35am UTC](https://discourse.itk.org/t/source-code-of-resample-function/5047/6 "2022-06-06T08:35:02Z")

</div>

You could try to get an example working on simplefilters first, or you could try to prune the current itk algorithm till it’s simple enough and works for you
