Array2DSubstract < Value >::Array2DSubstract(const Array2D < Value > &src1,
                                               const Array2D < Value > &src2)
  :
  Array2D <
Value > (src1.xsize(), src1.ysize())
{
  if ((src1.xsize() != src2.xsize()) || (src1.ysize() != src2.ysize())) {
    fprintf(stderr,
            "Array2DSubstract: dimension of src1 and src2 must be the same!\n");
    return;
  }

  int x, y;
  for (y = 0; y < Array2D<Value>::ysize(); y++) {

    for (x = 0; x < Array2D<Value>::xsize(); x++) {
      set(x, y, src1.get(x, y) - src2.get(x, y));
    }
  }
}
  bool Array2DMedian < Value >::getSrcVal(int x, int y, Value & val,
                                          const Array2D < Value > &src)
{
  if ((x < 0) || (y < 0) 
      || (x >= Array2D<Value>::xsize()) || (y >= Array2D<Value>::ysize()))
    return false;
  val = src.get(x, y);

  if ((typeid(Value) == typeid(float)) && isnan(val))
      return false;
#if 0
#ifdef DEBUG
  printf("                (%d,%d) %f\n", x, y, val);
#endif
#endif
  return true;
}