subtraction of images

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

subtraction of images

Oliver Bannach
Dear imagej experts

What I like to do is basically a subtraction of images (imageA minus
imageB). But each pixel yielding a signal in imageA must be set to zero,
if it also appears in imageB, regardless of signal intensities. In other
words: Any colocalized pixel must be black in image A. The conventional
subtract process (Process->Math->Substract) does not work for me, since
the pixel intensities in ImageA are only reduced by values of ImageB
pixels. Can I use imageJ standard operations for this purpose or do I
need a plugin? Any help is greatly appreciated. Thanky you in advance.

Cheers
Oliver
Reply | Threaded
Open this post in threaded view
|

Re: subtraction of images

Michael Schmid
Hi Oliver,

The documentation of Image Calculator says:

     Subtract     img1 =  img1-img2
     Difference   img1 = |img1-img2|

So "Difference" will be zero for all pixels where two images
are the same. Is this what you are looking for?

http://rsb.info.nih.gov/ij/docs/menus/process.html#calculator

By the way, Process>Math>Subtract subtracts a constant, not an
image.

Michael
________________________________________________________________

On 4 Jun 2008, at 11:22, Oliver Bannach wrote:

> Dear imagej experts
>
> What I like to do is basically a subtraction of images (imageA  
> minus imageB). But each pixel yielding a signal in imageA must be  
> set to zero, if it also appears in imageB, regardless of signal  
> intensities. In other words: Any colocalized pixel must be black in  
> image A. The conventional subtract process (Process->Math-
> >Substract) does not work for me, since the pixel intensities in  
> ImageA are only reduced by values of ImageB pixels. Can I use  
> imageJ standard operations for this purpose or do I need a plugin?  
> Any help is greatly appreciated. Thanky you in advance.
>
> Cheers
> Oliver
Reply | Threaded
Open this post in threaded view
|

Re: subtraction of images

Oliver Bannach
Hi Michael,

thank you for your suggestion, but that's not exactly what I was looking
for.
It should look like shown in this example (white=0, black=255):

http://www.biophys.uni-duesseldorf.de/~bannach/ImageJ/example.jpg

Any ideas how to do that?

Thanks
Oliver

Michael Schmid schrieb:

> Hi Oliver,
>
> The documentation of Image Calculator says:
>
>     Subtract     img1 =  img1-img2
>     Difference   img1 = |img1-img2|
>
> So "Difference" will be zero for all pixels where two images
> are the same. Is this what you are looking for?
>
> http://rsb.info.nih.gov/ij/docs/menus/process.html#calculator
>
> By the way, Process>Math>Subtract subtracts a constant, not an
> image.
>
> Michael
> ________________________________________________________________
>
> On 4 Jun 2008, at 11:22, Oliver Bannach wrote:
>
>> Dear imagej experts
>>
>> What I like to do is basically a subtraction of images (imageA minus
>> imageB). But each pixel yielding a signal in imageA must be set to
>> zero, if it also appears in imageB, regardless of signal intensities.
>> In other words: Any colocalized pixel must be black in image A. The
>> conventional subtract process (Process->Math->Substract) does not
>> work for me, since the pixel intensities in ImageA are only reduced
>> by values of ImageB pixels. Can I use imageJ standard operations for
>> this purpose or do I need a plugin? Any help is greatly appreciated.
>> Thanky you in advance.
>>
>> Cheers
>> Oliver
Reply | Threaded
Open this post in threaded view
|

Re: subtraction of images

Antje-2
Hmm, with this example, I'd just set a threshold at the image B to select
everything non-white, create a selection and remove every signal in image A
within this selection (BG-Color = white)...
But may be this is not what you want?

Antje



Oliver Bannach schrieb:

> Hi Michael,
>
> thank you for your suggestion, but that's not exactly what I was looking
> for.
> It should look like shown in this example (white=0, black=255):
>
> http://www.biophys.uni-duesseldorf.de/~bannach/ImageJ/example.jpg
>
> Any ideas how to do that?
>
> Thanks
> Oliver
>
> Michael Schmid schrieb:
>> Hi Oliver,
>>
>> The documentation of Image Calculator says:
>>
>>     Subtract     img1 =  img1-img2
>>     Difference   img1 = |img1-img2|
>>
>> So "Difference" will be zero for all pixels where two images
>> are the same. Is this what you are looking for?
>>
>> http://rsb.info.nih.gov/ij/docs/menus/process.html#calculator
>>
>> By the way, Process>Math>Subtract subtracts a constant, not an
>> image.
>>
>> Michael
>> ________________________________________________________________
>>
>> On 4 Jun 2008, at 11:22, Oliver Bannach wrote:
>>
>>> Dear imagej experts
>>>
>>> What I like to do is basically a subtraction of images (imageA minus
>>> imageB). But each pixel yielding a signal in imageA must be set to
>>> zero, if it also appears in imageB, regardless of signal intensities.
>>> In other words: Any colocalized pixel must be black in image A. The
>>> conventional subtract process (Process->Math->Substract) does not
>>> work for me, since the pixel intensities in ImageA are only reduced
>>> by values of ImageB pixels. Can I use imageJ standard operations for
>>> this purpose or do I need a plugin? Any help is greatly appreciated.
>>> Thanky you in advance.
>>>
>>> Cheers
>>> Oliver
>
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: subtraction of images

