public void TestBasicTags() { var sourceSops = CreateSourceSops(); var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual(sourceSops[0], prototype, DicomTags.PatientId); AssertAreEqual(sourceSops[0], prototype, DicomTags.PatientsName); AssertAreEqual(sourceSops[0], prototype, DicomTags.ClinicalTrialSubjectId); AssertAreEqual(sourceSops[0], prototype, DicomTags.StudyInstanceUid); AssertAreEqual(sourceSops[0], prototype, DicomTags.StudyId); AssertAreEqual(sourceSops[0], prototype, DicomTags.ClinicalTrialTimePointId); AssertAreEqual(sourceSops[0], prototype, DicomTags.PatientsAge); AssertAreEqual(sourceSops[0], prototype, DicomTags.PatientsSize); AssertAreEqual(sourceSops[0], prototype, DicomTags.PatientsWeight); AssertAreEqual(sourceSops[0], prototype, DicomTags.SeriesDescription); AssertAreEqual(sourceSops[0], prototype, DicomTags.Modality); AssertAreEqual(sourceSops[0], prototype, DicomTags.SeriesNumber); AssertAreEqual(sourceSops[0], prototype, DicomTags.ClinicalTrialSeriesId); AssertAreEqual(sourceSops[0], prototype, DicomTags.Manufacturer); AssertAreEqual(sourceSops[0], prototype, DicomTags.ManufacturersModelName); AssertAreEqual(sourceSops[0], prototype, DicomTags.FrameOfReferenceUid); }
public void TestAggregatedPatientAnonymityTags() { // The Rules for aggregating Burned in Annotation and Recognizable Visual Features: // 1. If any one SOP says YES, the result is always YES // 2. Otherwise, if any one SOP does not include the tag, or the value is unparseable, the result is the empty value (undefined) // 3. Otherwise, all SOPs consistently say NO, so the result is simply NO const string enumYes = "YES"; const string enumNo = "NO"; // All Undefined { var sourceSops = CreateSourceSops(); foreach (var x in sourceSops) { x[DicomTags.BurnedInAnnotation].SetEmptyValue(); x[DicomTags.RecognizableVisualFeatures].SetEmptyValue(); } var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual("", prototype, DicomTags.BurnedInAnnotation, "All Undefined"); AssertAreEqual("", prototype, DicomTags.RecognizableVisualFeatures, "All Undefined"); } // All YES { var sourceSops = CreateSourceSops(); foreach (var x in sourceSops) { x[DicomTags.BurnedInAnnotation].SetStringValue(enumYes); x[DicomTags.RecognizableVisualFeatures].SetStringValue(enumYes); } var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual(enumYes, prototype, DicomTags.BurnedInAnnotation, "All YES"); AssertAreEqual(enumYes, prototype, DicomTags.RecognizableVisualFeatures, "All YES"); } // All NO { var sourceSops = CreateSourceSops(); foreach (var x in sourceSops) { x[DicomTags.BurnedInAnnotation].SetStringValue(enumNo); x[DicomTags.RecognizableVisualFeatures].SetStringValue(enumNo); } var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual(enumNo, prototype, DicomTags.BurnedInAnnotation, "All NO"); AssertAreEqual(enumNo, prototype, DicomTags.RecognizableVisualFeatures, "All NO"); } // At Least One YES { var sourceSops = CreateSourceSops(); foreach (var x in sourceSops) { x[DicomTags.BurnedInAnnotation].SetEmptyValue(); x[DicomTags.RecognizableVisualFeatures].SetEmptyValue(); } sourceSops[3][DicomTags.BurnedInAnnotation].SetStringValue("ASDF"); sourceSops[4][DicomTags.BurnedInAnnotation].SetStringValue(enumYes); sourceSops[5][DicomTags.BurnedInAnnotation].SetStringValue(enumNo); sourceSops[6][DicomTags.RecognizableVisualFeatures].SetStringValue(enumNo); sourceSops[7][DicomTags.RecognizableVisualFeatures].SetStringValue(enumYes); sourceSops[8][DicomTags.RecognizableVisualFeatures].SetStringValue(""); var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual(enumYes, prototype, DicomTags.BurnedInAnnotation, "At Least One YES"); AssertAreEqual(enumYes, prototype, DicomTags.RecognizableVisualFeatures, "At Least One YES"); } // At Least One Undefined { var sourceSops = CreateSourceSops(); foreach (var x in sourceSops) { x[DicomTags.BurnedInAnnotation].SetStringValue(enumNo); x[DicomTags.RecognizableVisualFeatures].SetStringValue(enumNo); } sourceSops[3][DicomTags.BurnedInAnnotation].SetStringValue("ASDF"); sourceSops[8][DicomTags.RecognizableVisualFeatures].SetStringValue(""); var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual("", prototype, DicomTags.BurnedInAnnotation, "At Least One Undefined"); AssertAreEqual("", prototype, DicomTags.RecognizableVisualFeatures, "At Least One Undefined"); } }
private MockVolumeReference(VolumeHeaderData volumeHeaderData) { _volumeHeaderData = volumeHeaderData; }
public void TestAggregatedLossyCompressionTags() { // The Rules for aggregating Lossy Image Compression: // 1. If any one SOP says 01 (Lossy), the result is always 01 (Lossy) // 2. Otherwise, if any one SOP does not include the tag, or the value is unparseable, the result is the empty value (undefined) // 3. Otherwise, all SOPs consistently say 00 (Lossless), so the result is simply 00 (Lossless) const string enumLossy = "01"; const string enumLossless = "00"; // All Undefined { var sourceSops = CreateSourceSops(); foreach (var x in sourceSops) { x[DicomTags.LossyImageCompression].SetEmptyValue(); } var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual("", prototype, DicomTags.LossyImageCompression, "All Undefined"); } // All LOSSY { var sourceSops = CreateSourceSops(); foreach (var x in sourceSops) { x[DicomTags.LossyImageCompression].SetStringValue(enumLossy); } var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual(enumLossy, prototype, DicomTags.LossyImageCompression, "All LOSSY"); } // All LOSSLESS { var sourceSops = CreateSourceSops(); foreach (var x in sourceSops) { x[DicomTags.LossyImageCompression].SetStringValue(enumLossless); } var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual(enumLossless, prototype, DicomTags.LossyImageCompression, "All LOSSLESS"); } // At Least One LOSSY { var sourceSops = CreateSourceSops(); foreach (var x in sourceSops) { x[DicomTags.LossyImageCompression].SetEmptyValue(); } sourceSops[3][DicomTags.LossyImageCompression].SetStringValue("ASDF"); sourceSops[4][DicomTags.LossyImageCompression].SetStringValue(enumLossy); sourceSops[5][DicomTags.LossyImageCompression].SetStringValue(enumLossless); var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual(enumLossy, prototype, DicomTags.LossyImageCompression, "At Least One LOSSY"); } // At Least One Undefined { var sourceSops = CreateSourceSops(); foreach (var x in sourceSops) { x[DicomTags.LossyImageCompression].SetStringValue(enumLossless); } sourceSops[3][DicomTags.LossyImageCompression].SetStringValue("ASDF"); var prototype = VolumeHeaderData.TestCreate(sourceSops); AssertAreEqual("", prototype, DicomTags.LossyImageCompression, "At Least One Undefined"); } }