public void TestGetPixelAspectRatioString() { using (var dataset = CreateMockDataset("CR", SopClass.ComputedRadiographyImageStorage, null, new SizeF(0.6f, 0.5f), "FIDUCIAL", "details", null)) using (var sop = (ImageSop)Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Assert.AreEqual(@"5\6", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.33333331, 0.3333333); Assert.AreEqual(@"1\1", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.7074200013, 0.7074200009); Assert.AreEqual(@"1\1", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.3, 0.4); Assert.AreEqual(@"3\4", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.4, 0.3000001); Assert.AreEqual(@"4\3", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.55, 0.4); Assert.AreEqual(@"11\8", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.7777777, 0.3333333); Assert.AreEqual(@"7\3", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } }
public void TestCTUncalibratedWithRogueImagerPixelSpacing() { using (var dataset = CreateMockDataset("CT", SopClass.CtImageStorage, new SizeF(1f, 2f), null, "GEOMETRY", "garbage", null)) { using (var sop = (ImageSop) Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(true, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.None, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }
public void TestCTCalibratedWithRogueImagerPixelSpacing() { using (var dataset = CreateMockDataset("CT", SopClass.CtImageStorage, new SizeF(1f, 2f), new SizeF(0.4f, 0.3f), "GEOMETRY", "garbage", null)) { using (var sop = (ImageSop)Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(false, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0.3, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0.4, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.CrossSectionalSpacing, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(@"3\4", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }
public void TestCRCalibratedUsingFiducialWithoutImagerPixelSpacing() { using (var dataset = CreateMockDataset("CR", SopClass.ComputedRadiographyImageStorage, null, new SizeF(0.4f, 0.3f), "FIDUCIAL", "details", null)) { using (var sop = (ImageSop)Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(false, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0.3, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0.4, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.Fiducial, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual("details", normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(@"3\4", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }
public void TestCTUncalibrated() { using (var dataset = CreateMockDataset("CT", SopClass.CtImageStorage, null, null, null, null, null)) { using (var sop = (ImageSop)Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(true, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.None, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }
public void TestMGCalibratedUsingGeometry() { using (var dataset = CreateMockDataset("MG", SopClass.DigitalMammographyXRayImageStorageForPresentation, new SizeF(0.6f, 0.5f), new SizeF(0.4f, 0.3f), "GEOMETRY", null, null)) { using (var sop = (ImageSop)Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(false, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0.3, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0.4, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.Geometry, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(@"3\4", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }
public void TestMGCalibratedUsingGeometryWithMagnificationFactor() { // we don't yet support the IHE Mammo profile requirement to use Imager Pixel Spacing corrected by Estimated Radiographic Magnification Factor using (var dataset = CreateMockDataset("MG", SopClass.DigitalMammographyXRayImageStorageForPresentation, new SizeF(0.6f, 0.5f), new SizeF(0.4f, 0.3f), "GEOMETRY", null, 1.5)) { using (var sop = (ImageSop)Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(false, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0.3, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0.4, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.Geometry, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(@"3\4", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }
public void TestCTCalibrated() { using (var dataset = CreateMockDataset("CT", SopClass.CtImageStorage, null, new SizeF(0.4f, 0.3f), null, null, null)) { using (var sop = (ImageSop) Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(false, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0.3, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0.4, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.CrossSectionalSpacing, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(@"3\4", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }
public void TestGetPixelAspectRatioString() { using (var dataset = CreateMockDataset("CR", SopClass.ComputedRadiographyImageStorage, null, new SizeF(0.6f, 0.5f), "FIDUCIAL", "details", null)) using (var sop = (ImageSop) Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Assert.AreEqual(@"5\6", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.33333331, 0.3333333); Assert.AreEqual(@"1\1", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.7074200013, 0.7074200009); Assert.AreEqual(@"1\1", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.3, 0.4); Assert.AreEqual(@"3\4", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.4, 0.3000001); Assert.AreEqual(@"4\3", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.55, 0.4); Assert.AreEqual(@"11\8", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); normalizedPixelSpacing.Calibrate(0.7777777, 0.3333333); Assert.AreEqual(@"7\3", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } }
public void TestManualCalibration() { using (var dataset = CreateMockDataset("CR", SopClass.ComputedRadiographyImageStorage, null, new SizeF(0.6f, 0.5f), "FIDUCIAL", "details", null)) { using (var sop = (ImageSop) Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); normalizedPixelSpacing.Calibrate(0.3, 0.4); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(false, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0.3, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0.4, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.Manual, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(@"3\4", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }
public void TestMGCalibratedUsingGeometryWithMagnificationFactor() { // we don't yet support the IHE Mammo profile requirement to use Imager Pixel Spacing corrected by Estimated Radiographic Magnification Factor using (var dataset = CreateMockDataset("MG", SopClass.DigitalMammographyXRayImageStorageForPresentation, new SizeF(0.6f, 0.5f), new SizeF(0.4f, 0.3f), "GEOMETRY", null, 1.5)) { using (var sop = (ImageSop) Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(false, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0.3, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0.4, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.Geometry, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(@"3\4", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }
public void TestMGCalibratedUsingGeometry() { using (var dataset = CreateMockDataset("MG", SopClass.DigitalMammographyXRayImageStorageForPresentation, new SizeF(0.6f, 0.5f), new SizeF(0.4f, 0.3f), "GEOMETRY", null, null)) { using (var sop = (ImageSop) Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(false, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0.3, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0.4, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.Geometry, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(@"3\4", normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }
public void TestDXUncalibrated() { using (var dataset = CreateMockDataset("DX", SopClass.DigitalXRayImageStorageForPresentation, null, null, null, null, null)) { using (var sop = (ImageSop) Sop.Create(dataset)) { var normalizedPixelSpacing = new NormalizedPixelSpacing(sop.Frames[1]); Console.WriteLine(GetPixelSpacingAttributeInfo(dataset)); Assert.AreEqual(true, normalizedPixelSpacing.IsNull, "IsNull property"); Assert.AreEqual(0, normalizedPixelSpacing.Row, _tolerance, "Row property"); Assert.AreEqual(0, normalizedPixelSpacing.Column, _tolerance, "Column property"); Assert.AreEqual(NormalizedPixelSpacingCalibrationType.None, normalizedPixelSpacing.CalibrationType, "CalibrationType property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.CalibrationDetails, "CalibrationDetails property"); Assert.AreEqual(string.Empty, normalizedPixelSpacing.GetPixelAspectRatioString(), "GetPixelAspectRatioString result"); } } }