# Error using MultiVolumeImporter for a nifti multivolume

**URL:** <https://discourse.slicer.org/t/error-using-multivolumeimporter-for-a-nifti-multivolume/12644>\
**Category:** Support\
**Created:** [July 20, 2020, 3:59pm UTC](https://discourse.slicer.org/t/error-using-multivolumeimporter-for-a-nifti-multivolume/12644 "2020-07-20T15:59:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![agomez](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@agomez](https://discourse.slicer.org/u/agomez)\
**Post date:** [July 20, 2020, 3:59pm UTC](https://discourse.slicer.org/t/error-using-multivolumeimporter-for-a-nifti-multivolume/12644/1 "2020-07-20T15:59:49Z")

</div>

Hi, we have found this and want to check if it may be a bug.

In MultiVolumeImporter there is a Helper function in  
…/Slicer-4.10.2-linux-amd64/lib/Slicer-4.10/qt-scripted-modules/MultiVolumeImporterLib/Helper.py

```python
-----------------------------------------------------------------------------------
from __main__ import vtk, slicer

class Helper( object ):

  @staticmethod
  def SetBgFgVolumes(bg, fg):
    appLogic = slicer.app.applicationLogic()
    selectionNode = appLogic.GetSelectionNode()
    selectionNode.SetReferenceActiveVolumeID(bg)
    selectionNode.SetReferenceSecondaryVolumeID(fg)
    appLogic.PropagateVolumeSelection()
------------------------------------------------------------------------------------------

```

This Helper function is called from MultiVolumeImporter.py in two places with this line:

Helper.SetBgFgVolumes(mvNode.GetID(),None)

This causes an error in the line of the Helper:

```
selectionNode.SetReferenceSecondaryVolumeID(fg)

TypeError: SetReferenceSecondaryVolumeID argument 1: expected a sequence of 0 values, got NoneType

```

This error was found when loading a nifti multivolume.  
We could temporarily fix the error by editing MultiVolumeImporter.py or the Helper and changing None by [] or ‘’ but there must be a better solution. If this is not a bug, please let us know the correct use of the module.

Thanks.

---

<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:** [July 20, 2020, 4:19pm UTC](https://discourse.slicer.org/t/error-using-multivolumeimporter-for-a-nifti-multivolume/12644/2 "2020-07-20T16:19:43Z")

</div>

You can replace `fg` by `fg if fg else ''`. If it fixes the issue the. Please send a pull request with this change. Thank you!

---

<div class="post-metadata">

**Author:** ![agomez](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@agomez](https://discourse.slicer.org/u/agomez)\
**Post date:** [July 20, 2020, 6:56pm UTC](https://discourse.slicer.org/t/error-using-multivolumeimporter-for-a-nifti-multivolume/12644/3 "2020-07-20T18:56:50Z")

</div>

Thanks Andras.  
This has been taken into account in MultiViewImporter some time ago but after the build of the stable release.

> <https://github.com/fedorov/MultiVolumeImporter/commit/b7e43f29d27c0169a9f7909499b7d2c85a4c5201>

---

<div class="post-metadata">

**Author:** ![agomez](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@agomez](https://discourse.slicer.org/u/agomez)\
**Post date:** [July 20, 2020, 10:24pm UTC](https://discourse.slicer.org/t/error-using-multivolumeimporter-for-a-nifti-multivolume/12644/4 "2020-07-20T22:24:03Z")

</div>

Thanks Andras.  
The issue was taken into account in MultiVolumeImporter some time ago but after the build of the last stable release.

> <https://github.com/fedorov/MultiVolumeImporter/commit/b7e43f29d27c0169a9f7909499b7d2c85a4c5201>

---

<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:** [July 22, 2020, 2:10pm UTC](https://discourse.slicer.org/t/error-using-multivolumeimporter-for-a-nifti-multivolume/12644/5 "2020-07-22T14:10:19Z")

</div>

Thanks for checking. I would recommend to use a recent Slicer Preview Release then.
