Example #1
0
        /// <summary>
        /// Forces the callout to update, allowing all the analyzers to recompute and update the text content of the callout.
        /// </summary>
        /// <param name="roi">A particular region of interest information object to use when computing statistics.</param>
        /// <param name="mode">A value indicating whether or not the current region of interest is in the state of changing, and therefore whether or not analyzers should skip expensive computations.</param>
        public void Update(Roi roi, RoiAnalysisMode mode)
        {
            if (this.ImageViewer == null)
            {
                return;
            }

            StringBuilder builder = new StringBuilder();
            RoiGraphic    parent  = this.ParentGraphic;

            if (parent != null && !string.IsNullOrEmpty(parent.Name))
            {
                builder.AppendLine(parent.Name);
            }

            if (_showAnalysis && _roiAnalyzers.Count > 0 && roi != null)
            {
                try
                {
                    foreach (IRoiAnalyzer analyzer in _roiAnalyzers)
                    {
                        if (analyzer.SupportsRoi(roi))
                        {
                            var analysis = analyzer.Analyze(roi, mode);
                            if (analysis != null)
                            {
                                builder.AppendLine(analysis.SerializedAsString());
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Platform.Log(LogLevel.Error, e);
                    builder.AppendLine(SR.MessageRoiAnalysisError);
                }
            }

            base.Text = builder.ToString().Trim();
        }
        public static RoiStatistics Calculate(Roi roi)
        {
            if (!(roi.PixelData is GrayscalePixelData))
            {
                return(new RoiStatistics());
            }

            double mean = CalculateMean(
                roi.BoundingBox,
                (GrayscalePixelData)roi.PixelData,
                roi.ModalityLut,
                roi.Contains);

            double stdDev = CalculateStandardDeviation(
                mean,
                roi.BoundingBox,
                (GrayscalePixelData)roi.PixelData,
                roi.ModalityLut,
                roi.Contains);

            return(new RoiStatistics(mean, stdDev));
        }
Example #3
0
 private void Analyze(bool responsive)
 {
     _roi = base.Subject.GetRoi();
     this.Callout.Update(_roi, responsive ? RoiAnalysisMode.Responsive : RoiAnalysisMode.Normal);
 }
Example #4
0
 /// <summary>
 /// Forces the callout to update, allowing all the analyzers to recompute and update the text content of the callout immediately.
 /// </summary>
 /// <param name="roi">A particular region of interest information object to use when computing statistics.</param>
 public void Update(Roi roi)
 {
     this.Update(roi, RoiAnalysisMode.Normal);
 }