# Calling in a .mat object into 3D Slicer

**URL:** <https://discourse.slicer.org/t/calling-in-a-mat-object-into-3d-slicer/1492>\
**Category:** Support\
**Tags:** matlab, file-import\
**Created:** [November 20, 2017, 1:58pm UTC](https://discourse.slicer.org/t/calling-in-a-mat-object-into-3d-slicer/1492 "2017-11-20T13:58:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stevenagl12](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/stevenagl12/32/3391_2.png) [@stevenagl12](https://discourse.slicer.org/u/stevenagl12)\
**Post date:** [November 20, 2017, 1:58pm UTC](https://discourse.slicer.org/t/calling-in-a-mat-object-into-3d-slicer/1492/1 "2017-11-20T13:58:08Z")

</div>

I was wondering if Slicer has any functionality for calling in a .mat object into the program. I know that there is a MATLAB bridge, does this have the capability of calling in these objects?

---

<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:** [November 20, 2017, 3:00pm UTC](https://discourse.slicer.org/t/calling-in-a-mat-object-into-3d-slicer/1492/2 "2017-11-20T15:00:09Z")

</div>

The only .mat file reading option I can think about is through the MatlabBridge. You can define a simple module that takes a .mat file as input and returns output whatever data you would like to retrieve from the .mat file.

In general, I would strongly recommend using common standard open file formats for data storage instead of .mat files (.mha or .nrrd for images, .stl or .ply for surface meshes, .xml or .json for various parameter files, etc.).

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [November 20, 2017, 3:26pm UTC](https://discourse.slicer.org/t/calling-in-a-mat-object-into-3d-slicer/1492/3 "2017-11-20T15:26:31Z")

</div>

You can use [`scipy.io.loadmat`](https://docs.scipy.org/doc/scipy/reference/tutorial/io.html) and then push the buffers into VTK objects with the examples in the [Python scripting](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Python_scripting) section.
