code: public static void rotateCCW( GrayS64 image ) {
  		if( image.width != image.height )
  			throw new IllegalArgumentException("Image must be square");
  
  		int w = image.height/2 + image.height%2;
  		int h = image.height/2;
  
  		for( int y0 = 0; y0 < h; y0++ ) {
  			int y1 = image.height-y0-1;
  
  			for( int x0 = 0; x0 < w; x0++ ) {
  				int x1 = image.width-x0-1;
  
  				int index0 = image.startIndex + y0*image.stride + x0;
  				int index1 = image.startIndex + x0*image.stride + y1;
  				int index2 = image.startIndex + y1*image.stride + x1;
  				int index3 = image.startIndex + x1*image.stride + y0;
  				
  				long tmp0 = image.data[index0];
  
  				image.data[index0] = image.data[index1];
  				image.data[index1] = image.data[index2];
  				image.data[index2] = image.data[index3];
  				image.data[index3] = (long)tmp0;
  			}
  		}
  	}
docs: In-place 90 degree image rotation in the counter-clockwise direction.  Only works on
  square images.