# Path of the loaded fiber bundle

**URL:** <https://discourse.slicer.org/t/path-of-the-loaded-fiber-bundle/30524>\
**Category:** Support\
**Tags:** python\
**Created:** [July 11, 2023, 4:16pm UTC](https://discourse.slicer.org/t/path-of-the-loaded-fiber-bundle/30524 "2023-07-11T16:16:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kening\_Zhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kening_zhang/32/65641_2.png) [@Kening\_Zhang](https://discourse.slicer.org/u/Kening_Zhang)\
**Post date:** [July 11, 2023, 4:16pm UTC](https://discourse.slicer.org/t/path-of-the-loaded-fiber-bundle/30524/1 "2023-07-11T16:16:33Z")

</div>

Dear developers,  
I am trying to get the file path of the fiber bundle loaded in the slicer, here I use a selector to assign a data, and I try to use command GetStorageNode().GetFileName() to get the path.  
This is my code:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/9/59be0a10d5b64ddeb698c28bd23b8c8807cb8dfa.png)  
However, it failed  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/6/7/67935196bad4932933e7c7afb2420c61b6ff46f7.png)  
It seems like the ‘atlas’ file I loaded doesn’t have a storage node,  
but I indeed load it from local disk.  
I wonder how to solve this problem.

Best wishes and thanks!  
Joshua

---

<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 11, 2023, 6:16pm UTC](https://discourse.slicer.org/t/path-of-the-loaded-fiber-bundle/30524/2 "2023-07-11T18:16:41Z")

</div>

Good question.

It looks like the [AddFiberBundle method](https://github.com/SlicerDMRI/SlicerDMRI/blob/34dca8edf493a2261e5cc3fb1487b0933b4600c8/Modules/Loadable/TractographyDisplay/Logic/vtkSlicerFiberBundleLogic.cxx#L113-L142) doesn’t include these lines that are in the corresponding code of the AddModel method.

> <https://github.com/Slicer/Slicer/blob/f6d4eccebe92e0e981009c1f7b89884c9cba7b1a/Modules/Loadable/Models/Logic/vtkSlicerModelsLogic.cxx#L310-L312>

As a result you are getting a blank storage node instead of the one used to read the data.

Would you be able to make a pull request for this?

---

<div class="post-metadata">

**Author:** ![Kening\_Zhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kening_zhang/32/65641_2.png) [@Kening\_Zhang](https://discourse.slicer.org/u/Kening_Zhang)\
**Post date:** [July 12, 2023, 3:49pm UTC](https://discourse.slicer.org/t/path-of-the-loaded-fiber-bundle/30524/3 "2023-07-12T15:49:51Z")

</div>

Dear piper,  
I found there some differents between volume and fiber bundle  
Does it just need these codes?  
// Associate with storage node  
this-\>GetMRMLScene()-\>AddNode(storageNode);

// Set the storage node ID for the fiber bundle node  
fiberBundleNode-\>SetAndObserveStorageNodeID(storageNode-\>GetID());

Thanks,  
Joshua

---

<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 12, 2023, 9:11pm UTC](https://discourse.slicer.org/t/path-of-the-loaded-fiber-bundle/30524/4 "2023-07-12T21:11:52Z")

</div>

Yes, from what I can see that is the missing code that needs to be added. If you aren’t familiar with the process I can probably find time to add it and test that it works, but if you can give it a try it would be appreciated.

---

<div class="post-metadata">

**Author:** ![Kening\_Zhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kening_zhang/32/65641_2.png) [@Kening\_Zhang](https://discourse.slicer.org/u/Kening_Zhang)\
**Post date:** [July 13, 2023, 5:19am UTC](https://discourse.slicer.org/t/path-of-the-loaded-fiber-bundle/30524/5 "2023-07-13T05:19:10Z")

</div>

I’m sorry I’m not familiar with this process, \* I thought you might be needed to complete this step

---

<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 13, 2023, 7:23pm UTC](https://discourse.slicer.org/t/path-of-the-loaded-fiber-bundle/30524/6 "2023-07-13T19:23:26Z")

</div>

I went ahead and added the missing line. It will be in tomorrow’s version of SlicerDMI and it would be great if you could test it out.

> <https://github.com/SlicerDMRI/SlicerDMRI/pull/173>
>
> The storage node was used but not saved in the scene, making the behavior incons…istent with corresponding method in the models superclass.
> 
> See discussion here: https://discourse.slicer.org/t/path-of-the-loaded-fiber-bundle/30524

---

<div class="post-metadata">

**Author:** ![Kening\_Zhang](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/kening_zhang/32/65641_2.png) [@Kening\_Zhang](https://discourse.slicer.org/u/Kening_Zhang)\
**Post date:** [July 14, 2023, 8:20am UTC](https://discourse.slicer.org/t/path-of-the-loaded-fiber-bundle/30524/7 "2023-07-14T08:20:34Z")

</div>

Dear pieper,  
Thanks a lot, I will test it tomorrow.  
Best regards,  
Joshua
