Skip to content

Instantly share code, notes, and snippets.

View swalex's full-sized avatar

Alexander Saratow swalex

View GitHub Profile
@swalex
swalex / encapsulate.cs
Last active January 14, 2025 13:16
Encapsulate (save) PDF with FO-DICOM (into a DCM file)
public static void Encapsulate( Patient patient, Study study, Institution institution, string directory, string filename, byte[] pdf )
{
var name = new DicomPersonName( DicomTag.PatientName, patient.LastName, patient.FirstName,
patient.MiddleName, patient.NamePrefix, patient.NameSuffix );
var studyUID = new DicomUID( study.InstanceUID, "Study Instance UID", DicomUidType.SOPInstance );
var company = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyCompanyAttribute>().Company;
var product = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyProductAttribute>().Product;
DicomDataset[] refItems = study.Series
.SelectMany( s => s.Datasets )