final int height=originalRange.getSpan(1);
final int maxX=minX+(width<=5?width:5);
final int maxY=minY+(height<=5?height:5);
//we have to be sure that we are working against a valid grid range.
final GridEnvelope2D testRange= new GridEnvelope2D(minX,minY,maxX,maxY);
//build the corresponding envelope
final MathTransform gridToWorldCorner = reader.getOriginalGridToWorld(PixelInCell.CELL_CORNER);
final GeneralEnvelope testEnvelope =CRS.transform(gridToWorldCorner,new GeneralEnvelope(testRange.getBounds()));
testEnvelope.setCoordinateReferenceSystem(nativeCRS);
parameters.put(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName().toString(),
new GridGeometry2D(testRange, testEnvelope));