code: public static boolean isSourcePixel( RandomIter flowIter, int col, int row ) {
          double flowDirection = flowIter.getSampleDouble(col, row, 0);
          if (flowDirection < 9.0 && flowDirection > 0.0) {
              for( int k = 1; k <= 8; k++ ) {
                  if (flowIter.getSampleDouble(col + dirIn[k][1], row + dirIn[k][0], 0) == dirIn[k][2]) {
                      return false;
                  }
              }
              return true;
          } else {
              return false;
          }
      }
docs: Verifies if the point is a source pixel in the supplied flow raster.
  
  @param flowIter the {@link RandomIter iterator} of the flowdirections.
  @param col the col of the point to check.
  @param row the row of the point to check.
  @return true if the point identified by col and row is a source pixel.