Joachim Wesner
In reply to this post by Oliver Bannach
Hi Oliver,

this should be possible without reccurring to a plugin with a combination
of thresholding and binary operations.

You could also do it with a macro pretty easily (probably the most
universal approach), but in contrast
to a plugin, a macro can only directly operate on ONE image at a time,
which would mean to read
ImgB into an array first - which is also not a big deal!

Cheers

Joachim


ImageJ Interest Group <[hidden email]> schrieb am 04.06.2008 13:06:33:

> Hi Michael,
>
> thank you for your suggestion, but that's not exactly what I was looking
> for.
> It should look like shown in this example (white=0, black=255):
>
> http://www.biophys.uni-duesseldorf.de/~bannach/ImageJ/example.jpg
>
> Any ideas how to do that?
>
> Thanks
> Oliver
>
> Michael Schmid schrieb:
> > Hi Oliver,
> >
> > The documentation of Image Calculator says:
> >
> >     Subtract     img1 =  img1-img2
> >     Difference   img1 = |img1-img2|
> >
> > So "Difference" will be zero for all pixels where two images
> > are the same. Is this what you are looking for?
> >
> > http://rsb.info.nih.gov/ij/docs/menus/process.html#calculator
> >
> > By the way, Process>Math>Subtract subtracts a constant, not an
> > image.
> >
> > Michael
> > ________________________________________________________________
> >
> > On 4 Jun 2008, at 11:22, Oliver Bannach wrote:
> >
> >> Dear imagej experts
> >>
> >> What I like to do is basically a subtraction of images (imageA minus
> >> imageB). But each pixel yielding a signal in imageA must be set to
> >> zero, if it also appears in imageB, regardless of signal intensities.
> >> In other words: Any colocalized pixel must be black in image A. The
> >> conventional subtract process (Process->Math->Substract) does not
> >> work for me, since the pixel intensities in ImageA are only reduced
> >> by values of ImageB pixels. Can I use imageJ standard operations for
> >> this purpose or do I need a plugin? Any help is greatly appreciated.
> >> Thanky you in advance.
> >>
> >> Cheers
> >> Oliver


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: subtraction of images

Michael Schmid
In reply to this post by Oliver Bannach
Hi Oliver,

ok, what about a macro like this?

imageCalculator("Difference create", "ImgA","ImgB");
run("Max...", "value=1"); //now equal pixels are 0, different 1
imageCalculator("Multiply create", "ImgA","Result of ImgA");
rename("Result");
selectImage("Result of ImgA");
close();

This macro does not work for float images.

