code: @SuppressWarnings("unchecked")
      public static Collection<Polygon> doVectorize( GridCoverage2D src, Map<String, Object> args ) {
          if (args == null) {
              args = new HashMap<String, Object>();
          }
  
          ParameterBlockJAI pb = new ParameterBlockJAI("Vectorize");
          pb.setSource("source0", src.getRenderedImage());
  
          // Set any parameters that were passed in
          for( Entry<String, Object> e : args.entrySet() ) {
              pb.setParameter(e.getKey(), e.getValue());
          }
  
          // Get the desintation image: this is the unmodified source image data
          // plus a property for the generated vectors
          RenderedOp dest = JAI.create("Vectorize", pb);
  
          // Get the vectors
          Collection<Polygon> polygons = (Collection<Polygon>) dest.getProperty(VectorizeDescriptor.VECTOR_PROPERTY_NAME);
  
          RegionMap regionParams = CoverageUtilities.getRegionParamsFromGridCoverage(src);
          double xRes = regionParams.getXres();
          double yRes = regionParams.getYres();
          final AffineTransform mt2D = (AffineTransform) src.getGridGeometry().getGridToCRS2D(PixelOrientation.CENTER);
          final AffineTransformation jtsTransformation = new AffineTransformation(mt2D.getScaleX(), mt2D.getShearX(),
                  mt2D.getTranslateX() - xRes / 2.0, mt2D.getShearY(), mt2D.getScaleY(), mt2D.getTranslateY() + yRes / 2.0);
          for( Polygon polygon : polygons ) {
              polygon.apply(jtsTransformation);
          }
          return polygons;
      }
docs: Helper function to run the Vectorize operation with given parameters and
  retrieve the vectors.
  
  @param src the source {@link GridCoverage2D}.
  @param args a {@code Map} of parameter names and values or <code>null</code>.
  
  @return the generated vectors as JTS Polygons