How to create SimpleITK Image from a dicom dataset


Is there a way to create/form/load a SimpleITK image / volume from a dicom dataset ?
Essentially I need to load the dicom data received from a dicom node post QueryRetrieve. But instead of storing the data on disk on temp files then reading them using ImageSeriesReader to create the same Image object from dicom dataset directly ? I also need to stay in c# / .NET framwork.

Thank you in advance for any advise

The following example shows how to create a SimpleITK Image from a buffer in C#. Assuming you have the DICOM data in memory, something like the example ought to do the trick.

Thank you Dave

I am aware of that buffer load method.
The issue I have is that my memory is an actual dicom dataset ( essentially an entire dicom file with it’s metadata etc) also I have a list of those datasets (the equivalent of multiple dicom files/slices for the scan)
Right now I am writing those files on disk and then using ImageSeriesReader to construct the volume in the correct geometry metadata etc
I am trying to eliminate that step in the least error prone way if that makes any sense

What library are you using to load the DICOM data set into memory? There ought to be a way to get the pixel data.

I am using fo-dicom FellowOakDicom
simple example query the dicom server / association and write the images to disk
I want to eliminate the writing to disk part and pass the multiple dicom datasets to ITK and to go on my merry way

 // now get all the images of a serie with cGet in the same association

            client = DicomClientFactory.Create(_qrServerHost, _qrServerPort, false, _aet, _qrServerAET);
            var cGetRequest = CreateCGetBySeriesUID(studyUID, serieUids.First());
            client.OnCStoreRequest += (DicomCStoreRequest req) =>
                Console.WriteLine(DateTime.Now.ToString() + " recived");
                return Task.FromResult(new DicomCStoreResponse(req, DicomStatus.Success));
 public static void SaveImage(DicomDataset dataset)
            var studyUid = dataset.GetSingleValue<string>(DicomTag.StudyInstanceUID).Trim();
            var instUid = dataset.GetSingleValue<string>(DicomTag.SOPInstanceUID).Trim();

            var path = Path.GetFullPath(_storagePath);
            path = Path.Combine(path, studyUid);

            if (!Directory.Exists(path))

            path = Path.Combine(path, instUid) + ".dcm";

            new DicomFile(dataset).Save(path);

In theory I can query each individual dataset for the tag containing the pixel data and use the buffer import to create individual ITK Images , but I believe that would be error prone and cumbersome adding all the metadata manually for each image.
I was hoping there was some class or interface similar to ImageSeriesReader that takes in a list of file names or directory but instead of flat files to use the dataset directly