Exemplo n.º 1
0
        public PatientDirection(string code, AnatomicalOrientationType anatomicalOrientationType)
        {
            PatientDirection[] components;
            if (anatomicalOrientationType == AnatomicalOrientationType.Quadruped)
            {
                components = ParseQuadrupedDirection(code);
            }
            else
            {
                anatomicalOrientationType = AnatomicalOrientationType.Biped;                 // assume orientation type is BIPED
                components = ParseBipedDirection(code);
            }

            // set the parsed components
            _primaryComponent   = components.Length > 0 ? components[0] : null;
            _secondaryComponent = components.Length > 1 ? components[1] : null;
            _tertiaryComponent  = components.Length > 2 ? components[2] : null;

            _isValid        = components.Length > 0;
            _code           = code ?? string.Empty;
            _description    = string.Join(SR.LabelPatientDirectionSeparator, CollectionUtils.Map <PatientDirection, string>(components, d => d.Description).ToArray());
            _componentCount = components.Length;

            // consider orientation type to be NONE if direction is empty or unspecified (and not just empty because of parse error)
            _anatomicalOrientationType = string.IsNullOrEmpty(code) || Primary.IsUnspecified ? AnatomicalOrientationType.None : anatomicalOrientationType;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a standard component direction.
 /// </summary>
 private PatientDirection(string code, string description, AnatomicalOrientationType anatomicalOrientationType)
 {
     _primaryComponent   = this;
     _secondaryComponent = null;
     _tertiaryComponent  = null;
     _isValid            = true;
     _code                      = code;
     _description               = description;
     _componentCount            = 1;
     _anatomicalOrientationType = anatomicalOrientationType;
 }
Exemplo n.º 3
0
		public PatientDirection(string code, AnatomicalOrientationType anatomicalOrientationType)
		{
			PatientDirection[] components;
			if (anatomicalOrientationType == AnatomicalOrientationType.Quadruped)
			{
				components = ParseQuadrupedDirection(code);
			}
			else
			{
				anatomicalOrientationType = AnatomicalOrientationType.Biped; // assume orientation type is BIPED
				components = ParseBipedDirection(code);
			}

			// set the parsed components
			_primaryComponent = components.Length > 0 ? components[0] : null;
			_secondaryComponent = components.Length > 1 ? components[1] : null;
			_tertiaryComponent = components.Length > 2 ? components[2] : null;

			_isValid = components.Length > 0;
			_code = code ?? string.Empty;
			_description = string.Join(SR.LabelPatientDirectionSeparator, CollectionUtils.Map<PatientDirection, string>(components, d => d.Description).ToArray());
			_componentCount = components.Length;

			// consider orientation type to be NONE if direction is empty or unspecified (and not just empty because of parse error)
			_anatomicalOrientationType = string.IsNullOrEmpty(code) || Primary.IsUnspecified ? AnatomicalOrientationType.None : anatomicalOrientationType;
		}
Exemplo n.º 4
0
		public PatientDirection(PatientDirection patientDirection)
			: this(patientDirection.Code, patientDirection.AnatomicalOrientationType) {}
Exemplo n.º 5
0
		/// <summary>
		/// Initializes a standard component direction.
		/// </summary>
		private PatientDirection(string code, string description, AnatomicalOrientationType anatomicalOrientationType)
		{
			_primaryComponent = this;
			_secondaryComponent = null;
			_tertiaryComponent = null;
			_isValid = true;
			_code = code;
			_description = description;
			_componentCount = 1;
			_anatomicalOrientationType = anatomicalOrientationType;
		}
Exemplo n.º 6
0
 public PatientDirection(PatientDirection patientDirection)
     : this(patientDirection.Code, patientDirection.AnatomicalOrientationType)
 {
 }
		/// <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;
		}
        private PatientDirection GetEdgeDirection(ImageEdge imageEdge, PatientDirection.Component component)
		{
			bool negativeDirection = (imageEdge == ImageEdge.Left || imageEdge == ImageEdge.Top);
			bool rowValues = (imageEdge == ImageEdge.Left || imageEdge == ImageEdge.Right);

            var direction = PatientDirection.Empty;
            if (rowValues)
			{
                //TODO (CR June 2011): tertiary?
                if (component == PatientDirection.Component.Primary)
                    direction = GetPrimaryRowDirection();
                else if (component == PatientDirection.Component.Secondary)
                    direction = GetSecondaryRowDirection();
			}
			else
			{
                //TODO (CR June 2011): tertiary?
                if (component == PatientDirection.Component.Primary)
                    direction = GetPrimaryColumnDirection();
                else if (component == PatientDirection.Component.Secondary)
                    direction = GetSecondaryColumnDirection();
            }

            return negativeDirection ? direction.OpposingDirection : direction;
		}
Exemplo n.º 9
0
 public PatientOrientation(PatientDirection row, PatientDirection column)
 {
     Row    = new PatientDirection(row);
     Column = new PatientDirection(column);
 }