Dear ImageJ community,
I was just picking up on the thread "Re: Macro: Zoom in without changing window size (tiled display)" from last month. On a similar issue, does anyone know of a way to make the image snap to the screen in the macro language (like in Windows 7 when you drag a window to the edge of the screen)? For example, if I have an image that is 1056x960 pixels (width x height) and my screen size is 1080x1920, I would like the image to occupy all the space vertically. Is this possible to do in the macro language? Thank you, Greg. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Greg,
I think the macro code below does what you want getLocationAndSize(x, y, width, height); while (height+10 < screenHeight) { nWidth = width * (screenHeight/height); setLocation(0, 0, nWidth, screenHeight); getLocationAndSize(x, y, width, height); } Best wishes Kees Dr Ir K.R. Straatman Senior Experimental Officer Advanced Imaging Facility Centre for Core Biotechnology Services University of Leicester http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Gregory James [[hidden email]] Sent: 03 February 2015 12:33 To: [hidden email] Subject: Snap Image to Screen Dear ImageJ community, I was just picking up on the thread "Re: Macro: Zoom in without changing window size (tiled display)" from last month. On a similar issue, does anyone know of a way to make the image snap to the screen in the macro language (like in Windows 7 when you drag a window to the edge of the screen)? For example, if I have an image that is 1056x960 pixels (width x height) and my screen size is 1080x1920, I would like the image to occupy all the space vertically. Is this possible to do in the macro language? Thank you, Greg. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Gregory James
Yep, thanks Kees.
That's pretty damn close to what I want. I hope the ImageJ community can make good use of this code. In practice, I've added a line at the start and a line at the end to make it slightly more robust (to different image sizes, etc). run("Set... ", "zoom=50"); getLocationAndSize(x, y, width, height); while (height+10 < screenHeight) { nWidth = width * (screenHeight/height); setLocation(0, 0, nWidth, screenHeight); getLocationAndSize(x, y, width, height); } run("Out [-]"); Thanks again, Greg. ________________________________________ From: ImageJ Interest Group [[hidden email]] On Behalf Of Straatman, Kees (Dr.) [[hidden email]] Sent: 03 February 2015 15:52 To: [hidden email] Subject: Re: Snap Image to Screen Dear Greg, I think the macro code below does what you want getLocationAndSize(x, y, width, height); while (height+10 < screenHeight) { nWidth = width * (screenHeight/height); setLocation(0, 0, nWidth, screenHeight); getLocationAndSize(x, y, width, height); } Best wishes Kees Dr Ir K.R. Straatman Senior Experimental Officer Advanced Imaging Facility Centre for Core Biotechnology Services University of Leicester http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Gregory James [[hidden email]] Sent: 03 February 2015 12:33 To: [hidden email] Subject: Snap Image to Screen Dear ImageJ community, I was just picking up on the thread "Re: Macro: Zoom in without changing window size (tiled display)" from last month. On a similar issue, does anyone know of a way to make the image snap to the screen in the macro language (like in Windows 7 when you drag a window to the edge of the screen)? For example, if I have an image that is 1056x960 pixels (width x height) and my screen size is 1080x1920, I would like the image to occupy all the space vertically. Is this possible to do in the macro language? Thank you, Greg. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html ******************************************************************************************************************** This message may contain confidential information. If you are not the intended recipient please inform the sender that you have received the message in error before deleting it. Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents: to do so is strictly prohibited and may be unlawful. Thank you for your co-operation. NHSmail is the secure email and directory service available for all NHS staff in England and Scotland NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients NHSmail provides an email address for your career in the NHS and can be accessed anywhere ******************************************************************************************************************** -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |