I\'m trying to create a mew dicom image from a standard-sized (512 x 512 or 256 x 256) numpy array. It seems like this should be straightforward, and I\'ve adapted my code
Corvin's 2020 update almost worked for me. The meta was still not written to the file, so when reading it the following exception was raised:
pydicom.errors.InvalidDicomError: File is missing DICOM File Meta Information header or the 'DICM' prefix is missing from the header.
In order to fix this and write the meta into the dicom file, I needed to add enforce_standard=True to the save_as() call:
ds.save_as(filename=out_filename, enforce_standard=True)