Home

Quick Links

Software Manual
GitHub
API Reference

Documentation Versions

Public Release
8.3.0
8.2.0
8.1.0
8.0.0
7.2.0
7.1.0
7.0.0
6.0.0
3.9.0
3.5.0
USGS

ISIS Application Documentation


crop

Printer Friendly View | TOC | Home

Extracts a sub-area from a cube

Overview Parameters Example 1

Description

This program extracts a sub-area from a cube based on user defined parameter values. The extracted area can also be sub-sampled by specifying a line and sample increment.

A sub-area selected for extraction must be contiguous. That is, the program will not allow non-continuous cropping such as lines 1-5, 10-30, and 80-100. However, the contiguous area can be sub-sampled by specifying how many pixels to increment or skip. For example, to select every third line (1, 4, 7, 10 ...) to be written to the output cube, use a line increment (LINC) of three.

The parameter PROPSPICE applies to Level1 images. The SPICE information must have been propagated to the cropped output cube to obtain any camera geometry or photometric information. The default setting for PROPSPICE is "TRUE." When the default setting is used, all the keywords in the labels of the input file are transferred to the output file. In addition, the keywords that describe the area that was extracted out of the input cube are also added to the AlphaCube group in the labels.

For a Level1 image, the keywords contained within the AlphaCube group in the labels describe the original file size and the area that was extracted. The AlphaCube and SPICE kernels information are very important to compute accurate geometric and photometric information using the cropped Level1 cube.

Level1 labels using PROPSPICE=TRUE: Level1 labels using PROPSPICE=FALSE:
Group = Kernels                                                               
    NaifFrameCode             = -53031				
    LeapSecond                 = $base/kernels/lsk/naif0009.tls		      
    TargetAttitudeShape       = $base/kernels/pck/pck00009.tpc
    TargetPosition            = (Table, $base/kernels/spk/de405.bsp) 	 
    InstrumentPointing        = (Table, $odyssey/kernels/ck/m01_sc_ext11.bc,
                                 $odyssey/kernels/fk/m01_v29.tf)	
    Instrument                = Null					 
    SpacecraftClock           = $odyssey/kernels/sclk/ORB1_SCLKSCET.00187.tsc
    InstrumentPosition        = (Table, $odyssey/kernels/spk/m01_ext11.bsp)
    InstrumentAddendum        = $odyssey/kernels/iak/themisAddendum003.ti
    ShapeModel                = $base/dems/molaMarsPlanetaryRadius0005.cub
    InstrumentPositionQuality = Reconstructed				
    InstrumentPointingQuality = Reconstructed				
    CameraVersion             = 2					
  End_Group

  Group = AlphaCube                                                           
    AlphaSamples        = 320						      
    AlphaLines          = 3600						      
    AlphaStartingSample = 99.5						      
    AlphaStartingLine   = 9.5						      
    AlphaEndingSample   = 199.5 					      
    AlphaEndingLine     = 109.5 					      
    BetaSamples         = 100						      
    BetaLines           = 100						      
  End_Group								      
Group = Kernels
    NaifFrameCode = -53031
End_Group


 Group = AlphaCube
   AlphaSamples        = 320
   AlphaLines	       = 3600
   AlphaStartingSample = 99.5
   AlphaStartingLine   = 9.5
   AlphaEndingSample   = 199.5
   AlphaEndingLine     = 109.5
   BetaSamples         = 100
   BetaLines	       = 100
 End_Group
 
 
 
 
 
 
 
 
 
 
 

For a Level2 image or a mosaic, the Mapping group keywords in the labels are updated or removed depending on the settings used to crop the input image. Once an image has been cropped, the keywords MinimumLatitude, MaximumLatitude, MinimumLongitude, and MaximumLongitude are recomputed and the values updated in the labels for rectangular projections with straight line meridians and parallels. The keywords are removed from the labels for projections with curved meridians and parallels. Use the map2map application if the keywords MinimumLatitude, MaximumLatitude, MinimumLongitude, and MaximumLongitude must be retained in the labels. If the parameters LINC and SINC are not 1 and the values are equal, then the map Scale and PixelResolution are recomputed and the values updated in the labels. Otherwise, Scale and PixelResolution keywords and values are removed from the labels. The UpperLeftCornerX and UpperLeftCornerY are recomputed based on the settings used to crop the input image and updated in the labels for all projections as shown in the example below.

