public boolean rotateImage(Image i, File outputFile, boolean clockwise) {
ImagePlus ip = ((ImageJImage)i).getImagePlus();
ImageProcessor processor = ip.getProcessor();
if (clockwise) {
processor = processor.rotateRight();
} else {
processor = processor.rotateLeft();
}
ip.setProcessor(null, processor);