fill value for Translate...

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

fill value for Translate...

Michael Elbaum
Dear all,    when translating an image the background is filled with black. Is it possible to fill with some other value? for example the mean or the average of the perimeter?
thanks,
Michael

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: fill value for Translate...

Gabriel Landini
On Friday 13 Sep 2013 12:18:46 you wrote:
> Dear all,    when translating an image the background is filled with black.
> Is it possible to fill with some other value? for example the mean or the
> average of the perimeter? thanks,
> Michael


If you do:

Invert
Translate
Invert

the background is white (at least in my setup).

Cheers
Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: fill value for Translate...

Michael Elbaum
Thanks Gabriel,     but unfortunately white is no better. Creating a larger image with background fill and then pasting the image in should work, but this is bad for memory esp for working with stacks. I tried selecting the desired grey with the color picker but the border remains black after translation.
regards,
Michael


________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Gabriel Landini [[hidden email]]
Sent: Friday, September 13, 2013 2:38 PM
To: [hidden email]
Subject: Re: fill value for Translate...

On Friday 13 Sep 2013 12:18:46 you wrote:
> Dear all,    when translating an image the background is filled with black.
> Is it possible to fill with some other value? for example the mean or the
> average of the perimeter? thanks,
> Michael


If you do:

Invert
Translate
Invert

the background is white (at least in my setup).

Cheers
Gabriel

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: fill value for Translate...

Gabriel Landini
On Monday 16 Sep 2013 13:31:07 Michael Elbaum wrote:
> Thanks Gabriel,     but unfortunately white is no better. Creating a larger
> image with background fill and then pasting the image in should work, but
> this is bad for memory esp for working with stacks. I tried selecting the
> desired grey with the color picker but the border remains black after
> translation. regards,

Well, you said 'some other value'...
I can't think another way of doing this other than painting (floodfill) the
corner pixel that gets black (you will have to compute which one it is) after
the translation.

Cheers

Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: fill value for Translate...

Michael Schmid
In reply to this post by Michael Elbaum
Hi Michael,

the 'fill' color for the background on Image>Transform>Translate is actually neither white nor black but simply a pixel value of zero (uncalibrated).

If you want to have a different pixel value, you have two possibilities:
(a) Use 32-bit (float) images, subtract a value before translation and add it thereafter
(b) Select the translated area after translation, 'Make Inverse' of the selection and fill that area with the desired value (Process>Math>Set if you have the numeric value). You can easily have a macro for this.
Method (b) won't work well if you translate by a non-integer number of pixels: The border won't be calculated correctly.

Michael
________________________________________________________________
On Sep 16, 2013, at 14:31, Michael Elbaum wrote:

> Thanks Gabriel,     but unfortunately white is no better. Creating a larger image with background fill and then pasting the image in should work, but this is bad for memory esp for working with stacks. I tried selecting the desired grey with the color picker but the border remains black after translation.
> regards,
> Michael
>
>
> ________________________________________
> From: ImageJ Interest Group [[hidden email]] on behalf of Gabriel Landini [[hidden email]]
> Sent: Friday, September 13, 2013 2:38 PM
> To: [hidden email]
> Subject: Re: fill value for Translate...
>
> On Friday 13 Sep 2013 12:18:46 you wrote:
>> Dear all,    when translating an image the background is filled with black.
>> Is it possible to fill with some other value? for example the mean or the
>> average of the perimeter? thanks,
>> Michael
>
>
> If you do:
>
> Invert
> Translate
> Invert
>
> the background is white (at least in my setup).
>
> Cheers
> Gabriel
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: fill value for Translate...

Michael Elbaum
Hi Michael,

Thanks for the tips. The second method would work for me since I'm already running a macro on a stack and shifting coarsely. My colleague Katya Rechav made another suggestion that's a bit more general (at the expense of RAM): set background, then adjust canvas size, shift, and recrop the original. This works because the background is filled as expected, and it's much better than creating a new larger stack.

best,
Michael

________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Michael Schmid [[hidden email]]
Sent: Monday, September 16, 2013 3:50 PM
To: [hidden email]
Subject: Re: fill value for Translate...

Hi Michael,

the 'fill' color for the background on Image>Transform>Translate is actually neither white nor black but simply a pixel value of zero (uncalibrated).

If you want to have a different pixel value, you have two possibilities:
(a) Use 32-bit (float) images, subtract a value before translation and add it thereafter
(b) Select the translated area after translation, 'Make Inverse' of the selection and fill that area with the desired value (Process>Math>Set if you have the numeric value). You can easily have a macro for this.
Method (b) won't work well if you translate by a non-integer number of pixels: The border won't be calculated correctly.

Michael
________________________________________________________________
On Sep 16, 2013, at 14:31, Michael Elbaum wrote:

> Thanks Gabriel,     but unfortunately white is no better. Creating a larger image with background fill and then pasting the image in should work, but this is bad for memory esp for working with stacks. I tried selecting the desired grey with the color picker but the border remains black after translation.
> regards,
> Michael
>
>
> ________________________________________
> From: ImageJ Interest Group [[hidden email]] on behalf of Gabriel Landini [[hidden email]]
> Sent: Friday, September 13, 2013 2:38 PM
> To: [hidden email]
> Subject: Re: fill value for Translate...
>
> On Friday 13 Sep 2013 12:18:46 you wrote:
>> Dear all,    when translating an image the background is filled with black.
>> Is it possible to fill with some other value? for example the mean or the
>> average of the perimeter? thanks,
>> Michael
>
>
> If you do:
>
> Invert
> Translate
> Invert
>
> the background is white (at least in my setup).
>
> Cheers
> Gabriel
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

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