# Mapping a function onto image volume

**URL:** <https://discourse.slicer.org/t/mapping-a-function-onto-image-volume/2925>\
**Category:** Support\
**Created:** [May 25, 2018, 12:09am UTC](https://discourse.slicer.org/t/mapping-a-function-onto-image-volume/2925 "2018-05-25T00:09:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hamburgerfinger](https://avatars.discourse-cdn.com/v4/letter/h/eb9ed0/32.png) [@Hamburgerfinger](https://discourse.slicer.org/u/Hamburgerfinger)\
**Post date:** [May 25, 2018, 12:09am UTC](https://discourse.slicer.org/t/mapping-a-function-onto-image-volume/2925/1 "2018-05-25T00:09:17Z")

</div>

Is there an easy way to sample an analytical function in 3D space with Slicer? Say I want to represent a simple function like `f(r) = exp(-r)` as an image volume.

Thanks!

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 29, 2018, 3:53pm UTC](https://discourse.slicer.org/t/mapping-a-function-onto-image-volume/2925/2 "2018-05-29T15:53:27Z")

</div>

In case you didn’t already find it:

[https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python\_scripting#Accessing\_Volume\_data\_as\_numpy\_array](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting#Accessing_Volume_data_as_numpy_array)
