I recommend that you find an existing dicom file that has the same properties you want, and use dicominfo() to read the meta-data. (You could store the metadata somewhere so that you did not need to keep the base image around.)
Then when you use dicomwrite() pass the saved metadata before any name/value pairs. dicomwrite() knows enough to override the information about the number of pixels, but will retain (most of?) the other information. You would want to do some testing to ensure it does not accidentally duplicate UUIDs specific to the patient.
Best Answer