Sometimes, when I load a non-diffusion MR DICOM volume, I get errors during loading which come from DWIConvert. Most recently, I got this, which I think is what I usually get:
Diffusion-weighted DICOM Import (DWIConvert) standard error: C:/Users/mikeb/AppData/Local/Temp/Slicer/__SlicerTemp__2020-10-08_12+09+45.638/Im00000 has no non-zero diffusion vectors
In the Data module, two volumes have appeared: “T1_mprage+c - as DWI Volume” and “27: T1_mprage+c”. The second one seems to be exactly what I wanted, the first shows up as a DWIVolume, but there’s no diffusion information (because there isn’t any in the original DICOM). I assume something is going wrong with determining which plugin should load it, and the DWI plugin thinks it should be the one. Is there a way for me to force the loading to use the right plugin? In this case, the user has been prompted to choose a scalar volume, so even if they chose a directory containing a DWI volume I don’t want it to load, I only want to load a scalar volume.
This is the function which is currently doing the loading, which is lightly modified from an example in the script repository:
def loadDicomVolumeFromDirectory(self, dicomDir): '''Loads DICOM image files in supplied directory, returns list of loaded volume nodes and list of corresponding pydicom headers. ''' # This code modified from script in script repository loadedNodes =  loadedNodeHeaders =  #from DICOMLib import DICOMUtils with DICOMUtils.TemporaryDICOMDatabase() as db: DICOMUtils.importDicom(dicomDir, db) patientUIDs = db.patients() for patientUID in patientUIDs: newVolNodeIDs = DICOMUtils.loadPatientByUID(patientUID) for newVolnodeID in newVolNodeIDs: node = slicer.util.getNode(newVolnodeID) instanceUIDs = node.GetAttribute('DICOM.instanceUIDs').split() filepath = db.fileForInstance(instanceUIDs) newHeader = pydicom.dcmread(filepath) loadedNodeHeaders.append(newHeader) loadedNodes.append(node) return loadedNodes, loadedNodeHeaders