Help creating macro for rotating and cropping scanned films

imagej
#1

Hello,

I’m a complete newbie to ImageJ, macros and coding, so my apologies in advance for asking (what I hope is) a somewhat simple question, and thanks in advance for your help!

We irradiate and scan small pieces of film for quality assurance analysis. After scanning, we manually rotate the film such that it’s ‘straight,’ and then crop the borders outside the film. If it was possible, it would be great if this process was automated as this would save us a lot of time in the long run.

I’ve attached an example scanned film. There’s a slight rotation with a small white border outside the film. I’d like the rotation to be corrected (minor CCW rotation), as well as crop out the white borders. There will be some white background in the rectangular indentations of the film, which is fine.

After correcting for rotations and cropping the film, it’d be great if there was an option to rotate or mirror-flip the film across one axis. I’d like to create separate macros for these specific pathways.

Any help would be greatly appreciated, thanks again all!

film_pre.tif (256.1 KB)