public static ShortImageBuffer threshold(ShortImageBuffer input, int threshold)
    {
        ShortImageBuffer after = input.copyShape();
        for(int y=0;y<input.getHeight();y++)
        {
            for(int x=0;x<input.getWidth();x++)
            {
                int v = input.get(y, x) & 0xFFFF;
                // if value is big enough, pass through
                if (v > threshold) after.set(y, x, (short)(v));
            }
        }
        return after;
    }