Hi Herbie,

It should be:

   run("Images to Stack","name=Seeds title=#");
   setBatchMode(false);
   exit();

Best wishes
Kees

Advanced Imaging Facility (RRID: SCR_020967)
University of Leicester
http://www.le.ac.uk/advanced-imaging-facility


-----Original Message-----

Sent: 23 January 2025 12:56
Subject: Re: can't rotate pasted image

***CAUTION:*** This email was sent from an EXTERNAL source. Think before 
clicking links or opening attachments.

Dear Jeremy,
dear listers!

Attached please find my macro with the mechanism suggested by Jeremy!

Interestingly, I wasn't able to make it work properly with

   run("Images to Stack","name=Seeds title=#");
   setBatchMode(true);
   exit();

instead of

   setBatchMode("exit and display");
   run("Images to Stack","name=Seeds title=#");
   exit();

In the former case, all slices are magically doubled.

Regards

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
> http://www.u/
> u.se%2Fbiovis&data=05%7C02%7Ckrs5%40leicester.ac.uk%7C7d25261c29dc48b1
> 8c2808dd3bb43805%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C0%7C63873236
> 7428985559%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjA
> uMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C
> &sdata=MTWYJHWhjuVbAAOMqDOry6BILoCUiFF8UshMPKyge7o%3D&reserved=0
>
> Dag Hammarskjölds v 20
> 751 85 UPPSALA, SWEDEN
> http://biovi/
> s.uu.se%2F&data=05%7C02%7Ckrs5%40leicester.ac.uk%7C7d25261c29dc48b18c2
> 808dd3bb43805%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7C0%7C63873236742
> 9002201%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMD
> AwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sd
> ata=VtIDLjWUxSP3ejVIlph0DKyAPvKIj471O3akzrmiKTk%3D&reserved=0
> ===============================================
>
>
>
>
> -----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://image/
> j.nih.gov%2Fij%2Flist.html&data=05%7C02%7Ckrs5%40leicester.ac.uk%7C7d2
> 5261c29dc48b18c2808dd3bb43805%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7
> C0%7C638732367429013911%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydW
> UsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D
> %7C0%7C%7C%7C&sdata=fGmb56SidQ2M3blotMQMXae%2FL0AQ61Gd741Z%2FJTTkNU%3D
> &reserved=0
>
> 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.u/
> u.se%2Fom-uu%2Fdataskydd-personuppgifter%2F&data=05%7C02%7Ckrs5%40leic
> ester.ac.uk%7C7d25261c29dc48b18c2808dd3bb43805%7Caebecd6a31d44b0195ce8
> 274afe853d9%7C0%7C0%7C638732367429025618%7CUnknown%7CTWFpbGZsb3d8eyJFb
> XB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCI
> sIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=yOiOKDxU48lVDTngBx8YZTVASURJz4lPE
> 3zydSPMeGc%3D&reserved=0
>
> 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.u/
> u.se%2Fen%2Fabout-uu%2Fdata-protection-policy&data=05%7C02%7Ckrs5%40le
> icester.ac.uk%7C7d25261c29dc48b18c2808dd3bb43805%7Caebecd6a31d44b0195c
> e8274afe853d9%7C0%7C0%7C638732367429037029%7CUnknown%7CTWFpbGZsb3d8eyJ
> FbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpb
> CIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=DBWFpxcnEekpQ5hj51o3NFDS3kDcnl%
> 2BZBZ%2BmZ9Zk90M%3D&reserved=0
>
> --
> ImageJ mailing list:
> http://image/
> j.nih.gov%2Fij%2Flist.html&data=05%7C02%7Ckrs5%40leicester.ac.uk%7C7d2
> 5261c29dc48b18c2808dd3bb43805%7Caebecd6a31d44b0195ce8274afe853d9%7C0%7
> C0%7C638732367429048204%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydW
> UsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D
> %7C0%7C%7C%7C&sdata=nJBePGpd%2Bc9y40H79znRKqu9TzzXnLiFyNa3I8tieWg%3D&r
> eserved=0
>


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Reply via email to