Login  Register

Re: Image-Rotations and "ip.setBackgroundValue()"

Posted by Michael Schmid on Oct 24, 2018; 4:16pm
URL: http://imagej.273.s1.nabble.com/Image-Rotations-and-ip-setBackgroundValue-tp5021339p5021340.html

Hi Herbie,

yes, the "Fill with Background Color" checkbox is disabled for 16-bit
and float images in Image>Transform>Rotate (ij.plugin.Rotator.java)

One could easily remove that limitation, but one would also have to
modify the code for rotate() and scale() in ShortProcessor and
FloatProcessor (currently it uses zero filling) and write the code for
get/setBackgroundValue methods. So I fear it is more than a few minutes.

For me, the nicest would be a 'select rotated' option for the 'Rotate'
command; then I could invert the selection thereafter and maybe even
create a background with smooth borders to avoid artifacts in FFT - but
I fear that it is difficult to get the selection rectangle correct
(without rounding errors, which might leave zero pixels).

For the moment, the easiest might be converting to float, subtracting
the background value you prefer, then rotating and adding the background
value.

Michael
________________________________________________________________
On 24/10/18 17:44, Herbie wrote:

> Dear experts,
>
> my question concerns ways to fill *only* the corner areas that result from
> rotated images and that work with 8bit, 16bit and 32bit images.
>
> I should like to fill these areas with the mode value of the images.
>
> "ip.setBackgroundValue()"
>
> appears to work with 8bit images only.
>
> Is there are reliable way to do this with 16bit and 32bit images?
>
> (What I did already is select the zero-valued corner areas with the
> Wand-tool and then fill them, but if the image structure is zero as well and
> touches a corner area, it becomes filled as well...)
>
> (Another approach not, tested yet, is to rotate a rectangular selection as
> well and fill outside.)
>
> Any suggestions are welcome
>
> Herbie
>

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