Exemplo n.º 1
0
bool ZStackBinarizer::binarize(Stack *stack)
{
  if (stack == NULL) {
    return false;
  }

  int threshold = m_threshold;
  int *hist = NULL;

  Stack *refStack = C_Stack::clone(m_reference);
  if (refStack == NULL) {
    refStack = stack;
  }

  int low = m_lowerBound;
  int high = m_upperBound;

  switch (m_method) {
  case BM_RC_THRESHOLD:
  case BM_STABLE_POINT:
  case BM_TRIANGLE:
    hist = Stack_Hist(refStack);
    break;
  case BM_LOCMAX:
    hist = computeLocmaxHist(refStack);
    break;
  default:
    break;
  }

  if (hist != NULL) {
    if (m_lowerBound < 0) {
      low = Int_Histogram_Min(hist);
    }

    if (m_upperBound < 0) {
      high = Int_Histogram_Max(hist);
    }
  }

  if (low == high && hist != NULL) {
    BINARIZE_CLEAN
    return false;
  }
Exemplo n.º 2
0
int ZIntHistogram::getMaxValue() const
{
    return Int_Histogram_Max(m_hist);
}