It depends on your input and how noisy the data is.
Assuming you have 4 classes, but these classes have a certain grayscale value with a certain amount of noise.
As long as you see clear cuts in the histogram of these images, you might just use thresholds.
If you are seeing a wide spread of the noise such that classes are overlapping, you would have to think about either reducing the noise in your image or a smoothing strategy, which tries to keep the pixels in a certain area consistent.
Based from the output you’ve posted it seems that the noise is rather small (but check it with histograms).