public void LoadMedicalVolumeTest()
        {
            var dir             = TestData.GetFullImagesPath(@"sample_dicom");
            var acceptanceTests = new ModerateGeometricAcceptanceTest(string.Empty, string.Empty);
            var medicalVolumes  = MedIO.LoadAllDicomSeriesInFolderAsync(dir, acceptanceTests).Result;

            Assert.AreEqual(1, medicalVolumes.Count);

            var medicalVolume = medicalVolumes.First().Volume;

            Assert.IsTrue(medicalVolume.Struct.Contours.Any(x => x.StructureSetRoi.RoiName == "Bladder"));
            Assert.IsTrue(medicalVolume.Struct.Contours.Any(x => x.StructureSetRoi.RoiName == "Femur_L"));

            RtStructWriter.SaveRtStruct(_tempfile, medicalVolume.Struct);

            DicomFile file = DicomFile.Open(_tempfile);

            var identifiers = medicalVolume.Identifiers.First();

            var reloaded = RtStructReader.LoadContours(
                file.Dataset,
                medicalVolume.Volume.Transform.DicomToData,
                identifiers.Series.SeriesInstanceUid,
                identifiers.Study.StudyInstanceUid).Item1;

            Assert.IsTrue(reloaded.Contours.Any(x => x.StructureSetRoi.RoiName == "Bladder"));
            Assert.IsTrue(reloaded.Contours.Any(x => x.StructureSetRoi.RoiName == "Femur_L"));
        }
示例#2
0
 /// <summary>
 /// Returns a task to save the given rtStruct to disk.
 /// </summary>
 /// <param name="filename"></param>
 /// <param name="rtStruct"></param>
 /// <returns></returns>
 public static async Task SaveRtStructAsync(string filename, RadiotherapyStruct rtStruct)
 {
     await Task.Run(
         () => RtStructWriter.SaveRtStruct(filename, rtStruct));
 }