Inconsistent aliasing artifact post stack rotation

fiji
imagej
imagej2
rotation

#1

Thanks for redirecting me to the proper place to make a post, @imagejan!

I’m relatively new to image processing. I’ve written a script that helps me to align images to the same orientation for viewing, but I seem to get an artifact with some of these images. The script figures out the xy rotation needed by comparing line ROIs between a reference image and each of the other images. When I project the processed images from this script, some of them produce max projections with a fuzzy grid artifact, whereas if I project before doing any rotation, it goes away:

This same artifact does not affect summed projections or average projections. Does anyone know why this happens?

Edit: Here’s a code snippet of the part of my batch processing that does the rotation in ImageJ2:

setTool("line");
waitForUser("Flip if necessary, then mark the line \nto orient the image.");

getSelectionCoordinates(x,y);
run("Select None");

guideAngle = getAngle(x[0],y[0],x[1],y[1]);
rotate = refAngle - guideAngle;

getDimensions(initx,inity,ch,sl,tr);
run("Rotate... ", "angle="+rotate+" grid=1 interpolation=Bilinear enlarge stack");

function getAngle(x1,y1,x2,y2) {
getDimensions(w,h,ch,sl,fr);
// Translate to centre origin cartesian
x1 = x1-(w/2);
x2 = x2-(w/2);
y1 = (h/2)-y1;
y2 = (h/2)-y2;

deltx = x2-x1;
delty = y2-y1;
angle = atan2(deltx,delty)*180/PI;
return(angle);

}

The angle of the reference line is calculated in the same way from a line ROI, outside of my function that I use to loop over a directory.


#2

Good day Rachael A. Wyatt,

it would be helpful if you could tell us how you perform the rotation, epecially which interpolation scheme you use. A macro code snippet would be helpful.

Furthermore, it would be helpful to know whether you use Fiji-ImageJ-1 or -ImageJ-2.

Regards

Herbie