# Creating Volume from Numpy

**URL:** <https://discourse.slicer.org/t/creating-volume-from-numpy/658>\
**Category:** Support\
**Created:** [July 10, 2017, 1:03am UTC](https://discourse.slicer.org/t/creating-volume-from-numpy/658 "2017-07-10T01:03:12Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [July 10, 2017, 1:00pm UTC](https://discourse.slicer.org/t/creating-volume-from-numpy/658/2 "2017-07-10T13:00:59Z")

</div>

Hi Hailey -

If you are creating a new volume from scratch you need to create and initialize the vtkImageData as well as the vtkMRML nodes.

Here’s a fully worked out example in this [postNRRD](https://github.com/pieper/SlicerWeb/blob/2e222917b7767ebe42caf1d50722316205a58459/WebServer/WebServer.py#L929) method which starts from a nrrd file in memory but it should give you the info you need to adapt to your use case.

Here are the key steps:

> <https://github.com/pieper/SlicerWeb/blob/2e222917b7767ebe42caf1d50722316205a58459/WebServer/WebServer.py#L964-L966>

> <https://github.com/pieper/SlicerWeb/blob/2e222917b7767ebe42caf1d50722316205a58459/WebServer/WebServer.py#L988-L1003>

-Steve

---

_[View the full topic](https://discourse.slicer.org/t/creating-volume-from-numpy/658)._
