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 -- Sent from: http://imagej.1557.x6.nabble.com/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.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 |
Dear Michael,
thank you so much for your suggestions! "(currently it uses zero filling)" Yes, I've already looked at most of the source code that could perhaps help... "For me, the nicest would be a 'select rotated' option [...]" Exactly and I'm just struggling to make it work and I fear as well that discrepancies may occur. "For the moment, the easiest might be converting to float, subtracting the background value you prefer, then rotating and adding the background value." That's a nice one and I shall follow this approach first! Thanks again Herbie :::::::::::::::::::::::::::::::::::::::::::: Am 24.10.18 um 18:16 schrieb Michael Schmid: > 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 a 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 > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |