code: public static WritableRaster replaceNovalue( RenderedImage renderedImage, double newValue ) {
          WritableRaster tmpWR = (WritableRaster) renderedImage.getData();
          RandomIter pitTmpIterator = RandomIterFactory.create(renderedImage, null);
  
          int height = renderedImage.getHeight();
          int width = renderedImage.getWidth();
          for( int y = 0; y < height; y++ ) {
              for( int x = 0; x < width; x++ ) {
                  if (isNovalue(pitTmpIterator.getSampleDouble(x, y, 0))) {
                      tmpWR.setSample(x, y, 0, newValue);
                  }
              }
          }
          pitTmpIterator.done();
          return tmpWR;
      }
docs: Replace the current internal novalue with a given value.
  
  @param renderedImage a {@link RenderedImage}.
  @param newValue the value to put in instead of the novalue.
  @return the rendered image with the substituted novalue.