private float[] calculateStartPoint(FloatPolygon thumbnailPolygon, FloatPolygon slidePolygon){

		float[] xThumb = thumbnailPolygon.xpoints;
		float[] yThumb = thumbnailPolygon.ypoints;
		float[] xSlide = slidePolygon.xpoints;
		float[] ySlide = slidePolygon.ypoints;

		if(avgROIzoomRatioXY == null) avgROIzoomRatioXY = new float[2];
		avgROIzoomRatioXY[0] = 0;
		avgROIzoomRatioXY[1] = 0;

		float thumbSizeX = lowresScanImage.getWidth();


		int npoints = thumbnailPolygon.npoints-1;
		float[] xRatio = new float[npoints];
		float[] yRatio = new float[npoints];
		float[] xStartPoints = new float[npoints];
		float[] yStartPoints = new float[npoints];
		float xAverage = 0, yAverage = 0, xStd = 0, yStd = 0, xFinal = 0, yFinal = 0;
		float ratioAverageX = 0, ratioAverageY = 0, ratioStdX = 0, ratioStdY = 0;


		//calculate the ratio of a line between two points in the Slide image and Thumbnail image (gives x and y scaling)
		//then use this scaling factor to calculate the estimated start point for each.
		for(int i=0; i<npoints; i++){
			xRatio[i] = (xSlide[i+1] - xSlide[i]) / ((thumbSizeX - xThumb[i+1]) - (thumbSizeX - xThumb[i]));
			yRatio[i] = (ySlide[i+1] - ySlide[i]) / (yThumb[i+1] - yThumb[i]);
			ratioAverageX += xRatio[i];
			ratioAverageY += yRatio[i];
			xStartPoints[i] = xSlide[i] - ((thumbSizeX - xThumb[i]) * xRatio[i]);
			yStartPoints[i] = ySlide[i] - (yThumb[i] * yRatio[i]);
			xAverage += xStartPoints[i];
			yAverage += yStartPoints[i];
		}

		xAverage /= npoints;
		yAverage /= npoints;
		ratioAverageX /= npoints;
		ratioAverageY /= npoints;

		//The above calculated start point has a few outliers that throw off estimation badly, so calculate standard dev.
		for(int i=0; i<npoints; i++){
			xStd = (float) (xStd + Math.pow(xStartPoints[i] - xAverage, 2));
			yStd = (float) (yStd + Math.pow(yStartPoints[i] - yAverage, 2));

			ratioStdX = (float) (ratioStdX + Math.pow(xRatio[i] - ratioAverageX, 2));
			ratioStdY = (float) (ratioStdY + Math.pow(yRatio[i] - ratioAverageY, 2));
		}

		xStd = (float) Math.sqrt(xStd / npoints);
		yStd = (float) Math.sqrt(yStd / npoints);
		ratioStdX = (float) Math.sqrt(ratioStdX / npoints);
		ratioStdY = (float) Math.sqrt(ratioStdY / npoints);


		//and only take the average of values inside the standard deviation. Gives MUCH better estimate.
		int xCounter = 0, yCounter = 0, ratioCounterX = 0, ratioCounterY = 0;
		for(int i=0; i<npoints; i++){
			if(Math.abs(xStartPoints[i] - xAverage) < xStd){
				xFinal += xStartPoints[i];
				xCounter++;
			}
			if(Math.abs(yStartPoints[i] - yAverage) < yStd){
				yFinal += yStartPoints[i];
				yCounter++;
			}

			if(Math.abs(xRatio[i] - ratioAverageX) < ratioStdX){
				avgROIzoomRatioXY[0] += xRatio[i];
				ratioCounterX++;
			}
			if(Math.abs(yRatio[i] - ratioAverageY) < ratioStdY){
				avgROIzoomRatioXY[1] += yRatio[i];
				ratioCounterY++;
			}
		}

		avgROIzoomRatioXY[0] /= ratioCounterX;
		avgROIzoomRatioXY[1] /= ratioCounterY;

		float[] retVal = new float[2];
		retVal[0] = (xFinal/xCounter) - thumbSizeX*Math.abs(avgROIzoomRatioXY[0]);
		retVal[1] = yFinal/yCounter;

		return retVal;

	}