Exemple #1
0
        private List <PointF> NormalizePoints(ProtractorRoiInfo roiInfo)
        {
            float aspectRatio = 1F;

            if (roiInfo.PixelAspectRatio.IsNull)
            {
                if (!roiInfo.NormalizedPixelSpacing.IsNull)
                {
                    aspectRatio = (float)roiInfo.NormalizedPixelSpacing.AspectRatio;
                }
            }
            else
            {
                aspectRatio = roiInfo.PixelAspectRatio.Value;
            }

            List <PointF> normalized = new List <PointF>();

            foreach (PointF point in roiInfo.Points)
            {
                normalized.Add(new PointF(point.X, point.Y * aspectRatio));
            }

            return(normalized);
        }
Exemple #2
0
        private IRoiAnalyzerResult Analyze(ProtractorRoiInfo roiInfo, RoiAnalysisMode mode)
        {
            // Don't show the callout until the second ray is drawn
            if (roiInfo.Points.Count < 3)
            {
                //return SR.ToolsMeasurementSetVertex;
                return(new RoiAnalyzerResultNoValue("Protactor", SR.ToolsMeasurementSetVertex));
            }

            List <PointF> normalizedPoints = NormalizePoints(roiInfo);

            double angle = Vector.SubtendedAngle(normalizedPoints[0], normalizedPoints[1], normalizedPoints[2]);

            //return String.Format(SR.ToolsMeasurementFormatDegrees, Math.Abs(angle));
            return(new SingleValueRoiAnalyzerResult("Protactor", SR.ToolsMeasurementFormatDegrees, Math.Abs(angle), String.Format(SR.ToolsMeasurementFormatDegrees, Math.Abs(angle))));
        }