Level2 labels of uncropped image: Level2 labels of cropped image:
Group = Mapping                                           
  ProjectionName       = Equirectangular		  
  CenterLongitude      = 0				  
  TargetName	       = MOON				  
  EquatorialRadius     = 1737400.0 <meters>	  
  PolarRadius	       = 1737400.0 <meters>	  
  LatitudeType         = Planetocentric 		  
  LongitudeDirection   = PositiveEast			  
  LongitudeDomain      = 180				  
  MinimumLatitude      = -60.62302099			  
  MaximumLatitude      = -59.30333301			  
  MinimumLongitude     = -161.213427			  
  MaximumLongitude     = -158.574051			  
  UpperLeftCornerX     = -2444266.0		  
  UpperLeftCornerY     = -1798275.5		  
  PixelResolution      = 7.5 <meters/pixel>
  Scale 	       = 4043.1133898866 <pixels/degree>
  CenterLatitude       = -60
  CenterLatitudeRadius = 1737400.0
End_Group
Group = Mapping
   ProjectionName	= Equirectangular
   CenterLongitude	= 0
   TargetName		= MOON
   EquatorialRadius	= 1737400.0 <meters>
   PolarRadius  	= 1737400.0 <meters>
   LatitudeType 	= Planetocentric
   LongitudeDirection	= PositiveEast
   LongitudeDomain	= 180
   UpperLeftCornerX     = -2429273.5
   UpperLeftCornerY     = -1813268.0
   PixelResolution	= 15.0 <meters/pixel>
   Scale		= 2021.5566949433 <pixels/degree>
   CenterLatitude	= -60
   CenterLatitudeRadius = 1737400.0
End_Group




WARNING:
If the cropped image is displayed with the application qview, the latitude and longitude reported by the application will be correct for the cropped files. The mappt application can be used to compute the latitude and longitude at a specific point in a cropped cube.

The minimum and maximum latitude and longitude range are not recomputed and the keywords are deleted from the labels when the input image is in a non-rectangular projection. Unfortunately there is not a generic way to update the ranges for all projections so only the values for rectangular projections are recalculated and updated in the labels.

The cropped images may be included in a list to create a mosaic with automos. All the cropped images included in the input list must contain the same mapping values. If automos fails because of the cropped images, the user may need to specify the MINLAT, MAXLAT, MINLON, and MAXLON values of the output mosaic for some ISIS versions.


Categories


Related Applications to Previous Versions of ISIS

This program replaces the following applications existing in previous versions of ISIS:
  • dsk2dsk
  • sfrom

Related Objects and Documents

Applications


History

Jim Mathews1994-04-20 Original version
Jeff Anderson2002-08-05 Converted to Isis 3.0
K Teal Thompson2002-11-18 Added examples
Jeff Anderson2003-01-28 Removed crop from the Utility category
K Teal Thompson2003-02-03 Make images smaller
K Teal Thompson2003-02-04 Added red rectangle to input image of example to illustrate crop area.
K Teal Thompson2003-03-19 Moved images to /assets/image directory and thumbnails to /assets/thumb directory.
Stuart Sides2003-04-04 Fixed problem with isiscvs not checking in the thumb and image directories.
Stuart Sides2003-04-25 Added extraction labels
Stuart Sides2003-05-16 Modified schema location from astrogeology... to isis.astrogeology..."
Stuart Sides2003-07-29 Modified filename parameters to be cube parameters where necessary
Jeff Anderson2004-02-16 Replaced extraction group with AlphaCube group and propagated other labels.
Jeff Anderson2004-02-16 Added LINC and SINC parameters and set defaults for all parameters
Brendan George2006-12-29 Fixed to allow input band selection
Elizabeth Miller2007-02-01 Modified to adjust the upper left corner x and y values in the mapping group of the output cube if the input cube is projected
Steven Lambright2008-05-13 Removed references to CubeInfo
Steven Lambright2008-08-04 Added spice propagation option PROPSPICE. Fixed description of NLINES, NSAMPLES and now line associated and sample associated tables are modified when crop is run.
Steven Lambright2008-08-06 Changed default of PROPSPICE to true. Sample/Line associated tables are no longer modified due to conflicts with other programs, such as pad, which doesn't know what data values to add to the tables.
Steven Lambright2009-06-30 When an invalid projection exists the proper error should now be thrown.
Janet Barrett2009-10-21 Now uses the SubArea class to produce output cube labels with corrected Mapping, Instrument, and AlphaCube groups.
Tracie Sucharski2012-12-06 Removed unnecessary include of Projection.h. References #775
Stuart Sides2013-06-23 Modified the calculations for number of lines and samples to use double precision math and then round up instead of integer math with truncation. When the number of lines or samples does not divide evenly by the linc or sinc values there will be one additional line or sample in the output cube.
Janet Barrett2014-02-10 Delete input cube between successive runs of the program. This makes sure that the projection information is initialized each time the program is run in the GUI. Fixes #1500.
Ella Mae Lee2014-04-02 Updated the documentation, fixes #1622 and #1688.
Jeffrey Covington2015-01-15 Removed unreachable code.

