Help running an ImageJ plug-in with PyimageJ code

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('')

img2 = io.imread('')

#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'



}, args)

WindowManager = autoclass('ij.WindowManager')

reg_img = WindowManager.getCurrentImage()​