# Exporting MATLAB data for gel dosimetry

**URL:** <https://discourse.slicer.org/t/exporting-matlab-data-for-gel-dosimetry/14573>\
**Category:** Support\
**Tags:** gel-dosimetry\
**Created:** [November 12, 2020, 7:11pm UTC](https://discourse.slicer.org/t/exporting-matlab-data-for-gel-dosimetry/14573 "2020-11-12T19:11:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SmHoop](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@SmHoop](https://discourse.slicer.org/u/SmHoop)\
**Post date:** [November 12, 2020, 7:11pm UTC](https://discourse.slicer.org/t/exporting-matlab-data-for-gel-dosimetry/14573/1 "2020-11-12T19:11:12Z")

</div>

Hi there,

I am running an in-house MATLAB program to reconstruct optical CT files. The only options this program has to save the reconstructions are “save as type: All MATLAB files” or “export cube” which generates a .raw file. I am trying to use the Gel Dosimetry slicelet and the tutorial calls for a .VFF file (and the slicelet itself says “Load optical CT files from VFF, NRRD, etc.”. I have everything else for the slicelet to run (Normal CT image, struct, planned dose from Eclipse, etc.) but I am struggling with how to possibly import my actual reconstructed, irradiated scan.

Does anyone out there have experience with this?

Thank you!

---

<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 12, 2020, 7:12pm UTC](https://discourse.slicer.org/t/exporting-matlab-data-for-gel-dosimetry/14573/2 "2020-11-12T19:12:40Z")

</div>

You can save the image matrix in Matlab as a nrrd file, for example using [nrrdwrite.m](https://github.com/PerkLab/SlicerMatlabBridge/blob/master/MatlabCommander/commandserver/nrrdwrite.m).

---

<div class="post-metadata">

**Author:** ![SmHoop](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@SmHoop](https://discourse.slicer.org/u/SmHoop)\
**Post date:** [November 12, 2020, 7:31pm UTC](https://discourse.slicer.org/t/exporting-matlab-data-for-gel-dosimetry/14573/3 "2020-11-12T19:31:44Z")

</div>

Thank you for the response!

I’m not sure how to utilize this function however. The .mat file that is saved is a 1x1 struct . I tried to set the “img” argument equal to this struct (in the workspace) but I got an error of “Reference to non-existent field ‘pixelData’.” My Matlab knowledge is extremely slim and this is all new territory for me, am I even using this function correctly?

---

<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 12, 2020, 8:37pm UTC](https://discourse.slicer.org/t/exporting-matlab-data-for-gel-dosimetry/14573/4 "2020-11-12T20:37:31Z")

</div>

Usage instructions are described in great details in the function’s documentation:

> <https://github.com/PerkLab/SlicerMatlabBridge/blob/master/MatlabCommander/commandserver/nrrdwrite.m#L2-L49>

> [@SmHoop](#):
>
> My Matlab knowledge is extremely slim and this is all new territory for me

Matlab is on a steep decline. Instead of investing time into learning it, you might consider using existing sophisticated image reconstruction solutions implemented in C++ and available in Python, for example [RTK](https://www.openrtk.org/) (Python package: [itk-rtk](https://pypi.org/project/itk-rtk/)).

---

<div class="post-metadata">

**Author:** ![SmHoop](https://avatars.discourse-cdn.com/v4/letter/s/f6c823/32.png) [@SmHoop](https://discourse.slicer.org/u/SmHoop)\
**Post date:** [December 14, 2020, 6:40pm UTC](https://discourse.slicer.org/t/exporting-matlab-data-for-gel-dosimetry/14573/5 "2020-12-14T18:40:21Z")

</div>

Hello,

I’ve tried to make this work with what I can export using this custom GUI built in Matlab (basically a 3D matrix, .mat file) but I’ve had no success. Instead, I’ve written the .mat out to a dicom and am attempting to use this as the measured/calibration data in the gel dosimetry slicelet. It seems to be working so far, is there any reason a non dicom should be used?

Thank you!
