Hi everyone,
I am trying to implement python code where I can load two images, apply the “Rigid Registration” plugin on ImageJ, and returned the transformed and original images.
I’ve posted my code below. I am just using one image I pulled off google for both images just until I get something working. I followed along with the ImageJ + Python kernel but I couldn’t get something running.
I also recorded the macro to get the arguments listed below (though the two last arguments don’t have labels and produce syntax errors).
Any help appreciated. Thank you!
Img1 = io.imread('https://acdbio.com/sites/default/files/styles/sample_image/public/M-IL-8-8-hr_0.jpg')
img2 = io.imread('https://acdbio.com/sites/default/files/styles/sample_image/public/M-IL-8-8-hr_0.jpg')
#take the average over the 3 color channels and display as greyscale
img1 = np.mean(img1,axis=2)
img2 = np.mean(img2,axis=2)
plugin = 'Rigid Registration'
args = {
'initialtransform': [],
'n': 1,
'tolerance': 1.000,
'level': 4,
'stoplevel': 2,
'materialcenterandbbox': [],
'level': [],
'showtransformed': 1,
'template': img1,
'measure': 'Correlation'
'img2'
'transformed_1'
}
ij.py.run_plugin(plugin, args)
WindowManager = autoclass('ij.WindowManager')
reg_img = WindowManager.getCurrentImage()