public void calAutoCorrelation_RingMean(
      int
          nRefType) { // crosscorrelation coefficients between pixel valuse and the means and
                      // medians of the pixels located on the cocentric rings with radius up to
                      // m_nRMax
    m_nRefType = nRefType;
    int numRings = m_cvRings.size();
    calRefPixels();
    int r, c;
    int len = m_cIMSC.m_nTotalSteps + 1;
    double[] pixels0 = new double[len];
    double[] meanr = new double[len];
    double[] medianr = new double[len];

    int index = 0;

    Point p;
    index = 0;
    while (true) {
      p = m_cIMSC.getPosition();
      pixels0[index] = m_pnPixelsLR[p.y][p.x];
      index++;
      if (m_cIMSC.done()) break;
      m_cIMSC.move();
    }

    ImageShape shape;
    Histogram hist = CommonMethods.getDefaultHistogram(m_pnPixelsLR);

    int y, y0 = 0;
    int nRef;
    for (c = 0; c < numRings - 1; c++) {
      index = 0;
      m_cIMSC.reset();
      y0 = m_cIMSC.getPosition().y;
      shape = m_cvRings.get(c);
      while (true) {
        p = m_cIMSC.getPosition();
        nRef = getRefPixel(p);
        y = p.y;
        if (y > y0) {
          IJ.showStatus(
              "calAutoCorrelation_RingMean: r="
                  + PrintAssist.ToString(c + 1)
                  + "   y="
                  + PrintAssist.ToString(y));
          y0 = y;
        }
        CommonMethods.fillHistogram(m_pnPixels, nRef, shape, p, hist);
        meanr[index] = hist.getMean();
        medianr[index] = hist.getPercentileValue();
        index++;
        if (m_cIMSC.done()) break;
        m_cIMSC.move();
      }
      m_pdAutoCorr_mean[c] = CommonStatisticsMethods.crossCorrelationCoefficient(pixels0, meanr, 0);
      m_pdAutoCorr_median[c] =
          CommonStatisticsMethods.crossCorrelationCoefficient(pixels0, medianr, 0);
    }
  }