@Test
public void testCropLevel3() throws IOException,
		MismatchedDimensionException, NoSuchAuthorityCodeException {

	// Get the resource.
	//
	final URL testFile = TestData.getResource(this, "goodpyramid/"+TEST_FILE);
	//
	// Get a reader
	//
	final AbstractGridFormat format = new ImagePyramidFormat();
	final ImagePyramidReader reader = (ImagePyramidReader) format.getReader(testFile);
	assertNotNull(reader);
	
	//
	// crop
	//
	final ParameterValue<GridGeometry2D> gg = ImageMosaicFormat.READ_GRIDGEOMETRY2D.createValue();
	final GeneralEnvelope oldEnvelop = reader.getOriginalEnvelope();
	final GeneralEnvelope cropEnvelope = new GeneralEnvelope(new double[] {
			oldEnvelop.getLowerCorner().getOrdinate(0),
			oldEnvelop.getLowerCorner().getOrdinate(1) }, new double[] {
			oldEnvelop.getLowerCorner().getOrdinate(0)
					+ oldEnvelop.getSpan(0) / 2,
			oldEnvelop.getLowerCorner().getOrdinate(1)
					+ oldEnvelop.getSpan(1) / 2 });
	cropEnvelope.setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
	gg.setValue(new GridGeometry2D(new GridEnvelope2D(new Rectangle(0, 0,
			25, 25)), cropEnvelope));
	//
	// Show the coverage
	//
	GridCoverage2D coverage = ((GridCoverage2D) reader
			.read(new GeneralParameterValue[] { gg }));
	assertNotNull("Null value returned instead of a coverage", coverage);
	// assertTrue("coverage dimensions different from what we expected",
	// coverage.getGridGeometry().getGridRange().getSpan(0) == 15
	// && coverage.getGridGeometry().getGridRange().getSpan(
	// 1) == 15);
	if (TestData.isInteractiveTest())
		coverage.show("testCropLevel1");
	else
	        PlanarImage.wrapRenderedImage(((GridCoverage2D) coverage).getRenderedImage()).getTiles();
}