Note that it will work only if the pixels of ImgA and ImgB
that you want to eleiminate are mathematically equal.
If you want some tolerance, subtract the tolerance before
run("Max...


Michael
________________________________________________________________

On 4 Jun 2008, at 13:06, Oliver Bannach wrote:

> Hi Michael,
>
> thank you for your suggestion, but that's not exactly what I was  
> looking for.
> It should look like shown in this example (white=0, black=255):
>
> http://www.biophys.uni-duesseldorf.de/~bannach/ImageJ/example.jpg
>
> Any ideas how to do that?
>
> Thanks
> Oliver
>
> Michael Schmid schrieb:
>> Hi Oliver,
>>
>> The documentation of Image Calculator says:
>>
>>     Subtract     img1 =  img1-img2
>>     Difference   img1 = |img1-img2|
>>
>> So "Difference" will be zero for all pixels where two images
>> are the same. Is this what you are looking for?
>>
>> http://rsb.info.nih.gov/ij/docs/menus/process.html#calculator
>>
>> By the way, Process>Math>Subtract subtracts a constant, not an
>> image.
>>
>> Michael
>> ________________________________________________________________
>>
>> On 4 Jun 2008, at 11:22, Oliver Bannach wrote:
>>
>>> Dear imagej experts
>>>
>>> What I like to do is basically a subtraction of images (imageA  
>>> minus imageB). But each pixel yielding a signal in imageA must be  
>>> set to zero, if it also appears in imageB, regardless of signal  
>>> intensities. In other words: Any colocalized pixel must be black  
>>> in image A. The conventional subtract process (Process->Math-
>>> >Substract) does not work for me, since the pixel intensities in  
>>> ImageA are only reduced by values of ImageB pixels. Can I use  
>>> imageJ standard operations for this purpose or do I need a  
>>> plugin? Any help is greatly appreciated. Thanky you in advance.
>>>
>>> Cheers
>>> Oliver
Reply | Threaded
Open this post in threaded view
|

Re: subtraction of images

Michael Schmid
In reply to this post by Antje-2
Oops, sorry, I misunderstood the problem, forget my last macro,
Antje is right.

Threshold the background in image B
Edit>Selection>Create Selection
Select Image A
Edit>Selection>Restore Selection
Edit>Clear or Clear Outside (depends on how the threshold has
been set)

Michael
________________________________________________________________

On 4 Jun 2008, at 13:29, Antje wrote:

> Hmm, with this example, I'd just set a threshold at the image B to  
> select everything non-white, create a selection and remove every  
> signal in image A within this selection (BG-Color = white)...
> But may be this is not what you want?
>
> Antje
>
>
>
> Oliver Bannach schrieb:
>> Hi Michael,
>> thank you for your suggestion, but that's not exactly what I was  
>> looking for.
>> It should look like shown in this example (white=0, black=255):
>> http://www.biophys.uni-duesseldorf.de/~bannach/ImageJ/example.jpg
>> Any ideas how to do that?
>> Thanks
>> Oliver
>> Michael Schmid schrieb:
>>> Hi Oliver,
>>>
>>> The documentation of Image Calculator says:
>>>
>>>     Subtract     img1 =  img1-img2
>>>     Difference   img1 = |img1-img2|
>>>
>>> So "Difference" will be zero for all pixels where two images
>>> are the same. Is this what you are looking for?
>>>
>>> http://rsb.info.nih.gov/ij/docs/menus/process.html#calculator
>>>
>>> By the way, Process>Math>Subtract subtracts a constant, not an
>>> image.
>>>
>>> Michael
>>> ________________________________________________________________
>>>
>>> On 4 Jun 2008, at 11:22, Oliver Bannach wrote:
>>>
>>>> Dear imagej experts
>>>>
>>>> What I like to do is basically a subtraction of images (imageA  
>>>> minus imageB). But each pixel yielding a signal in imageA must  
>>>> be set to zero, if it also appears in imageB, regardless of  
>>>> signal intensities. In other words: Any colocalized pixel must  
>>>> be black in image A. The conventional subtract process (Process-
>>>> >Math->Substract) does not work for me, since the pixel  
>>>> intensities in ImageA are only reduced by values of ImageB  
>>>> pixels. Can I use imageJ standard operations for this purpose or  
>>>> do I need a plugin? Any help is greatly appreciated. Thanky you  
>>>> in advance.
>>>>
>>>> Cheers
>>>> Oliver
Reply | Threaded
Open this post in threaded view
|

Re: subtraction of images

Oliver Bannach
In reply to this post by Antje-2
That will work perfectly for me. Thank you und everybody for your help!
Oliver

Antje schrieb:

> Hmm, with this example, I'd just set a threshold at the image B to
> select everything non-white, create a selection and remove every
> signal in image A within this selection (BG-Color = white)...
> But may be this is not what you want?
>
> Antje
>
>
>
> Oliver Bannach schrieb:
>> Hi Michael,
>>
>> thank you for your suggestion, but that's not exactly what I was
>> looking for.
>> It should look like shown in this example (white=0, black=255):
>>
>> http://www.biophys.uni-duesseldorf.de/~bannach/ImageJ/example.jpg
>>
>> Any ideas how to do that?
>>
>> Thanks
>> Oliver
>>
>> Michael Schmid schrieb:
>>> Hi Oliver,
>>>
>>> The documentation of Image Calculator says:
>>>
>>>     Subtract     img1 =  img1-img2
>>>     Difference   img1 = |img1-img2|
>>>
>>> So "Difference" will be zero for all pixels where two images
>>> are the same. Is this what you are looking for?
>>>
>>> http://rsb.info.nih.gov/ij/docs/menus/process.html#calculator
>>>
>>> By the way, Process>Math>Subtract subtracts a constant, not an
>>> image.
>>>
>>> Michael
>>> ________________________________________________________________
>>>
>>> On 4 Jun 2008, at 11:22, Oliver Bannach wrote:
>>>
>>>> Dear imagej experts
>>>>
>>>> What I like to do is basically a subtraction of images (imageA
>>>> minus imageB). But each pixel yielding a signal in imageA must be
>>>> set to zero, if it also appears in imageB, regardless of signal
>>>> intensities. In other words: Any colocalized pixel must be black in
>>>> image A. The conventional subtract process
>>>> (Process->Math->Substract) does not work for me, since the pixel
>>>> intensities in ImageA are only reduced by values of ImageB pixels.
>>>> Can I use imageJ standard operations for this purpose or do I need
>>>> a plugin? Any help is greatly appreciated. Thanky you in advance.
>>>>
>>>> Cheers
>>>> Oliver
>>