Error using MultiVolumeImporter for a nifti multivolume

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

-----------------------------------------------------------------------------------
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.

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!

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

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

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