crop
Extracts a sub-area from a cube
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 Mathews | 1994-04-20 | Original version |
Jeff Anderson | 2002-08-05 | Converted to Isis 3.0 |
K Teal Thompson | 2002-11-18 | Added examples |
Jeff Anderson | 2003-01-28 | Removed crop from the Utility category |
K Teal Thompson | 2003-02-03 | Make images smaller |
K Teal Thompson | 2003-02-04 | Added red rectangle to input image of example to illustrate crop area. |
K Teal Thompson | 2003-03-19 | Moved images to /assets/image directory and thumbnails to /assets/thumb directory. |
Stuart Sides | 2003-04-04 | Fixed problem with isiscvs not checking in the thumb and image directories. |
Stuart Sides | 2003-04-25 | Added extraction labels |
Stuart Sides | 2003-05-16 | Modified schema location from astrogeology... to isis.astrogeology..." |
Stuart Sides | 2003-07-29 | Modified filename parameters to be cube parameters where necessary |
Jeff Anderson | 2004-02-16 | Replaced extraction group with AlphaCube group and propagated other labels. |
Jeff Anderson | 2004-02-16 | Added LINC and SINC parameters and set defaults for all parameters |
Brendan George | 2006-12-29 | Fixed to allow input band selection |
Elizabeth Miller | 2007-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 Lambright | 2008-05-13 | Removed references to CubeInfo |
Steven Lambright | 2008-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 Lambright | 2008-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 Lambright | 2009-06-30 | When an invalid projection exists the proper error should now be thrown. |
Janet Barrett | 2009-10-21 | Now uses the SubArea class to produce output cube labels with corrected Mapping, Instrument, and AlphaCube groups. |
Tracie Sucharski | 2012-12-06 | Removed unnecessary include of Projection.h. References #775 |
Stuart Sides | 2013-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 Barrett | 2014-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 Lee | 2014-04-02 | Updated the documentation, fixes #1622 and #1688. |
Jeffrey Covington | 2015-01-15 | Removed unreachable code. |
Parameters
Files
Type | cube |
---|---|
File Mode | input |
Filter | *.cub |
Type | cube |
---|---|
File Mode | output |
Filter | *.cub |
Sample Extraction
Type | integer |
---|---|
Default | 1 |
Minimum | 1 (inclusive) |
Type | integer |
---|---|
Internal Default | All samples |
Minimum | 1 (inclusive) |
Type | integer |
---|---|
Default | 1 |
Minimum | 1 (inclusive) |
Line Extraction
Type | integer |
---|---|
Default | 1 |
Minimum | 1 (inclusive) |
Type | integer |
---|---|
Internal Default | All lines |
Minimum | 1 (inclusive) |
Type | integer |
---|---|
Default | 1 |
Minimum | 1 (inclusive) |
MISC
Example 1
Extract a 200x300 sub-area
Command Line
crop f=peaks.cub t=crop.cub samp=100 line=200 nsamp=200 nline=300
GUI Screenshot
Example GUI
Crop GUIThis 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.