# How do access the source filepath(s) of a DICOM image given a \`vtkMRMLScalarVolumeNode\`

**URL:** <https://discourse.slicer.org/t/how-do-access-the-source-filepath-s-of-a-dicom-image-given-a-vtkmrmlscalarvolumenode/20619>\
**Category:** Support\
**Tags:** dicom, python\
**Created:** [November 15, 2021, 2:34am UTC](https://discourse.slicer.org/t/how-do-access-the-source-filepath-s-of-a-dicom-image-given-a-vtkmrmlscalarvolumenode/20619 "2021-11-15T02:34:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aarashy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aarashy/32/14848_2.png) [@aarashy](https://discourse.slicer.org/u/aarashy)\
**Post date:** [November 15, 2021, 2:34am UTC](https://discourse.slicer.org/t/how-do-access-the-source-filepath-s-of-a-dicom-image-given-a-vtkmrmlscalarvolumenode/20619/1 "2021-11-15T02:34:17Z")

</div>

Hello!  
I’m making my first Slicer plugin, and my goal is to use the `pydicom` package to read a DICOM file, i.e. `pydicom.read_file(< Path to the .dcm file, whether it was copied or linked during import >)`

I am having trouble getting the filepath.

I was following the tutorial in this youtube video: `https://www.youtube.com/watch?v=njoTEisxAJ4`

I’m using `slicer.util.getNode(<name>)` to get a `vtkMRMLScalarVolumeNode`, but to my surprise, when I call `_.GetStorageNode()`, my storage node is None. It seems the storage node object has a `_.GetFileName()` property, but I can’t reach it.

I tried to look around for information on why my StorageNode might be None, what I can do to make it initialize properly, or if there’s another way to get the DICOM file path.

Any advice? Thank you!

---

<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:** [November 15, 2021, 8:56pm UTC](https://discourse.slicer.org/t/how-do-access-the-source-filepath-s-of-a-dicom-image-given-a-vtkmrmlscalarvolumenode/20619/2 "2021-11-15T20:56:29Z")

</div>

If the volume was loaded from dicom then the file path can be accessed with this code:

[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#access-tag-of-a-volume-loaded-from-dicom-for-example-get-the-patient-position-stored-in-a-volume](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#access-tag-of-a-volume-loaded-from-dicom-for-example-get-the-patient-position-stored-in-a-volume)

[https://slicer.readthedocs.io/en/latest/developer\_guide/script\_repository.html#get-path-and-filename-of-a-loaded-dicom-volume](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#get-path-and-filename-of-a-loaded-dicom-volume)

---

<div class="post-metadata">

**Author:** ![aarashy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aarashy/32/14848_2.png) [@aarashy](https://discourse.slicer.org/u/aarashy)\
**Post date:** [November 16, 2021, 3:58am UTC](https://discourse.slicer.org/t/how-do-access-the-source-filepath-s-of-a-dicom-image-given-a-vtkmrmlscalarvolumenode/20619/3 "2021-11-16T03:58:07Z")

</div>

Worked like a charm!! Thanks. I hadn’t seen the script repository somehow.
