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); }
/// <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(); var parent = 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)); }
/// <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(); }
/// <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); }
private void Analyze(bool responsive) { _roi = base.Subject.GetRoi(); this.Callout.Update(_roi, responsive ? RoiAnalysisMode.Responsive : RoiAnalysisMode.Normal); }
public bool SupportsRoi(Roi roi) { return roi is ProtractorRoiInfo; }
////TODO (cr Feb 2010): All the analysis should really be done in the ProtractorRoiInfo. //public string Analyze(ProtractorRoiInfo roiInfo, RoiAnalysisMode mode) //{ // // Don't show the callout until the second ray is drawn // if (roiInfo.Points.Count < 3) // return 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)); //} //TODO (cr Feb 2010): All the analysis should really be done in the ProtractorRoiInfo. public IRoiAnalyzerResult Analyze(Roi roi, RoiAnalysisMode mode) { return Analyze((ProtractorRoiInfo) roi, mode); }
private void Analyze(bool responsive) { _roi = base.Subject.GetRoi(); this.Callout.Update(_roi, responsive ? RoiAnalysisMode.Responsive : RoiAnalysisMode.Normal); }
private void Analyze(bool responsive) { _roi = Subject.GetRoi(); var currentCallout = Callout; var roiCallout = currentCallout as RoiCalloutGraphic; if (roiCallout == null) { if (currentCallout != null) { Graphics.Remove(currentCallout); currentCallout.Dispose(); } roiCallout = new RoiCalloutGraphic {Color = Color}; Graphics.Add(roiCallout); Callout = roiCallout; } roiCallout.Update(_roi, responsive ? RoiAnalysisMode.Responsive : RoiAnalysisMode.Normal); }
/// <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); }