IMCLEAN

imclean is an IRAF task to "clean" images by interpolation over "bad" pixels, defects/blemishes, or genuine objects (like stars) along both rows and columns (i.e., using the four nearest "good" pixels). The pixels to interpolate over are specified by the user as rectangular or circular regions via pixel regions files, or through a mask image (regular image, not a post-IRAF2.12 pixel list format [.pl] file). Regions of arbitrary size and shape may be specified using multiple partially overlapping circular and/or rectangular regions. Internally, any pixel regions files specified as input to imclean will be converted to a mask image. If 'creamask=yes', then: (a) if no mask image was given as input, the mask image created internally from the regions files will be saved; (b) if both a mask image and regions files were provided, the mask image will be updated to include the regions specified in the pixel regions files.

Note, that imclean.cl is merely an IRAF user interface to a set of two compiled executables imclean999.exe and imclean2064.exe that accept images of size up to 999×999 and 2064×2064 pixels, respectively. If the input image has a format other than Original IRAF Format (OIF), such as FITS or GEIS, it is copied to OIF first, cleaned, and the result exported back to an image of the input image format.

Rolf A. Jansen -- Tempe (AZ), Sep 26 2006

Getting a copy of IMCLEAN

imclean may be downloaded as a single gzip-compressed tar archive here (~527 kB).

To install imclean, you need to have a single 'iraf' home directory (the directory that contains your "login.cl" and "loginuser.cl" files). Usually, this will be in your home directory, i.e., ~/iraf
Create a sub-directory named "tasks" in ~/iraf/ , then gunzip and untar the tar archive in ~/iraf/tasks/ :

        cd ~/iraf/tasks

        gunzip imclean.tgz        (Unix and Linux)
        tar xvpf imclean.tar
    or: 
        gtar -xvpzf imclean.tgz   (Linux)

A subdirectory named "imclean" will be created when unpacking the tar archive. Pre-compiled executables are included for Sun Solaris 2.6, and for Redhat Enterprise 4 linux (these may be binary compatible with Redhat 7.x–9, Fedora Core 1–5, and RHE 1–3).

If you are running Redhat linux or Solaris, enter the "imclean" subdirectory, and create symbolic links to the executables as follows:

        ln -s bin.redhat/imclean999.exe imclean999.exe
        ln -s bin.redhat/imclean2064.exe imclean2064.exe  
    or:
        ln -s bin.ssol/imclean999.exe imclean999.exe
        ln -s bin.ssol/imclean2064.exe imclean2064.exe  

If you are running a different OS, or if you experience problems with the pre-compiled executables, you will need to recompile the source code:

        cl>  cd home$tasks/imclean/src
        cl>  fc imclean999.f -o imclean999.exe
        cl>  fc imclean2064.f -o imclean2064.exe
        cl>  cd ..
        cl>  mkdir ("bin"//envget("arch"))
        cl>  move ("src/imclean*.exe", "bin"//envget("arch")//"/")
        cl>  logout

        $>   cd ~/iraf/tasks/imclean/
        $>   ln -s bin.irafarch/imclean999.exe imclean999.exe
        $>   ln -s bin.irafarch/imclean2064.exe imclean2064.exe

If you have a native Fortran 77 compiler installed (and IRAF's fc is set up to use it — check your "login.cl" file and/or /iraf/iraf/unix/hlib/f77.sh on your system), and wish to use imclean on larger format images, you may try and compile "imclean4096.f" and, if successful, simply rename the executable "imclean2064.exe" in the apropriate "bin.irafarch" subdirectory.
Note that on linux machines without a native Fortran compiler, compilation is done using f2c and gcc. As a result, during compilation, memory is reserved for every instance of the pixel buffers in every subroutine, which is likely to run your system out of memory for buffer sizes larger than 2064×2064 pixels (assuming a machine with 1–1.5 Gb of RAM; on machines with less than ~512 Mb you may not even be able to compile "imclean2064.f").

Next, edit your ~/iraf/loginuser.cl file and make sure the following lines are present:

        reset tasks      = home$tasks/
        reset imclean    = tasks$imclean/
        task imclean     = imclean$imclean.cl

Also verify that the "loginuser.cl" file ends with a "keep" statement.

That's it. By (re)starting iraf, the new task imclean should be available. Use 'epar' to edit all parameters (don't try and run this task with default values only). Read the comments/description of the task near the top part of the imclean.cl file. The 'creamask' parameter should probably be set to 'no' in most cases.

A Note on pixel regions files
The regions to interpolate over should be provided by either a mask image (regular (u)short, integer or real-valued 2-D image), or a pixel regions file in a pre-IRAF2.12-style text format, similar to the one used for tasks like fixpix. That text format is:

        x_cen y_cen radius              (circular region)
        x_start x_end y_start y_end     (rectangular reg)

where x_start, x_end, y_start, and y_end are integers (or integers with a trailing decimal point) representing the physical pixel coordinates in the current image, but x_cen, y_cen, and radius may be true floating point values. If floating point values are provided for the other x_* and y_* pixel coordinates, they will be rounded or truncated internally, which may result in unexpected "off-by-one" effects.



Last updated: Oct 11, 2006


Back to the top of this page.
In case of problems with this page, contact: Rolf.Jansen @asu.edu , tel.: (+1)480 727 7119