Welcome to iraf.net Friday, April 19 2024 @ 12:21 PM GMT


 Forum Index > Help Desk > Applications New Topic Post Reply
 Constant value substitution for pixels
   
sa14722
 12/11/2014 07:21PM (Read 1840 times)  
+----
Newbie

Status: offline


Registered: 12/11/2014
Posts: 6
I'm new to iraf so please pardon me if this is perhaps a silly question.

So I have an image which has a diagonal region of bad pixels. I have created a text file which contains a list of the x and y positions of all these bad pixels. I am trying to replace the value of these bad pixels with a constant (median/average) so that they don't get detected during photometry. However I am not finding a command that can do this task.

I have tried fixpix and it can read in the text file fine, but the linear interpolation from surrounding pixels creates even further bad pixels within the bad pixel region, which then get identified during photometry. I have also tried imreplace but you can only specify a rectangular region with that command and I have a diagonal region. I tried a few others but they all have similar problems.

It would be great if someone could point me to a command that can read a text file with a list of x&y pixel co-ordinates and substitute the values of those pixels with a constant. Thanks.

 
Profile Email
 Quote
fitz
 12/11/2014 07:29PM  
AAAAA
Admin

Status: offline


Registered: 09/30/2005
Posts: 4040
I think the tasks you need are TEXT2MASK to create an image mask from your pixel positions, and then IMEXPR to apply the mask to set the constant value.

See the TEXT2MASK help page, or do a "cl\$this->_split2($m[0]) refer mask" to find other masking tasks, for info on how to create the mask file. To apply the mask you could call IMEXPR as something like

cl\$this->_split2($m[0]) imexpr "(b ? 3.14 : a)" fixed.fits a=bad.fits b=mask.pl

The expression will replace every pixel with a non-zero mask value (in mask.pl created with TEXT2MASK) with the constant 3.14, otherwise it will use the input image (bad.fits).

 
Profile Email
 Quote
sa14722
 12/12/2014 03:12PM  
+----
Newbie

Status: offline


Registered: 12/11/2014
Posts: 6
Quote by: fitz

I think the tasks you need are TEXT2MASK to create an image mask from your pixel positions, and then IMEXPR to apply the mask to set the constant value.

See the TEXT2MASK help page, or do a "cl\$this->_split2($m[0]) refer mask" to find other masking tasks, for info on how to create the mask file. To apply the mask you could call IMEXPR as something like

cl\$this->_split2($m[0]) imexpr "(b ? 3.14 : a)" fixed.fits a=bad.fits b=mask.pl

The expression will replace every pixel with a non-zero mask value (in mask.pl created with TEXT2MASK) with the constant 3.14, otherwise it will use the input image (bad.fits).



Oh wow. I had already created a bad pixel mask earlier using text2mask and the imexpr command you recommended worked like an absolute charm. Thanks so much for the help Big Grin

 
Profile Email
 Quote
   
Content generated in: 0.13 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content 
dog allergies remedies cialis 20 mg chilblain remedies


Privacy Policy
Terms of Use

User Functions

Login