Parameter Groups

Files

Name Description
FROM Input cube
TO Output cropped cube

Sample Extraction

Name Description
SAMPLEStarting Sample
NSAMPLESNumber of Samples
SINCSample increment

Line Extraction

Name Description
LINEStarting Line
NLINESNumber of Lines
LINCLine increment

MISC

Name Description
PROPSPICE Propagate SPICE information to output cube
X

Files: FROM


Description

This is the input cube that will be cropped.

Type cube
File Mode input
Filter *.cub
Close Window
X

Files: TO


Description

The smaller output cube containing the results of crop.

Type cube
File Mode output
Filter *.cub
Close Window
X

Sample Extraction: SAMPLE


Description

This is the starting sample of the area to extract. It must be inside the cube area.

Type integer
Default 1
Minimum 1 (inclusive)
Close Window
X

Sample Extraction: NSAMPLES


Description

This defines how many samples to extract from the input cube, if SINC is 1. Otherwise, the number of samples actually extracted from the input cube is NSAMPLES/SINC.

Type integer
Internal Default All samples
Minimum 1 (inclusive)
Close Window
X

Sample Extraction: SINC


Description

This specifies the sample increment to use when extracting from the input cube. This effectively skips samples when the value is greater than 1. For example, if SINC=2 and SAMPLE=1 the output cube would contain samples 1, 3, 5, 7, and so on. Note that this reduces the size of the output cube as specified by NSAMPLES. That is, if NSAMPLES=200 and SINC=2, the output cube will have 100 samples.

Type integer
Default 1
Minimum 1 (inclusive)
Close Window
X

Line Extraction: LINE


Description

This is the starting line of the area to extract. It must be inside the cube.

Type integer
Default 1
Minimum 1 (inclusive)
Close Window
X

Line Extraction: NLINES


Description

This defines how many lines will be extracted from the input cube, if LINC is 1. Otherwise, the number of lines actually extracted from the input cube is NLINES/LINC.

Type integer
Internal Default All lines
Minimum 1 (inclusive)
Close Window
X

Line Extraction: LINC


Description

This specifies the line increment to use when extracting from the input cube. This effectively skips lines when the value is greater than 1. For example if LINC=2 and LINE=5 the output cube would contain lines 5, 7, 9, 11, and so on. Note that this reduces the size of the output cube as specified by NLINES. That is, if NLINES=200 and LINC=2, the output cube will have 100 lines.

Type integer
Default 1
Minimum 1 (inclusive)
Close Window
X

MISC: PROPSPICE


Description

This specifies whether or not to propagate the SPICE Kernels group to the output file for a Level 1 image. If this parameter is set to "False," then there will be no camera model available to compute geometric and photometric information using the cropped cube.

Type boolean
Default true
Close Window

Example 1

Extract a 200x300 sub-area

Description

Extract 200 samples by 300 lines sub-area from the input file.

Command Line

crop f=peaks.cub t=crop.cub samp=100 line=200 nsamp=200 nline=300
In this example, crop will extract a 200x300 sub-area that starts at sample 100 and line 200 from the input cube.

GUI Screenshot

Crop GUI

Example GUI

This is a screenshot of crop. The GUI shows the parameters filled to extract a 200x300 pixel sub-area from the input image.

Input Image

Input image

Input image

Parameter Name: FROM

This is the full size input image. The area (200x300) to be "cropped" is outlined in red.

Output Image

Output image showing the results of the crop application.

Cropped output image

Parameter Name: TO

This is the cropped output image that is 200x300, samples and lines respectively.