Masks and image arithmetic
spacermase wrote on Feb 18, 2010
This is probably something of a neophyte question, but I've been working with .pl masks generated by the objmasks package. When I try to perform image arithmetic on them (say, "imarith image - mask output"), it goes through fine (no errors), but the output image is exactly the same as the input image. Am I doing something wrong, or do masks simply not work that way?
Thanks!
Thanks!
Mike Fitzpatrick wrote on Feb 18, 2010
Masks do indeed behave like images, e.g.
As you can see the mask has values of 500 that were subtracted from the output image.
In your case, is it possible you're just not noticing that a mask value of one was indeed subtracted? Are you assuming the mask contains the pixels values (it doesn't) and you're doing this to subtract objects from the image? If so, have a look at MASKEXPR as a way to use the mask to do expressions on images.
-Mike
ecl> imexpr "(a > 500 ? 500 : 0)" a=dev$pix output=test.pl
10% 20% 30% 40% 50% 60% 70% 80% 90% 100% - done
ecl> imarith dev$pix - test.pl testout.fits
ecl> imstat dev$pix,testout.fits
# IMAGE NPIX MEAN STDDEV MIN MAX
dev$pix 262144 108.3 131.3 -1. 19936.
testout.fits 262144 104. 110.7 -1. 19436.
As you can see the mask has values of 500 that were subtracted from the output image.
In your case, is it possible you're just not noticing that a mask value of one was indeed subtracted? Are you assuming the mask contains the pixels values (it doesn't) and you're doing this to subtract objects from the image? If so, have a look at MASKEXPR as a way to use the mask to do expressions on images.
-Mike
Last post on Feb 18, 2010