/// <summary> /// Write a dicom file object to a (persistent) Media Storage file. /// </summary> /// <param name="file">dicom file object to write</param> /// <param name="mediaFileName">file name to write to</param> /// <returns></returns> public static bool WriteDataSetToFile( DicomFile file, string mediaFileName) { if (file == null) { throw new System.ArgumentNullException("file"); } if (mediaFileName == null) { throw new System.ArgumentNullException("mediaFileName"); } FileMetaInformation fmi = file.FileMetaInformation; if (fmi == null) { fmi = new FileMetaInformation(); //Set the default transfer syntax(ELE) attribute in FMI fmi.AddAttribute("0x00020010", VR.UI, "1.2.840.10008.1.2.1"); file.FileMetaInformation = fmi; } return(MDataSet.WriteFile(file, mediaFileName)); }