private void dataAnalyze(String path) { mGlobalData = load(path); SetGraph(mGlobalData, mShowingFrameFrom, mShowingFrameTo); List <StNormalizedIntensity> intensities = null; mPostResult = Kernel.PostAnalyze(mGlobalData, out intensities, mNoiseSampleMean, mShowingFrameFrom, mShowingFrameTo); SetHistogram(intensities); }
public static StPostAnalyzeResult PostAnalyze(Decimal[] data, out List <StNormalizedIntensity> pointIntensities, Decimal noise, int frameFrom, int frameTo) { StPostAnalyzeResult retval = new StPostAnalyzeResult(); pointIntensities = new List <StNormalizedIntensity>(); List <Decimal> accuIntensities = new List <Decimal>(); Decimal curSpanIntensityBuf = 0; int curSpanFrameCount = 0; bool OnMove = false; for (int i = frameFrom; i <= frameTo; i++) { if (data[i] > noise && OnMove == false)//status change to On { OnMove = true; retval.MovementCount++; curSpanFrameCount++; curSpanIntensityBuf += (data[i] - noise); } else if (data[i] < noise && OnMove == true)//status change to Off { OnMove = false; accuIntensities.Add(curSpanIntensityBuf); StNormalizedIntensity intensity = new StNormalizedIntensity(); intensity.Intensity = curSpanIntensityBuf / curSpanFrameCount; intensity.Duration = curSpanFrameCount; pointIntensities.Add(intensity); curSpanIntensityBuf = 0; curSpanFrameCount = 0; } else if (data[i] > noise && OnMove == true)//still On { curSpanFrameCount++; curSpanIntensityBuf += (data[i] - noise); } else //still off { //immobility duration retval.ImmobilityDureation++; } } if (curSpanIntensityBuf - 0 > EPSILON) { accuIntensities.Add(curSpanIntensityBuf); StNormalizedIntensity intenLeft = new StNormalizedIntensity(); intenLeft.Intensity = curSpanIntensityBuf / curSpanFrameCount; intenLeft.Duration = curSpanFrameCount; pointIntensities.Add(intenLeft); } //frame count retval.FrameCount = frameTo - frameFrom + 1;//multiple span mani till here //intentsity mean for (int i = 0; i < accuIntensities.Count; i++) { retval.MovementIntentsityMean += accuIntensities[i]; } if (accuIntensities.Count != 0) { retval.MovementIntentsityMean /= accuIntensities.Count; } else { retval.MovementIntentsityMean = 0; } //intentsity SD retval.MovementIntensitySD = getSD(retval.MovementIntentsityMean, accuIntensities.ToArray()); return(retval); }