Saving 4D dicom from3D volumes

I have multiple 3D volume series acquired at different timestamp , the timestamps only differ by a negligible amount in units of seconds. I have collated the 3D volumes into a 4D image of type itk::Image< PixelType, 4 > ,now I want to save it as a dicom file. How do I do it?

There are many ways how to store 4D image in DICOM. What imaging device would you like to simulate?

The imaging device is ultrasound.

I don’t know about any ultrasound device that would save 4D images in standard DICOM images. I know that GE, Philips, and Siemens store most data in private fields. So, even if you create 3D time sequence of US frames, there will be no clinical software that can read them. If you plan to use research software, then you are better off saving as a 4D NRRD image, which is much simpler to read and write and already supported by many software.