in our Lab we use OrientationJ to determine the rotation angle of microscope images that exhibit a periodic structure in order to align them.
An example ImageJ macro is this:
// REGISTER TO FIRST FRAME AND FIRST CHANNEL print("Computing angle..."); setBatchMode(false); // OrientationJ fails in Batch mode (process ultimately gets killed) Stack.setFrame(1); Stack.setChannel(1); run("Duplicate...", "title=first"); run("OrientationJ Analysis", "log=0.0 tensor=10.0 gradient=0 hsb=off orientation=on radian=off "); close(); // close HSB color-survey // find the mode of this orientation image getHistogram(values, counts, 10000); close(); // close orientation image rks = Array.reverse( Array.rankPositions(counts) ); angle = values[ rks ];
I am in the process of implementing our analysis in Python and looking to achieve something similar.
Is there a port of OrientationJ for Python?
Below is an example image showing the periodic structure that I want to align (microfluidic channels; this is a rather extreme example of misalignment). Note that I have also tried alternative methods (Fourier transform based), but I was unabel not reached the accuracy achieve by OrientationJ, which I why I am looking for something similar under Python.