public void Open_ValidFile() { var filename = Path.GetTempFileName(); var dicomFile = new DicomFile(); dicomFile.Dataset.Add(DicomTag.SOPInstanceUID, DicomUIDGenerator.GenerateDerivedFromUUID()); dicomFile.FileMetaInfo.TransferSyntax = DicomTransferSyntax.ExplicitVRLittleEndian; dicomFile.FileMetaInfo.MediaStorageSOPInstanceUID = DicomUIDGenerator.GenerateDerivedFromUUID(); dicomFile.FileMetaInfo.MediaStorageSOPClassUID = DicomUIDGenerator.GenerateDerivedFromUUID(); dicomFile.Save(filename); var dicomToolkit = new DicomToolkit(); dicomToolkit.Open(filename); }
public void Save_ValidFile() { var filename = Path.GetTempFileName(); var dicomFile = new DicomFile(); var expectedSop = DicomUIDGenerator.GenerateDerivedFromUUID(); dicomFile.Dataset.Add(DicomTag.SOPInstanceUID, expectedSop); dicomFile.FileMetaInfo.TransferSyntax = DicomTransferSyntax.ExplicitVRLittleEndian; dicomFile.FileMetaInfo.MediaStorageSOPInstanceUID = DicomUIDGenerator.GenerateDerivedFromUUID(); dicomFile.FileMetaInfo.MediaStorageSOPClassUID = DicomUIDGenerator.GenerateDerivedFromUUID(); var dicomToolkit = new DicomToolkit(); dicomToolkit.Save(dicomFile, filename); var savedFile = dicomToolkit.Open(filename); Assert.NotNull(savedFile); Assert.Equal(expectedSop.UID, savedFile.Dataset.GetSingleValue <string>(DicomTag.SOPInstanceUID)); }