loading an image in a ImagePlus object

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

loading an image in a ImagePlus object

Francesco De Comite
Hi everybody,

I am writing a class extending ImagePlus. How can I load an image (PNG a
priori) from inside the run method ?
any hints ?

    Regards

--


Francesco De Comite
tel (33) 03 28 77 85 72
fax (33) 03 28 77 85 37
www.lifl.fr/~decomite
Reply | Threaded
Open this post in threaded view
|

Re: loading an image in a ImagePlus object

dscho
Hi,

On Thu, 26 Nov 2009, Francesco.Decomite wrote:

> I am writing a class extending ImagePlus. How can I load an image (PNG a
> priori) from inside the run method ? any hints ?

Use the setStack() method.

Ciao,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: loading an image in a ImagePlus object

Wayne Rasband
In reply to this post by Francesco De Comite
On Nov 26, 2009, at 10:40 AM, Francesco.Decomite wrote:

> Hi everybody,
>
> I am writing a class extending ImagePlus. How can I load an
> image (PNG a priori) from inside the run method ?
> any hints ?

Here is an example of a plugin that extends ImagePlus and loads an  
image in its run method.

   import ij.*;
   import ij.plugin.*;
   public class Image_Loader extends ImagePlus implements PlugIn {
      public void run(String path) {
         ImagePlus imp = IJ.openImage(path);
         setStack(null, imp.getStack());
         setCalibration(imp.getCalibration());
         show(); // display the image
      }
   }

-wayne