Trouble with plugin / image backgrounds

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

Trouble with plugin / image backgrounds

Benjamin Blonder
Hello,
 I'm trying to write a plugin filter for 8-bit grayscale images. I'd like to
have a method that takes an ImageProcessor, angle, and grayscale value, and
then rotates the image by the requested number of degrees, filling in the
background with the value.

 Right now I have

public void rotate(ImageProcessor ip, int degrees)
{
 double average = // calculated here
 ip.setBackgroundValue(average);
 ip.rotate(degrees);
}

This doesn't compile, however. I get this error:

C:\Program Files\ImageJ\plugins\SPR_Position.java:51: Method
setBackgroundValue(double) not found in class ij.process.ImageProcessor.

ip.setBackgroundValue(average);

                     ^

1 error

All the ImageJ documentation has this method listed as existing, and I'm
positive that ip is a ByteProcessor, so it ought to do what it claims. Any
suggestions on how to fix this? I'm using ImageJ 1.33u on Windows XP.

Thanks,
Ben
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Trouble with plugin / image backgrounds

Wayne Rasband
The setBackgroundValue() method was added in ImageJ 1.34p.

Here is a macro that rotates an image by a specified number of degrees,
filling with the image average.

    requires("1.34p");
    angle = 25;
    getRawStatistics(area, mean);
    setBackgroundColor(mean, mean, mean);
    run("Arbitrarily...", "interpolate fill angle="+angle);

-wayne

On Jul 19, 2005, at 9:58 AM, Benjamin Blonder wrote:

> Hello,
>   I'm trying to write a plugin filter for 8-bit grayscale images. I'd
> like to  have a method that takes an ImageProcessor, angle,
> and grayscale value, and then rotates the image by the requested
> number of degrees, filling in the  background with the value.
>
>  Right now I have
>
>  public void rotate(ImageProcessor ip, int degrees)
> {
>   double average = // calculated here
>   ip.setBackgroundValue(average);
>  ip.rotate(degrees);
> }
>
> This doesn't compile, however. I get this error:
>
>  C:\Program Files\ImageJ\plugins\SPR_Position.java:51: Method
> setBackgroundValue(double) not found in class
> ij.process.ImageProcessor.
>
> ip.setBackgroundValue(average);
>
>                      ^
>
> 1 error
>
> All the ImageJ documentation has this method listed as existing, and
> I'm
> positive that ip is a ByteProcessor, so it ought to do what it claims.
> Any
> suggestions on how to fix this? I'm using ImageJ 1.33u on Windows XP.
>
> Thanks,
> Ben
Loading...