Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''<summary>Statistic information of one channel (RGB or total).</summary>
- '''<remarks>The maximum word with is taken as pixel values to cover all fixed-point formats ...</remarks>
- Public Structure sSingleChannelStatistics
- '''<summary>Number of characters in the header of the report.</summary>
- Public Shared ReadOnly Property ReportHeaderLength As Integer = 20
- '''<summary>Number of characters in the value of the report.</summary>
- Public Shared ReadOnly Property ReportValueLength As Integer = 16
- '''<summary>Width [pixel] of the last image.</summary>
- Public Width As UInt32
- '''<summary>Height [pixel] of the last image.</summary>
- Public Height As UInt32
- '''<summary>Number of total samples (pixels) in the data set.</summary>
- Public Samples As UInt64
- '''<summary>Maximum value occured (value and number of pixel that have this value).</summary>
- Public Max As KeyValuePair(Of Int64, UInt64)
- '''<summary>Minimum value occured (value and number of pixel that have this value).</summary>
- Public Min As KeyValuePair(Of Int64, UInt64)
- '''<summary>Value where half of the samples are below and half are above.</summary>
- Public Median As Int64
- '''<summary>Arithmetic mean value.</summary>
- Public Mean As Double
- '''<summary>Mean value of squared values.</summary>
- Public MeanPow2 As Double
- '''<summary>Standard deviation (calculated as in FitsWork).</summary>
- Public StdDev As Double
- '''<summary>Number of different ADU values in the data.</summary>
- Public DifferentADUValues As Integer
- '''<summary>Number of different ADU values in 25-75 pct range.</summary>
- Public ADUValues2575 As Integer
- '''<summary>Distance between the histogram X axis points.</summary>
- Public HistXDist As Dictionary(Of Long, UInt64)
- '''<summary>Percentile.</summary>
- Public Percentile As Dictionary(Of Integer, Int64)
- '''<summary>Pixel value that is present the most often.</summary>
- Public Modus As KeyValuePair(Of Int64, UInt64)
- '''<summary>Standard deviation (calculated as in FitsWork).</summary>
- Public ReadOnly Property Variance As Double
- Get
- Return StdDev ^ 2
- End Get
- End Property
- '''<summary>Init all inner variables.</summary>
- Public Shared Function InitForShort() As sSingleChannelStatistics
- Dim RetVal As New sSingleChannelStatistics
- RetVal.Width = 0
- RetVal.Height = 0
- RetVal.Samples = 0
- RetVal.Max = Nothing
- RetVal.Min = Nothing
- RetVal.Mean = 0
- RetVal.MeanPow2 = 0
- RetVal.StdDev = Double.NaN
- RetVal.DifferentADUValues = 0
- RetVal.HistXDist = New Dictionary(Of Long, UInt64)
- RetVal.Median = Int64.MinValue
- RetVal.Percentile = New Dictionary(Of Integer, Int64)
- RetVal.Modus = Nothing
- Return RetVal
- End Function
- '''<summary>Report of all statistics properties of the structure.</summary>
- '''<param name="DispHeader">TRUE to display the header, FALSE else.</param>
- Public Function StatisticsReport() As List(Of String)
- Dim NotPresent As String = New String("-"c, ReportValueLength)
- Dim RetVal As New List(Of String)
- Dim HistXDist_keys As List(Of Long) = HistXDist.KeyList
- Dim TotalPixel As String = ((Samples / 1000000).ValRegIndep("0.0") & "M")
- If Samples < 1000000 Then TotalPixel = ((Samples / 1000).ValRegIndep("0.0") & "k")
- RetVal.Add("Dimensions : " & (Width.ValRegIndep & "x" & Height.ValRegIndep).PadLeft(ReportValueLength))
- RetVal.Add("Total pixel : " & Samples.ValRegIndep.PadLeft(ReportValueLength))
- RetVal.Add("Total pixel : " & TotalPixel.PadLeft(ReportValueLength))
- RetVal.Add("ADU values count : " & DifferentADUValues.ValRegIndep.PadLeft(ReportValueLength))
- RetVal.Add(" in 25-75 pct : " & ADUValues2575.ValRegIndep.PadLeft(ReportValueLength))
- RetVal.Add("Min value : " & (Min.Key.ValRegIndep & " (" & Min.Value.ValRegIndep & "x)").PadLeft(ReportValueLength))
- RetVal.Add("Modus value : " & (Modus.Key.ValRegIndep & " (" & Modus.Value.ValRegIndep & "x)").PadLeft(ReportValueLength))
- RetVal.Add("Max value : " & (Max.Key.ValRegIndep & " (" & Max.Value.ValRegIndep & "x)").PadLeft(ReportValueLength))
- RetVal.Add("Median value : " & Median.ValRegIndep.PadLeft(ReportValueLength))
- RetVal.Add("Mean value : " & Format(Mean, "0.000").ToString.Trim.PadLeft(ReportValueLength))
- RetVal.Add("Standard dev. : " & Format(StdDev, "0.000").ToString.Trim.PadLeft(ReportValueLength))
- RetVal.Add("Variance : " & Format(Variance, "0.000").ToString.Trim.PadLeft(ReportValueLength))
- 'Data on histogram of ADU stepping
- If HistXDist_keys.Count = 0 Then
- RetVal.Add("ADU step size min : " & NotPresent.PadLeft(ReportValueLength))
- RetVal.Add("ADU different step: " & NotPresent.PadLeft(ReportValueLength))
- Else
- RetVal.Add("ADU step size min : " & Format(HistXDist_keys(0), "####0").ToString.Trim.PadLeft(ReportValueLength))
- RetVal.Add("ADU different step: " & Format(HistXDist_keys.Count, "####0").ToString.Trim.PadLeft(ReportValueLength))
- End If
- 'Percentile report
- For Each Pct As Integer In New Integer() {1, 5, 10, 25, 50, 75, 90, 95, 99}
- If Percentile.ContainsKey(Pct) Then RetVal.Add(("Percentil - " & Pct.ToString.Trim.PadLeft(2) & " % : ").PadRight(ReportHeaderLength) & Format(Percentile(Pct)).ToString.Trim.PadLeft(ReportValueLength))
- Next Pct
- Return RetVal
- End Function
- End Structure
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement