Grayscale image processing

We are currently using white LEDs for our vision tracking, so I made up some code in ni vision assistant that removes everything except the target by turning the light on and off. I can’t convert this code to java because the only methods in MonoImage.class are to detect ellipses.
How can I use grayscale threshold and grayscale operators in java?