Thanks Jeremy, that's really a nice approach. Chapeau!
Herbie ::::::::::::::::::::::::::::::::::::::::: Am 22.01.25 um 18:32 schrieb Jeremy Adler:
A slightly simpler variant on Herbie's macro. Once you have a selection for single objects, use "Fit Rectangle" and then duplicate. The duplicated part of the image is rotated. Jeremy =============================================== B i o V i s P l a t f o r m of Uppsala University Light & EM microscopy / FlowCytometry & Cell Sorting / Image Analysis =============================================== Jeremy Adler PhD - Senior research engineer Light, Confocal Microscopy, Image Analysis E-mail: [email protected] 0739 188170 www.uu.se/biovis Dag Hammarskjölds v 20 751 85 UPPSALA, SWEDEN http://biovis.uu.se/ =============================================== -----Original Message----- From: Herbie <[email protected]> Sent: Wednesday, January 22, 2025 3:57 PM To: [email protected] Subject: Re: can't rotate pasted image Slightly off-topic William! Some years ago I was asked to write a macro that performs this task on rice seeds. Attached please find the "revived" macro-code and a test-image. The macro requires two ImageJ-plugins. Good to hear you resolved the Java-problem. Regards Herbie ::::::::::::::::::::::::::::::::::::::::: Am 22.01.25 um 13:04 schrieb William Rust:I'm writing code in java. What I am trying to do is take an image with 20 wheat kernels in a petri dish and put each kernel in its own image with the kernel rotated so all kernels are roughly vertical. Here's the code snippet where I am doing it. ImageProcessor newIp = new ColorProcessor(300, 300); ImagePlus newImp = new ImagePlus("sub " + idx, newIp); newIp.setColor(background); newIp.fill(); imp.copy(); newImp.paste(); newImp.getProcessor().rotate(angle[idx]); newImp.updateAndDraw(); newImp.show(); Previously, I've cut the subimage out of the original image using the bounding box from analyze particles. The weirdness occurs somewhere between the paste and the rotate. The pasting works whether I do the rotate or not. But when I paste, the rotate does not work. And, if I don't paste, the rotate does work (I can tell this because the background is tilted after a rotate with no paste but not with rotate and paste). This snippet shows one of the things that I've tried, the updateAndDraw(), but nothing has worked. Any ideas on what I'm doing wrong? Thanks, wjr.-- ImageJ mailing list: http://imagej.nih.gov/ij/list.html VARNING: Klicka inte på länkar och öppna inte bilagor om du inte känner igen avsändaren och vet att innehållet är säkert. CAUTION: Do not click on links or open attachments unless you recognise the sender and know the content is safe. När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/ E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
-- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
