maptrim
Trim edges of a map projected image
This program trims map projected images and sets valid pixels that fall outside a specified bounding box to NULL. By default, the pixels that fall outside the minimum and maximum latitude and longitude found within the Mapping Group of the input cube's label are set to NULL.
The values entered for minimum and maximum latitude and longitude must be in the same longitude domain, longitude direction, and latitude type as the settings in the input image labels within the Mapping Group. If the values entered are in a different longitude domain, they will be interpreted as the domain setting in the image labels, and the entire output cube could contain only NULL pixels. For example, if the input cube's Mapping Group has a longitude direction of positive east and the user specifies values in west longitude, the longitude direction will be interpreted as positive east.
Option | Result |
---|---|
Trim | The image is resized. The pixel dimensions of the file are retained; therefore, the number of pixels is the same. The pixels that fall outside the default or specified latitude and longitude range are set to NULL. |
Crop | The image is resampled and trimmed to the exact latitude and longitude range specified for the bounding box. The pixels that fall outside the specified range are not set to NULL. |
Both | The image is resampled and trimmed to the exact latitude and longitude range specified for the bounding box. The pixels that fall outside the bounding box are set to NULL. |
Warnings:
Mapping information updated after image is cropped:
When the "crop" or "both" option is used, the keywords MinimumLatitude,
MaximumLatitude, MinimumLongitude, and MaximumLongitude are removed
from the labels. The values that the uncropped image contains have become
inaccurate to use for the cropped image because after an image has been
cropped, the UpperLeftCornerX and UpperLeftCornerY keywords, where these
values begin, have been updated in the labels. Once the labels are updated,
and if displayed with an image viewer, such as qview, the latitude and
longitude values can be reported accurately.
Mosaicking cropped images:
The cropped images can be mosaicked into an existing output mosaic file
using mapmos, or can be included in the input file list for automos.
If automos is used, the "grange=user" parameter may have to be entered along
with the latitude and longitude range of the mosaic depending on the ISIS version.
The option to automatically determine the minimum and maximum latitude and
longitude range from the input list in automos may be used but the Mapping Group
will only have the UpperLeftCornerX and UpperLeftCornerY keywords.
Note: This application does not handle non-projected images (i.e. images that are not Level2 or a mosaic). To trim a Level1 image, please refer to camtrim.
Categories
Related Applications to Previous Versions of ISIS
This program replaces the following application existing in previous versions of ISIS:- trimsinu
Related Objects and Documents
Applications
History
Tracie Sucharski | 2003-02-28 | Original version |
Tracie Sucharski | 2003-04-03 | Changed brief description, added error check for no values entered for slat,elat,slon,elon. |
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 |
Brendan George | 2005-11-21 | Added application test |
Sean Crosby | 2007-03-16 | Added cropping and crop+trim ability; modified apptest |
Christopher Austin | 2009-01-27 | Fixed parameter names |
Travis Addair | 2009-08-10 | Mapping group parameters are now placed into the print file. |
Mackenzie Boyd | 2009-08-12 | Modified call to crop to handle from and to parameters with spaces in directories. |
Jai Rideout | 2011-01-11 | Updated documentation and testing with Ella Lee in preparation for the 3.4.0 release. Fixed various inconsistencies in the documentation and rewrote some parts to make it clearer. Added an example. Added two new tests to test getting the lat/lon range from the cube labels and the processing of level 1 images. |
Debbie A. Cook | 2012-12-06 | Changed to use TProjection instead of Projection. References #775 |
Kimberly Oyama | 2013-01-14 | Changed the temporary file name to be unique between executions so there are no conflicts when multiple instances of the program are running. Added an app test to exercise this change. Fixes #1216. |
Ella Mae Lee | 2013-11-13 | Updated the documentation to clarify the results of the different trim options and added new example , fixes #1621. |
Parameters
Files
Type | cube |
---|---|
File Mode | input |
Filter | *.cub |
Type | cube |
---|---|
File Mode | output |
Filter | *.cub |
Trim options
Type | string | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Default | TRIM | ||||||||||||
Option List: |
|
Trim Parameters
Type | double |
---|---|
Internal Default | Minimum latitude in labels |
Minimum | -90 (inclusive) |
Maximum | 90 (inclusive) |
Less Than | MAXLAT |
Type | double |
---|---|
Internal Default | Maximum latitude in labels |
Minimum | -90 (inclusive) |
Maximum | 90 (inclusive) |
Greater Than | MINLAT |
Type | double |
---|---|
Internal Default | Minimum longitude in labels |
Minimum | -360 (inclusive) |
Maximum | 360 (inclusive) |
Less Than | MAXLON |
Type | double |
---|---|
Internal Default | Maximum longitude in labels |
Minimum | -360 (inclusive) |
Maximum | 360 (inclusive) |
Greater Than | MINLON |
Example 1
Trim a projected image
Command Line
maptrim
FROM=input.cub TO=trimmed.cub MINLAT=15 MAXLAT=20 MINLON=222
MAXLON=230
Input Image
Output Image
Example 2
Trim a projected image using CROP and BOTH options
Command Line
maptrim
FROM=LMMP_SAB_sinu.cub to=sinu_crop.cub mode=crop minlat=-60.5836
maxlat=-60.3129 minlon=-161.07 maxlon=-160.377
Input Image
Output Images
Output cube
sinu_crop.cub
Parameter Name:
TO
This is the cropped cube. Notice that only the specified bounding box was extracted out of the input cube.
Output cube
sinu_both.cub
Parameter Name:
TO
The image cube shown above was cropped and trimmed to
create the image cube shown on the left. Notice that all
the pixels outside the specified latitude and longitude range have
been set to NULL in this example.
The following command line was used to create this output cube:
maptrim from=LMMP_SAB_sinu.cub to=sinu_both.cub mode=both
minlat=-60.5836 maxlat=-60.3129 minlon=-161.07 maxlon=-160.377