Problem with IJ.noImage()

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

Problem with IJ.noImage()

hallockk
Hi,

I'm trying to implement a plugin from Digital Image Processing (by Burger and Burge) that shifts an image to the left by a specified number of pixels.  The shifting part of the plugin in works fine, but the initial part of the code gives me an error when I compile it.  Here's are the first 30 lines of the plugin:

/**
 * This sample code is made available as part of the book "Digital Image
 * Processing - An Algorithmic Introduction using Java" by Wilhelm Burger
 * and Mark J. Burge, Copyright (C) 2005-2008 Springer-Verlag Berlin,
 * Heidelberg, New York.
 * Note that this code comes with absolutely no warranty of any kind.
 * See http://www.imagingbook.com for details and licensing conditions.
 *
 * Date: 2010/01/27
 */

import ij.ImagePlus;
import ij.plugin.filter.PlugInFilter;
import ij.process.ImageProcessor;


public class XY_plugin implements PlugInFilter {

 ImagePlus im; // instance variable of this plugin object

 public int setup(String arg, ImagePlus im) {
  if (im==null) {
   IJ.noImage(); //currently no image is open
   return DONE;
  }
  this.im = im; // keep a reference to the image im
  return DOES_8G;
 }

--------

The error message is:

XY_plugin.java:24: cannot find  symbol
symbol: variable IJ
location: class XY_plugin
   IJ.noImage(); //currently no image is open
   ^
1 error

----------

Any suggestions for fixing this would be appreciated.  

Thanks,

Kevin Hallock
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IJ.noImage()

Michael Schmid
Hi Kevin,

you have to import ij.IJ or ij.* at the beginning.

Michael
________________________________________________________________

On Jan 26, 2012, at 17:37, Kevin Hallock wrote:

> Hi,
>
> I'm trying to implement a plugin from Digital Image Processing (by Burger and Burge) that shifts an image to the left by a specified number of pixels.  The shifting part of the plugin in works fine, but the initial part of the code gives me an error when I compile it.  Here's are the first 30 lines of the plugin:
>
> /**
> * This sample code is made available as part of the book "Digital Image
> * Processing - An Algorithmic Introduction using Java" by Wilhelm Burger
> * and Mark J. Burge, Copyright (C) 2005-2008 Springer-Verlag Berlin,
> * Heidelberg, New York.
> * Note that this code comes with absolutely no warranty of any kind.
> * See http://www.imagingbook.com for details and licensing conditions.
> *
> * Date: 2010/01/27
> */
>
> import ij.ImagePlus;
> import ij.plugin.filter.PlugInFilter;
> import ij.process.ImageProcessor;
>
>
> public class XY_plugin implements PlugInFilter {
>
> ImagePlus im; // instance variable of this plugin object
>
> public int setup(String arg, ImagePlus im) {
>  if (im==null) {
>   IJ.noImage(); //currently no image is open
>   return DONE;
>  }
>  this.im = im; // keep a reference to the image im
>  return DOES_8G;
> }
>
> --------
>
> The error message is:
>
> XY_plugin.java:24: cannot find  symbol
> symbol: variable IJ
> location: class XY_plugin
>   IJ.noImage(); //currently no image is open
>   ^
> 1 error
>
> ----------
>
> Any suggestions for fixing this would be appreciated.  
>
> Thanks,
>
> Kevin Hallock
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IJ.noImage()

hallockk
In reply to this post by hallockk
That did it; thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IJ.noImage()

manogna
In reply to this post by hallockk
Hi,

I'm trying to find feature points as a part of my project. Would like to know how this program is to be tested. Thought I placed the image in working directory, it says no image. Is "im" the image? Please clarify on the implementation part of this program. Regarding the way input is given and output is obtained.

Thanks in advance.