Create pydicom file from numpy array

后端 未结 5 1020
别跟我提以往
别跟我提以往 2020-12-16 04:42

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

5条回答
  •  臣服心动
    2020-12-16 05:09

    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) 
    

提交回复
热议问题