I want to crop a rod shaped freehand roi from an image to generate an new image with roi content only using macro:
selectWindow(name); run("Create Mask"); selectWindow("Mask"); run("Subtract...", "value=254"); //make 255 to 1 imageCalculator("Multiply create",name,"Mask"); close("Mask");
. Sometimes the freehand roi are nearly vertical, horizontal or skewed. For vertical and horizontal, the cropped image occupy the majority, but for skewed one the image are larger.
Is there a way to rotate the raw image based on the roi drawn, then run the macro so that the roi fill most of image and file size can be reduced?