NRAO Home > CASA > CASA Toolkit Reference Manual
image.crop - Function

1.1.1 Crop masked pixels from the perimeter of an image.


Description

This method crops masked slices from the perimeter of an image. The axes parameter specifies which axes to consider. Axes not specified will not be cropped. An empty array implies that all axes should be considered. If wantreturn is True, an image analysis tool attached to the output image is returned. If False, none is returned.

Arguments





Inputs

outfile

Output image name. If not specified, no persistent image is created.

allowed:

string

Default:

axes

Axes to crop. Empty array means consider all axes.

allowed:

intArray

Default:

overwrite

Overwrite the output if it exists? Default False

allowed:

bool

Default:

false

region

Region selection. See ”help par.region” for details. Default is to use the full image.

allowed:

any

Default:

variant

box

Rectangular region to select in direction plane. See ”help par.box” for details. Default is to use the entire direction plane.

allowed:

string

Default:

chans

Channels to use. See ”help par.chans” for details. Default is to use all channels.

allowed:

string

Default:

stokes

Polarization selection. Default is all.

allowed:

string

Default:

mask

Mask to use. See help par.mask. Default is none.

allowed:

string

Default:

stretch

Stretch the mask if necessary and possible? See help par.stretch. Default False

allowed:

bool

Default:

false

wantreturn

Return an image analysis tool attached to the created subimage?

allowed:

bool

Default:

true

Returns
image

Example

 
        # myimage is of shape 20, 20, 20 with only the inner 16 x 14 x 12 pixels unmasked  
        ia.open("myimage")  
        # crop masked slices on all axes  
        cropped = ia.crop()  
        # returns [16, 14, 12]  
        cropped.shape()  
        cropped.done()  
        # crop only the masked slices at the edges of the image along axis 1  
        cropped2 = ia.crop(outfile="", axes=[1])  
        ia.done()  
        # returns [20, 14, 20]  
        cropped2.shape()  
        cropped2.done()  

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search