if (0 < pointsCount-1) ps.standardDeviation = Math.sqrt( (ps.sumOfSquares - ps.sum*ps.sum/pointsCount) /(pointsCount-1));
ps.pointsCount = pointsCount; if (0 < pointsCount-1) { double sigmaSquare = (ps.sumOfSquares - ps.sum*ps.sum/pointsCount)/(pointsCount-1); if (sigmaSquare > 0) ps.standardDeviation = Math.sqrt(sigmaSquare); }
    public void onEndPlane(int z, int w, int t, int pointsCount)    {        Integer index = linearize(z, w, t);        ROIPlaneStats ps = (ROIPlaneStats) arrayMap.get(index);        //planeStats can't be null, see onStartPlane().        if (0 < pointsCount) {            ps.mean = ps.sum/pointsCount;            if (0 < pointsCount-1)                ps.standardDeviation = Math.sqrt(                        (ps.sumOfSquares - ps.sum*ps.sum/pointsCount)                        /(pointsCount-1));        }    }