# Can I convert this arrays in slicer?

**URL:** <https://discourse.slicer.org/t/can-i-convert-this-arrays-in-slicer/11174>\
**Category:** Support\
**Created:** [April 18, 2020, 1:02pm UTC](https://discourse.slicer.org/t/can-i-convert-this-arrays-in-slicer/11174 "2020-04-18T13:02:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [April 18, 2020, 1:02pm UTC](https://discourse.slicer.org/t/can-i-convert-this-arrays-in-slicer/11174/1 "2020-04-18T13:02:13Z")

</div>

## I want to creat a volume by and I need convert the data of ‘bb’ to ‘a’ in slicer quickly.

bb

> array([[[[70, 95, 109],  
> [72, 97, 112],  
> [71, 96, 110],  
> …,  
> [30, 35, 42],  
> [28, 36, 40],  
> [27, 35, 39]]]], dtype=uint8)

bb.shape

> (1L, 480L, 640L, 3L)

this is my finally data ‘a’

a.shape

> (1L, 480L, 640L, 3L)

a

> array([[[[109, 95, 70],  
> [112, 97, 72],  
> [110, 96, 71],  
> …,  
> [42, 35, 30],  
> [40, 36, 28],  
> [39, 35, 27]]]], dtype=uint8

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 18, 2020, 2:01pm UTC](https://discourse.slicer.org/t/can-i-convert-this-arrays-in-slicer/11174/3 "2020-04-18T14:01:36Z")

</div>

You can set content of a numpy array into a volume node by calling [`slicer.util.updateVolumeFromArray`](https://slicer.readthedocs.io/en/latest/developer_guide/slicer.html#slicer.util.updateVolumeFromArray). See complete example in the [script repository](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Combine_multiple_volumes_into_one).
