public void TestConstructors() { var empty = new PatientDirection(""); Assert.AreEqual("", empty.Code, "Direction: empty"); Assert.AreEqual(true, empty.IsEmpty, "Direction: empty"); Assert.AreEqual(false, empty.IsUnspecified, "Direction: empty"); var unspec = new PatientDirection("X"); Assert.AreEqual("X", unspec.Code, "Direction: unspec"); Assert.AreEqual(false, unspec.IsEmpty, "Direction: unspec"); Assert.AreEqual(true, unspec.IsUnspecified, "Direction: unspec"); var front = new PatientDirection("A"); Assert.AreEqual("A", front.Code, "Direction: front"); Assert.AreEqual(false, front.IsEmpty, "Direction: front"); Assert.AreEqual(false, front.IsUnspecified, "Direction: front"); var rightfoot = new PatientDirection("RF"); Assert.AreEqual("RF", rightfoot.Code, "Direction: rightfoot"); Assert.AreEqual(false, rightfoot.IsEmpty, "Direction: rightfoot"); Assert.AreEqual(false, rightfoot.IsUnspecified, "Direction: rightfoot"); var headleftback = new PatientDirection("HLP"); Assert.AreEqual("HLP", headleftback.Code, "Direction: headleftback"); Assert.AreEqual(false, headleftback.IsEmpty, "Direction: headleftback"); Assert.AreEqual(false, headleftback.IsUnspecified, "Direction: headleftback"); }
public void TestConstructors() { var empty = new PatientDirection("", AnatomicalOrientationType.Quadruped); Assert.AreEqual("", empty.Code, "Direction: empty"); Assert.AreEqual(true, empty.IsEmpty, "Direction: empty"); Assert.AreEqual(false, empty.IsUnspecified, "Direction: empty"); var unspec = new PatientDirection("X", AnatomicalOrientationType.Quadruped); Assert.AreEqual("X", unspec.Code, "Direction: unspec"); Assert.AreEqual(false, unspec.IsEmpty, "Direction: unspec"); Assert.AreEqual(true, unspec.IsUnspecified, "Direction: unspec"); var lateral = new PatientDirection("L", AnatomicalOrientationType.Quadruped); Assert.AreEqual("L", lateral.Code, "Direction: lateral"); Assert.AreEqual(false, lateral.IsEmpty, "Direction: lateral"); Assert.AreEqual(false, lateral.IsUnspecified, "Direction: lateral"); var plantar = new PatientDirection("PL", AnatomicalOrientationType.Quadruped); Assert.AreEqual("PL", plantar.Code, "Direction: plantar"); Assert.AreEqual(false, plantar.IsEmpty, "Direction: plantar"); Assert.AreEqual(false, plantar.IsUnspecified, "Direction: plantar"); var parlmarrostral = new PatientDirection("PAR", AnatomicalOrientationType.Quadruped); Assert.AreEqual("PAR", parlmarrostral.Code, "Direction: parlmarrostral"); Assert.AreEqual(false, parlmarrostral.IsEmpty, "Direction: parlmarrostral"); Assert.AreEqual(false, parlmarrostral.IsUnspecified, "Direction: parlmarrostral"); var dorsaldistal = new PatientDirection("DDI", AnatomicalOrientationType.Quadruped); Assert.AreEqual("DDI", dorsaldistal.Code, "Direction: dorsaldistal"); Assert.AreEqual(false, dorsaldistal.IsEmpty, "Direction: dorsaldistal"); Assert.AreEqual(false, dorsaldistal.IsUnspecified, "Direction: dorsaldistal"); var plantarright = new PatientDirection("PLRT", AnatomicalOrientationType.Quadruped); Assert.AreEqual("PLRT", plantarright.Code, "Direction: plantarright"); Assert.AreEqual(false, plantarright.IsEmpty, "Direction: plantarright"); Assert.AreEqual(false, plantarright.IsUnspecified, "Direction: plantarright"); var medialventralcaudal = new PatientDirection("MVCD", AnatomicalOrientationType.Quadruped); Assert.AreEqual("MVCD", medialventralcaudal.Code, "Direction: medialventralcaudal"); Assert.AreEqual(false, medialventralcaudal.IsEmpty, "Direction: medialventralcaudal"); Assert.AreEqual(false, medialventralcaudal.IsUnspecified, "Direction: medialventralcaudal"); var proximalleftcranial = new PatientDirection("PRLECR", AnatomicalOrientationType.Quadruped); Assert.AreEqual("PRLECR", proximalleftcranial.Code, "Direction: proximalleftcranial"); Assert.AreEqual(false, proximalleftcranial.IsEmpty, "Direction: proximalleftcranial"); Assert.AreEqual(false, proximalleftcranial.IsUnspecified, "Direction: proximalleftcranial"); }
public void TestConcatenator() { var empty = new PatientDirection("", AnatomicalOrientationType.Quadruped); Assert.AreEqual("", (empty + new PatientDirection("", AnatomicalOrientationType.Quadruped)).Code, "Direction: empty+empty"); Assert.AreEqual("X", (empty + new PatientDirection("X", AnatomicalOrientationType.Quadruped)).Code, "Direction: empty+unspec"); Assert.AreEqual("X", (new PatientDirection("X", AnatomicalOrientationType.Quadruped) + empty).Code, "Direction: unspec+empty"); Assert.AreEqual(false, (new PatientDirection("X", AnatomicalOrientationType.Quadruped) + new PatientDirection("PA", AnatomicalOrientationType.Quadruped)).IsValid, "Direction: illegal concatenation"); Assert.AreEqual(false, (new PatientDirection("PL", AnatomicalOrientationType.Quadruped) + new PatientDirection("X", AnatomicalOrientationType.Quadruped)).IsValid, "Direction: illegal concatenation"); Assert.AreEqual("RPL", (new PatientDirection("R", AnatomicalOrientationType.Quadruped) + new PatientDirection("PL", AnatomicalOrientationType.Quadruped)).Code, "Direction: rightplantar"); Assert.AreEqual("DIDCD", (new PatientDirection("DI", AnatomicalOrientationType.Quadruped) + new PatientDirection("D", AnatomicalOrientationType.Quadruped) + new PatientDirection("CD", AnatomicalOrientationType.Quadruped)).Code, "Direction: distaldorsalcaudal"); }
public void TestConcatenator() { var empty = new PatientDirection(""); Assert.AreEqual("", (empty + new PatientDirection("")).Code, "Direction: empty+empty"); Assert.AreEqual("X", (empty + new PatientDirection("X")).Code, "Direction: empty+unspec"); Assert.AreEqual("X", (new PatientDirection("X") + empty).Code, "Direction: unspec+empty"); Assert.AreEqual(false, (new PatientDirection("X") + new PatientDirection("A")).IsValid, "Direction: illegal concatenation"); Assert.AreEqual(false, (new PatientDirection("A") + new PatientDirection("X")).IsValid, "Direction: illegal concatenation"); Assert.AreEqual("RF", (new PatientDirection("R") + new PatientDirection("F")).Code, "Direction: rightfoot"); Assert.AreEqual("HLP", (new PatientDirection("H") + new PatientDirection("L") + new PatientDirection("P")).Code, "Direction: headleftback"); }
public void TestComponents() { var empty = new PatientDirection(""); Assert.AreEqual(0, empty.ComponentCount, "Direction: empty"); Assert.AreEqual("", empty.Primary.Code, "Direction: empty"); Assert.AreEqual("", empty.Secondary.Code, "Direction: empty"); Assert.AreEqual("", empty.Tertiary.Code, "Direction: empty"); Assert.AreEqual("", empty[PatientDirection.Component.Primary].Code, "Direction: empty"); Assert.AreEqual("", empty[PatientDirection.Component.Secondary].Code, "Direction: empty"); Assert.AreEqual("", empty[PatientDirection.Component.Tertiary].Code, "Direction: empty"); var unspec = new PatientDirection("X"); Assert.AreEqual(1, unspec.ComponentCount, "Direction: unspec"); Assert.AreEqual("X", unspec.Primary.Code, "Direction: unspec"); Assert.AreEqual("", unspec.Secondary.Code, "Direction: unspec"); Assert.AreEqual("", unspec.Tertiary.Code, "Direction: unspec"); Assert.AreEqual("X", unspec[PatientDirection.Component.Primary].Code, "Direction: unspec"); Assert.AreEqual("", unspec[PatientDirection.Component.Secondary].Code, "Direction: unspec"); Assert.AreEqual("", unspec[PatientDirection.Component.Tertiary].Code, "Direction: unspec"); var front = new PatientDirection("A"); Assert.AreEqual(1, front.ComponentCount, "Direction: front"); Assert.AreEqual("A", front.Primary.Code, "Direction: front"); Assert.AreEqual("", front.Secondary.Code, "Direction: front"); Assert.AreEqual("", front.Tertiary.Code, "Direction: front"); Assert.AreEqual("A", front[PatientDirection.Component.Primary].Code, "Direction: front"); Assert.AreEqual("", front[PatientDirection.Component.Secondary].Code, "Direction: front"); Assert.AreEqual("", front[PatientDirection.Component.Tertiary].Code, "Direction: front"); var rightfoot = new PatientDirection("RF"); Assert.AreEqual(2, rightfoot.ComponentCount, "Direction: rightfoot"); Assert.AreEqual("R", rightfoot.Primary.Code, "Direction: rightfoot"); Assert.AreEqual("F", rightfoot.Secondary.Code, "Direction: rightfoot"); Assert.AreEqual("", rightfoot.Tertiary.Code, "Direction: rightfoot"); Assert.AreEqual("R", rightfoot[PatientDirection.Component.Primary].Code, "Direction: rightfoot"); Assert.AreEqual("F", rightfoot[PatientDirection.Component.Secondary].Code, "Direction: rightfoot"); Assert.AreEqual("", rightfoot[PatientDirection.Component.Tertiary].Code, "Direction: rightfoot"); var headleftback = new PatientDirection("HLP"); Assert.AreEqual(3, headleftback.ComponentCount, "Direction: headleftback"); Assert.AreEqual("H", headleftback.Primary.Code, "Direction: headleftback"); Assert.AreEqual("L", headleftback.Secondary.Code, "Direction: headleftback"); Assert.AreEqual("P", headleftback.Tertiary.Code, "Direction: headleftback"); Assert.AreEqual("H", headleftback[PatientDirection.Component.Primary].Code, "Direction: headleftback"); Assert.AreEqual("L", headleftback[PatientDirection.Component.Secondary].Code, "Direction: headleftback"); Assert.AreEqual("P", headleftback[PatientDirection.Component.Tertiary].Code, "Direction: headleftback"); }
public void TestOpposingDirection() { var empty = new PatientDirection("", AnatomicalOrientationType.Quadruped); Assert.AreEqual("", empty.OpposingDirection.Code, "Direction: empty"); var unspec = new PatientDirection("X", AnatomicalOrientationType.Quadruped); Assert.AreEqual("X", unspec.OpposingDirection.Code, "Direction: unspec"); var lateral = new PatientDirection("L", AnatomicalOrientationType.Quadruped); Assert.AreEqual("X", lateral.OpposingDirection.Code, "Direction: lateral"); var left = new PatientDirection("LE", AnatomicalOrientationType.Quadruped); Assert.AreEqual("X", left.OpposingDirection.Code, "Direction: left"); var proximalleftcranial = new PatientDirection("PRLECR", AnatomicalOrientationType.Quadruped); Assert.AreEqual("X", proximalleftcranial.OpposingDirection.Code, "Direction: proximalleftcranial"); }
public void TestOpposingDirection() { var empty = new PatientDirection(""); Assert.AreEqual("", empty.OpposingDirection.Code, "Direction: empty"); var unspec = new PatientDirection("X"); Assert.AreEqual("X", unspec.OpposingDirection.Code, "Direction: unspec"); var front = new PatientDirection("A"); Assert.AreEqual("P", front.OpposingDirection.Code, "Direction: front"); var rightfoot = new PatientDirection("RF"); Assert.AreEqual("LH", rightfoot.OpposingDirection.Code, "Direction: rightfoot"); var headleftback = new PatientDirection("HLP"); Assert.AreEqual("FRA", headleftback.OpposingDirection.Code, "Direction: headleftback"); }
public void TestComponents() { var empty = new PatientDirection("", AnatomicalOrientationType.Quadruped); Assert.AreEqual(0, empty.ComponentCount, "Direction: empty"); Assert.AreEqual("", empty.Primary.Code, "Direction: empty"); Assert.AreEqual("", empty.Secondary.Code, "Direction: empty"); Assert.AreEqual("", empty.Tertiary.Code, "Direction: empty"); Assert.AreEqual("", empty[PatientDirection.Component.Primary].Code, "Direction: empty"); Assert.AreEqual("", empty[PatientDirection.Component.Secondary].Code, "Direction: empty"); Assert.AreEqual("", empty[PatientDirection.Component.Tertiary].Code, "Direction: empty"); var unspec = new PatientDirection("X", AnatomicalOrientationType.Quadruped); Assert.AreEqual(1, unspec.ComponentCount, "Direction: unspec"); Assert.AreEqual("X", unspec.Primary.Code, "Direction: unspec"); Assert.AreEqual("", unspec.Secondary.Code, "Direction: unspec"); Assert.AreEqual("", unspec.Tertiary.Code, "Direction: unspec"); Assert.AreEqual("X", unspec[PatientDirection.Component.Primary].Code, "Direction: unspec"); Assert.AreEqual("", unspec[PatientDirection.Component.Secondary].Code, "Direction: unspec"); Assert.AreEqual("", unspec[PatientDirection.Component.Tertiary].Code, "Direction: unspec"); var lateral = new PatientDirection("L", AnatomicalOrientationType.Quadruped); Assert.AreEqual(1, lateral.ComponentCount, "Direction: lateral"); Assert.AreEqual("L", lateral.Primary.Code, "Direction: lateral"); Assert.AreEqual("", lateral.Secondary.Code, "Direction: lateral"); Assert.AreEqual("", lateral.Tertiary.Code, "Direction: lateral"); Assert.AreEqual("L", lateral[PatientDirection.Component.Primary].Code, "Direction: lateral"); Assert.AreEqual("", lateral[PatientDirection.Component.Secondary].Code, "Direction: lateral"); Assert.AreEqual("", lateral[PatientDirection.Component.Tertiary].Code, "Direction: lateral"); var plantar = new PatientDirection("PL", AnatomicalOrientationType.Quadruped); Assert.AreEqual(1, plantar.ComponentCount, "Direction: plantar"); Assert.AreEqual("PL", plantar.Primary.Code, "Direction: plantar"); Assert.AreEqual("", plantar.Secondary.Code, "Direction: plantar"); Assert.AreEqual("", plantar.Tertiary.Code, "Direction: plantar"); Assert.AreEqual("PL", plantar[PatientDirection.Component.Primary].Code, "Direction: plantar"); Assert.AreEqual("", plantar[PatientDirection.Component.Secondary].Code, "Direction: plantar"); Assert.AreEqual("", plantar[PatientDirection.Component.Tertiary].Code, "Direction: plantar"); var palmarrostral = new PatientDirection("PAR", AnatomicalOrientationType.Quadruped); Assert.AreEqual(2, palmarrostral.ComponentCount, "Direction: palmarrostral"); Assert.AreEqual("PA", palmarrostral.Primary.Code, "Direction: palmarrostral"); Assert.AreEqual("R", palmarrostral.Secondary.Code, "Direction: palmarrostral"); Assert.AreEqual("", palmarrostral.Tertiary.Code, "Direction: palmarrostral"); Assert.AreEqual("PA", palmarrostral[PatientDirection.Component.Primary].Code, "Direction: palmarrostral"); Assert.AreEqual("R", palmarrostral[PatientDirection.Component.Secondary].Code, "Direction: palmarrostral"); Assert.AreEqual("", palmarrostral[PatientDirection.Component.Tertiary].Code, "Direction: palmarrostral"); var dorsaldistal = new PatientDirection("DDI", AnatomicalOrientationType.Quadruped); Assert.AreEqual(2, dorsaldistal.ComponentCount, "Direction: dorsaldistal"); Assert.AreEqual("D", dorsaldistal.Primary.Code, "Direction: dorsaldistal"); Assert.AreEqual("DI", dorsaldistal.Secondary.Code, "Direction: dorsaldistal"); Assert.AreEqual("", dorsaldistal.Tertiary.Code, "Direction: dorsaldistal"); Assert.AreEqual("D", dorsaldistal[PatientDirection.Component.Primary].Code, "Direction: dorsaldistal"); Assert.AreEqual("DI", dorsaldistal[PatientDirection.Component.Secondary].Code, "Direction: dorsaldistal"); Assert.AreEqual("", dorsaldistal[PatientDirection.Component.Tertiary].Code, "Direction: dorsaldistal"); var plantarright = new PatientDirection("PLRT", AnatomicalOrientationType.Quadruped); Assert.AreEqual(2, plantarright.ComponentCount, "Direction: plantarright"); Assert.AreEqual("PL", plantarright.Primary.Code, "Direction: plantarright"); Assert.AreEqual("RT", plantarright.Secondary.Code, "Direction: plantarright"); Assert.AreEqual("", plantarright.Tertiary.Code, "Direction: plantarright"); Assert.AreEqual("PL", plantarright[PatientDirection.Component.Primary].Code, "Direction: plantarright"); Assert.AreEqual("RT", plantarright[PatientDirection.Component.Secondary].Code, "Direction: plantarright"); Assert.AreEqual("", plantarright[PatientDirection.Component.Tertiary].Code, "Direction: plantarright"); var medialventralcaudal = new PatientDirection("MVCD", AnatomicalOrientationType.Quadruped); Assert.AreEqual(3, medialventralcaudal.ComponentCount, "Direction: medialventralcaudal"); Assert.AreEqual("M", medialventralcaudal.Primary.Code, "Direction: medialventralcaudal"); Assert.AreEqual("V", medialventralcaudal.Secondary.Code, "Direction: medialventralcaudal"); Assert.AreEqual("CD", medialventralcaudal.Tertiary.Code, "Direction: medialventralcaudal"); Assert.AreEqual("M", medialventralcaudal[PatientDirection.Component.Primary].Code, "Direction: medialventralcaudal"); Assert.AreEqual("V", medialventralcaudal[PatientDirection.Component.Secondary].Code, "Direction: medialventralcaudal"); Assert.AreEqual("CD", medialventralcaudal[PatientDirection.Component.Tertiary].Code, "Direction: medialventralcaudal"); var proximalleftcranial = new PatientDirection("PRLECR", AnatomicalOrientationType.Quadruped); Assert.AreEqual(3, proximalleftcranial.ComponentCount, "Direction: proximalleftcranial"); Assert.AreEqual("PR", proximalleftcranial.Primary.Code, "Direction: proximalleftcranial"); Assert.AreEqual("LE", proximalleftcranial.Secondary.Code, "Direction: proximalleftcranial"); Assert.AreEqual("CR", proximalleftcranial.Tertiary.Code, "Direction: proximalleftcranial"); Assert.AreEqual("PR", proximalleftcranial[PatientDirection.Component.Primary].Code, "Direction: proximalleftcranial"); Assert.AreEqual("LE", proximalleftcranial[PatientDirection.Component.Secondary].Code, "Direction: proximalleftcranial"); Assert.AreEqual("CR", proximalleftcranial[PatientDirection.Component.Tertiary].Code, "Direction: proximalleftcranial"); }
/// <summary> /// Converts an <see cref="PatientDirection"/> to a marker string. /// </summary> /// <param name="direction">the direction (patient based system)</param> /// <returns>marker text</returns> private static string GetMarkerText(PatientDirection direction) { // TODO (CR Mar 2012): Add a "short description" to PatientDirection class and return this from there. // Then we're not finding patient direction resources all over the place. if (direction == PatientDirection.QuadrupedLeft) { return(SR.ValueDirectionalMarkersQuadrupedLeft); } else if (direction == PatientDirection.QuadrupedRight) { return(SR.ValueDirectionalMarkersQuadrupedRight); } else if (direction == PatientDirection.QuadrupedCranial) { return(SR.ValueDirectionalMarkersQuadrupedCranial); } else if (direction == PatientDirection.QuadrupedCaudal) { return(SR.ValueDirectionalMarkersQuadrupedCaudal); } else if (direction == PatientDirection.QuadrupedRostral) { return(SR.ValueDirectionalMarkersQuadrupedRostral); } else if (direction == PatientDirection.QuadrupedDorsal) { return(SR.ValueDirectionalMarkersQuadrupedDorsal); } else if (direction == PatientDirection.QuadrupedVentral) { return(SR.ValueDirectionalMarkersQuadrupedVentral); } else if (direction == PatientDirection.QuadrupedLateral) { return(SR.ValueDirectionalMarkersQuadrupedLateral); } else if (direction == PatientDirection.QuadrupedMedial) { return(SR.ValueDirectionalMarkersQuadrupedMedial); } else if (direction == PatientDirection.QuadrupedProximal) { return(SR.ValueDirectionalMarkersQuadrupedProximal); } else if (direction == PatientDirection.QuadrupedDistal) { return(SR.ValueDirectionalMarkersQuadrupedDistal); } else if (direction == PatientDirection.QuadrupedPalmar) { return(SR.ValueDirectionalMarkersQuadrupedPalmar); } else if (direction == PatientDirection.QuadrupedPlantar) { return(SR.ValueDirectionalMarkersQuadrupedPlantar); } else if (direction == PatientDirection.Left) { return(SR.ValueDirectionalMarkersLeft); } else if (direction == PatientDirection.Right) { return(SR.ValueDirectionalMarkersRight); } else if (direction == PatientDirection.Head) { return(SR.ValueDirectionalMarkersHead); } else if (direction == PatientDirection.Foot) { return(SR.ValueDirectionalMarkersFoot); } else if (direction == PatientDirection.Anterior) { return(SR.ValueDirectionalMarkersAnterior); } else if (direction == PatientDirection.Posterior) { return(SR.ValueDirectionalMarkersPosterior); } return(string.Empty); }