My guess (and it’s just a guess) is that this is a race condition. The paste is happening AFTER the rotate. Try inserting a wait after every operation.
—- Kenneth Sloan (von meinem iPhone13 gesendet) On Wed, Jan 22, 2025 at 07:05 William Rust <[email protected]> wrote: > 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 > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
