How to use qSlicerCoreIOManager::loadNodes to load dicom files by cpp

To load dicom series “.dcm” file, code is as below

    qSlicerCoreIOManager* ioManager = qSlicerCoreApplication::application()->coreIOManager();
    properties["fileName"] = file; // the first file in series
    ioManager->loadNodes("VolumeFile", properties );

some dicom files can be loaded as single volume, some generates multiple series for every dicom file

How can i solve this?

DICOM files have to be loaded with the DICOM module. The IO plugin for the IO manager just calls the DICOM module to import the image, too.

There are often several different interpretations of a set of DICOM files, so you have to ask the user or make assumptions.

Thanks for your replay.
Does that mean the first arguments should not only ‘VolumeFile’ and change according to some dicom feature?

Specifying VolumeFile would use ITK library’s DICOM reader, which only loads some images correctly. It loads some images incorrectly or not at all, and it cannot read any other information objects. Therefore, I would recommend to always use the DICOM module for loading DICOM data. First you need to import the data, then examine, select what you want to load, and finally load them. You can find examples in the script repository. You can execute Python commands in C++ using the Python manager object.

yeah
very appreciated!