package pl.wroc.pwr.roi.basic; import pl.wroc.pwr.IOperator1P; import pl.wroc.pwr.imagechannel.IImageChannel; import pl.wroc.pwr.roi.IROI; import pl.wroc.pwr.roi.model.ROIPixels; public class ROIFromThreshold implements IOperator1P { private float threshold; public ROIFromThreshold(float threshold) { this.threshold = threshold; } public IROI apply(IImageChannel inputChannel) { ROIPixels roi = new ROIPixels(inputChannel.getXSize(), inputChannel.getYSize()); for (int x = 0; x < inputChannel.getXSize(); x++) { for (int y = 0; y < inputChannel.getYSize(); y++) { if (inputChannel.getValue(x, y) >= this.threshold) { roi.quickAdd(x, y); } } } return roi; } }