![]() | ![]() |
![]() |
Previous Message |
Next Message Previous in Topic | Next in Topic Previous by Same Author | Next by Same Author Previous Page (December 2007) | Back to Main IMAGEJ Page | | ![]()
Reply
| Post a New Message |
Join or Leave IMAGEJ, or Change Options
|
Search | ![]()
Chronologically |
Most Recent First |
Wrap Text (Proportional Font) |
Don't Wrap Text (Non-proportional Font) | ![]() |
Approved-By: [log in to unmask] References: <[log in to unmask]> Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Message-ID: <[log in to unmask]> Date: Thu, 6 Dec 2007 10:44:44 -0500 Reply-To: ImageJ Interest Group <[log in to unmask]> Sender: ImageJ Interest Group <[log in to unmask]> From: Younes Leysi Derilou <[log in to unmask]> Subject: Re: zooming on a region In-Reply-To: <[log in to unmask]>Hello Dear Audrey, Thanks so much for your nice attention to my email and sending the macro. I saved the text as a macro in the IJ macros folder, opened an image and then run the macro. it shows an error that ''undefined variable in line 1 <import> ij.*". this comes up either I chose a region or not before running macro. sorry i am not good in macro writing. If I put "//" in the first line, the same error comes up for the next lines. I would appreciate it, if you could let me have a macro that I can run it easily. Thanks so much and best regards, Younes On Dec 5, 2007 1:56 PM, audrey karperien <[log in to unmask]> wrote: > Hi. Wayne recently helped me with the below plugin, which I used to make > some animations for a presentation. It zooms in until the selected area is > the full screen size then you save the stack of images as an animation in > ImageJ. I have been saving the stack as avi or animated gif files, but in > the code here I slipped in a line that will also save it as an avi into the > ij path, which you can uncomment // IJ.saveAs("AVI... ", "myfileZoom.avi") > and change to save where you want. For animated gifs, I use the gif stack > writer plugin. This code zooms from the onscreen image down to the > selection size, using a gradient set differently each time, which is what I > needed, but Wayne wrote some code that zooms starting with the selection and > the way he did it is smoother and faster, I just haven't fully implemented > it in this yet; you can find it in the list a few weeks back or email me and > I will find it for you. Hope this helps. > > import ij.*; > import ij.gui.Roi; > import ij.gui.StackWindow; > import ij.plugin.*; > import ij.process.ImageProcessor; > > public class zoomer_ implements PlugIn { > > public int height = 100; > public int width = 100; > public int roiheight = 100; > public int roiwidth = 100; > > String NAME; > public void run(String arg) > { > ImagePlus img=IJ.getImage(); > height=img.getHeight(); > width=img.getWidth(); > Roi roi = img.getRoi(); > if (roi==null) > { > IJ.showMessage("Please select an roi then try again"); > return; > } > > String NAME=img.getTitle(); > double scale=80; > scale=IJ.getNumber("Rate of Scaling (%)?", (double)scale); > roiwidth=(int)roi.getBounds().getWidth(); > roiheight=(int)roi.getBounds().getHeight(); > int w =(int)( width*(scale/100f)); > int h = (int)( height*(scale/100f)); > > int cx = (int)roi.getBounds().getCenterX(); > int cy = (int)roi.getBounds().getCenterY(); > //scale it each time by the same amount > //the user determines the amount by > //inputting a number for the rate of scaling > //e.g., if the rate of scaling is 50, > //then the roi is always 50% of the current size > > ImageStack s= new ImageStack(width, height); > ImageProcessor ip = img.getProcessor(); > ip.snapshot(); > for (int i = w, j = h; > (i > roiwidth)&&(j>roiheight); > i=(int)( i*(scale/100f)), j=(int)( j*(scale/100f))) > { > IJ.makeRectangle > (cx-i/2,cy-j/2, i, j); > IJ.run("Size...", > "width="+width+ > " height="+height+ > " constrain interpolate"); > String name=NAME+i; > if(WindowManager.getCurrentImage > ().getHeight()!=height|| > WindowManager.getCurrentImage > ().getWidth()!=width) > IJ.run("Canvas Size...", "width="+width+ > " height="+height+" position=Center"); > s.addSlice(name, img.getProcessor().duplicate()); > // WindowManager.getCurrentImage > ().getProcessor()); > IJ.run("Revert"); > } > IJ.run("Revert"); > img.setRoi(roi); > StackWindow sw=new StackWindow(new ImagePlus(NAME+"Zoom", s)); > sw.setVisible(true); > // IJ.saveAs("AVI... ", "myfileZoom.avi"); > > } > > > } > > > > ----- Original Message ---- > From: Younes Leysi Derilou <[log in to unmask]> > To: [log in to unmask] > Sent: Wednesday, December 5, 2007 7:11:28 AM > Subject: zooming on a region > > Hello ImageJ Users, > > I am wondering if there is a pluging to do zooming in/out in an image > or > image stack and save this action as a movie. > any help is highly appreciated in advance. > > Sincerely, > Younes >
![]() |
![]() Center for Information Technology National Institutes of Health Bethesda, Maryland 20892 301 594 6248 (v) 301 496 8294 (TDD) Comments and Assistance Accessibility ![]() |