View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

deleting part of an image?

Arp wrote on Feb 28, 2010

Hi!

Is there a task which lets me manipulate parts of an image without trimming it? for example, I want to to set all pixel values in a the section 100:200,100:200 to 0.

I tried imcopy, but I think that only allows me to copy a section.
thx.

Mike Fitzpatrick wrote on Feb 28, 2010

See the IMEDIT or EPIX tasks.

There are other ways to do this using expressions or masks, but in the simple case you gave those should work.

Arp wrote on Feb 28, 2010

thanks. Ill try those.

I found imreplace in the meantime, but it somehow just does nothing...

Francisco Valdes wrote on Feb 28, 2010

Hi,

IMREPLACE with an image section would have been my first recommendation. A test I did showed it working so maybe there was a parameter mis-set.

The other comment is that people are often unaware of one of the most powerful image tools, IMEXPR. While this is then more difficult to learn, once you understand the syntax and behavior it can do lots of things including setting a rectangular region to some value (use the I,J,K placeholders for positions). For non-rectangular regions you would create a mask, and there are a couple nice mask making tasks with a geometric description language. Then various tools, including IMEXPR, can be used to affect things in or not in the mask.

Frank Valdes

Arp wrote on Feb 28, 2010

Hello again!

I just tried to use imreplace, or epix to change every second pixel in every second line to 0. But it somehow just does nothing...


for(y=1; y<=2016; y+=2)
{
  for(x=2; x<=3040; x+=2)
  {
     epix("b.fits "//x//" "//y//" 0")            or alternativly epix("b.fits,x,y,0")
  }
}


when I start the script using cl<b.cl, it does not give any errors, but the file remains unaltered.

if I use
imreplace("b.fits["//x//":"//x//","//y//":"//y//"] 0")


it asks for the replacement value, and if I enter 0, it replies "Error: FXF: number is not a decimal"

Is my syntax wrong?

Mike Fitzpatrick wrote on Feb 28, 2010

If you use the "program mode" syntax (i.e. with the parenthesis rather than more like what you'd type interactively), the parameters must be separate by a comma so they are passed in individiually. Your example epix() command for instance in creating a single long string argument and not individual arguments,

Arp wrote on Feb 28, 2010

Hi!

Thank you! I tried this and it finally works, although I replace the first for loop with a while loop.
But its horribly slow... to change one line of 1520 pixels, it takes about 20 seconds... that would make 5 hours for a 30240x2016 image...

Last post on Feb 28, 2010