Run Bicubic interpolation from a plug-in

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Run Bicubic interpolation from a plug-in

Xavier Colomé
Hello. I'm wondering if it is possible to run a menu option (by example a
bicubic interpolation), from a plug-in function (inside the function).

Thank you so much.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Run Bicubic interpolation from a plug-in

Michael Schmid
On Sat, April 4, 2015 12:31, Xavier Colomé wrote:
> Hello. I'm wondering if it is possible to run a menu option (by example a
> bicubic interpolation), from a plug-in function (inside the function).

Hi Xavier,

for most menu commands simply use Plugins>Macros>Record in 'Java' mode to
get a Java call.  E.g. of Image>Adjust>Size you will get

  IJ.run(imp, "Size...", "width=500 height=500 average
interpolation=Bicubic");

If you want programming at a lower level, typically one would search for
the command with Plugins>Utilities>Find Command ([ctrl]-SHIFT-L) and look
at the source code of the class displayed in the CommandFinder.
For Image>Adjust>Size, you will find out that it is done by
ij.olgin.Resizer, which gets the list of interpolation methods via
ImageProcessor.getInterpolationMethods();
and then it sets the interpolation method if the ImageProcessor ip by
  ip.setInterpolationMethod(interpolationMethod);
where interpolationMethod can be e.g. ImageProcessor.BICUBIC

Michael

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