Loading drift files from "Correct 3D drift"

Hello, I really like the plugin “Correct 3D drift”, the only problem I find is that it does not provide any built-in functionality to load the text files one can create with the option Only compute drift vectors?. Sometimes you might be wanting to apply the drift you calculated in a projection to a stack. Here is a code snippet that does the trick (for drift in x-y only though, but I guess easily extendible to 3d).

pathfile=File.openDialog("Choose the file to Open:");
filestring=File.openAsString(pathfile);
rows=split(filestring, "\n");
// Skip the first 5 rows which contain no drift information
rows=Array.slice(rows,5,rows.length);
x=newArray(rows.length);
y=newArray(rows.length);

for(i=0; i<rows.length; i++){
	columns=split(rows[i],"\t");
	x[i]=parseInt(columns[0]);
	y[i]=parseInt(columns[1]);
}

width = getWidth();
height = getHeight();

Array.getStatistics(x, min_x, _,_, _);
Array.getStatistics(y, min_y, _,_, _);
run("Duplicate...", "duplicate");
run("Canvas Size...", "width="+width-min_x+" height="+height-min_y+" position=Bottom-Right");


Stack.getDimensions(_, _, channels, slices, frames)

// Iterate through time
for(f=1; f<=frames; f++)
{
	Stack.setFrame(f);	
	// Iterate through slices
	for(s=1; s<=slices; s++)
	{
		Stack.setSlice(s);		
		//Iterate through channels
		for(c=1; c<=channels; c++)
		{
			Stack.setChannel(c);
			// Substract the 1, because the arrays are zero-based indexed
			run("Translate...", "x="+x[f-1]+" y="+y[f-1]+" interpolation=None slice");
		}
	}
}