/** Apply a Generic Piecewise operation on the underlying image. */ public ImageWorker piecewise(PiecewiseTransform1D transform, Integer bandIndex) { ParameterBlock pb = new ParameterBlock(); pb.setSource(image, 0); // The source image. pb.set(transform, 0); pb.set(bandIndex, 1); pb.set(roi, 2); pb.set(nodata, 3); if (isNoDataNeeded()) { if (transform.hasGaps()) { // We must set the new NoData value setNoData( RangeFactory.create( transform.getDefaultValue(), transform.getDefaultValue())); } } image = JAI.create("GenericPiecewise", pb, getRenderingHints()); return this; }