Save NITF Files
This topic describes additional information about using the Save As option to save an existing NITF or raster dataset to a new NITF file. See Save Files for steps on how to save the file. To save a screen capture (or chip) of all layers in the current view, see Chip the View.
See the following sections for more information on how NITF file components are preserved on output:
- Compression Options
- File Headers
- Edit Metadata
- Data Extension Segments
- Tagged Record Extensions
- Image Segments
Compression Options
NITF 2.1 images can be saved in NSIF Preferred JPEG 2000 Encoding (NPJE) format with numerically lossless and visually lossless compression settings. NITF 2.1 images can also be saved in Exploitation Preferred JPEG 2000 Encoding (EPJE) format with visually lossless and numerically lossless settings.
The types of compression available (if any) are determined by the data type and the NITF output version selected, as indicated in the table below. Higher compression rates result in smaller files with lower quality.
The following table shows the available compression types.
NITF Output Version |
Data Type |
Compression Types |
---|---|---|
All versions |
1- or 3-Band Byte |
JPEG DCT (High compression) |
NITF 2.1 and NSIF 1.0 (NPJE, EPJE) |
Any Integer data type
Floating Point, Double |
JPEG 2000 NPJE (Visually Lossless) None |
Supported data types and other criteria for export are described in the following table.
Compression Type |
NITF 2.0 |
NITF 2.1 |
---|---|---|
None |
# of Bands: 1, 3, or 4 Data Types:
|
# of Bands: 1-999 Data Types:
|
JPEG DCT |
# of Bands: 1 or 3 Data Types: Byte |
# of Bands: 1 or 3 Data Types: Byte |
JPEG 2000 NPJE |
Not available |
# of Bands: 1-999 Data Types:
|
JPEG 2000 EPJE |
Not available |
# of Bands: 1-999 Data Types:
|
You can edit all security and origination information contained in the file, along with image settings controlling how the image is written (including image blocking settings) using NITF Preferences. Many of these settings have no required values, some have only a short list of acceptable values, and others are dependent on the values present in other fields.
NPJE
You can save NITF 2.1 images in NPJE (NSIF Preferred JPEG 2000 Encoding) with numerically lossless and visually lossless settings.
If you choose JPEG 2000 NPJE compression, ENVI creates a J2KLRA TRE and removes the existing J2KLRA TRE, if present. If you save a file containing a J2KLRA TRE to an uncompressed file, ENVI removes the J2KLRA TRE.
EPJE
You can save NITF 2.1 images in Exploitation Preferred JPEG 2000 Encoding (EJPE) format with visually lossless and numerically lossless settings. When saving from a NITF file with an existing J2KLRA TRE, a new J2KLRA TRE is created because the image is being recompressed. NITF EPJE files display faster than NPJE files and EPJE is a required output format for IEC workstations.
ENVI cannot create an EPJE file without creating a temporary file. It uses the default temporary directory specified in NITF Preferences.
Transcoding
If you are saving a single C8 image segment without subsetting it, two additional options appear in the Compression drop-down list in the Save As dialog:
- Transcode NPJE to EPJE
- Transcode EPJE to NPJE
If you select one of these transcoding options, the image codestream is reordered to match the profile as closely as possible, and the codestream is neither decompressed nor recompressed.
The following changes may occur in the codestream, depending on the input profile of the codestream and the output option selected:
- Progression order (LRCP vs. RLCP)
- Segmentation and ordering of tile-parts
- PLT and TLM marker segments
The following do not change:
- Tile size
- Code-block size
- Quality
- Number of decomposition levels
- Wavelet transform
- Number of guard bits
If the image segment contains a J2KLRA or HISTOA TRE, these are updated with the appropriate information.
Note: Transcoding is not available for image segments that are embedded JPEG 2000 files.
File Headers
When you create a new NITF file from an existing dataset, the header settings from the source dataset are saved to the new file, except for the following values:
- The file date and time are set to the current date and time.
- The number of file copies is incremented (unless it is currently set to 0), and this copy number is set to the number of copies.
- For existing NITF files, any image segment with a compression setting not supported for output is set to uncompressed by default.
- For existing NITF files, the output version will be the same as the input version. For all other file types, the version number is set via the New NITF File Metadata, NITF Version field in the NITF Preferences.
Image segments cannot contain masks used to alter image values for display, when you create NITF output.
ENVI passes through or fills in by default some metadata. For more information, see the sections that follow.
Edit Metadata
When you save an image to NITF format or when you chip the current view to a NITF file, you can edit various NITF metadata fields. This topic describes the options that are available in the NITF Metadata Editor dialog.
Text Segments
- To add a text segment, select the file header, image segment, or text segment in the tree view and click the Add Text button. Type your text in the field provided, and click OK. You can also click the Import ASCII button to import a text file, and click OK. A new text segment appears in the tree view. The properties for that text segment automatically display.
- To edit existing text, select the text segment in the tree view. Then click in the Text field in the property sheet, click the right arrow, and select Edit.
- To delete a text segment, select the text segment in the tree view and click the Delete Text button.
- When you save a NITF file to a new NITF file, text segments and associated TREs are preserved in the new file. In NITF 2.1, text segments are attached to either the file or an image segment of a NITF image file by using an attachment level field, TXTALVL. The attachment level is the display level of an image or graphic segment to which the text segment is attached; a value of 0 indicates the attachment is to the file header. NITF 2.0 text segments do not have attachment levels.
PIA TREs
Profile for Imagery Access and Profile for Imagery Archive (PIA) TREs are used to hold information required by the Standards Profile for Imagery Access (SPIA). See Background on PIA TREs for rules on which ones you can edit.
- You can set default PIA TRE file metadata using NITF Preferences.
- To create new PIA TREs, select a file header, image segment, or text segment from the tree view, and click the Add PIAs button. Select which PIA TREs and how many of the TREs you want, then click OK. The PIAPRD TRE is the only PIA TRE that you can attach to a file header, and you can only add one PIAPRD TRE. You can only add one PIAIMC TRE to an image segment.
- To delete a PIA TRE, select it from the tree view and click the Delete PIA button.
- When you save a NITF file to a new NITF file, the PIA TREs associated with the file header and any image, symbol, label, or text segments are preserved in the new file.
Data Extension Segments
When you save an existing NITF file to NITF format, supported DES segments are preserved in the new file. ENVI currently only supports NITF Commercial Dataset Requirements Document (NCDRD) DESes. You cannot edit, create, or delete NCDRD DESes through the NITF Metadata Editor. When writing a NITF file that contains a DES with no corresponding XML file, ENVI passes through this unknown DES.
Tagged Record Extensions
When you save a NITF file to a new NITF file, supported TREs associated with any exportable segments are preserved in the new file. A warning message is provided if any TRE is not supported.
If you select a spatial subset of an input dataset for output, the ICHIPB TRE is used to maintain the relationship of the output image data to the source image data and to ensure the validity of any other TRE. The ICHIPB TRE contains the size and position of the subset and is written in the image segment. A new ICHIPB TRE is added to the list of TREs when you export an image segment with a TRE with any spatial subset other than the entire image. If the ICHIPB TRE already exists, it is modified for the new (smaller) subset of the initial subset to still contain the correct parameters from the original source image, not the initial subset.
If a NITF image segment contains HISTOA TREs and NEVENTS is not equal to the maximum value of 99 in the last HISTOA TRE, ENVI automatically updates this TRE upon output. If NEVENTS is equal to 99 in the last HISTOA TRE, ENVI creates a new HISTOA TRE.
Image Segments
NITF image segments can be created from any supported data type except 64-bit integer and complex. Image segments are populated in this way:
- Security information, date and time: The security information for the image segment is read from the NITF Preferences, and the image date and time are set. For NITF 2.1 files, the date and time is set to UNKNOWN; for NITF 2.0 files, the date and time is set to Jan. 1, 1970 (because NITF 2.0 does not recognize UNKNOWN).
- Rows, columns, bands, and data type: The number of rows, columns, bands, and the data type of the output dataset is determined from the input dataset. If the number of rows and columns is less than 4096, the block size is set to the full image size. For larger images, the image is set to a block size of 1024x1024.
- Compression: By default, the image is uncompressed.
- Map information: If the image has map information in UTM, this information is written to the file using the MGRS representation supported in both NITF 2.0 and 2.1. Other map information will be converted into geographic coordinates for export.
ENVI adds the RPC00B TRE when exporting to any NITF file containing RPC information. The RPC00B TRE is automatically created when this information is available, and the ICHIPB TRE is created if needed. These TREs will be stored in the image segment of the new NITF file. The ICHIPB TRE is required if a spatial subset of the input image is selected or the input image is a subset of a larger product.
ENVI may also create GEOPSB, PRJPSB, GEOLOB, or MAPLOB TREs if the input file contains map information.
-
Image and band representation: For single-band images, the image representation field is set to MONO and the band representation is set to M, while three-band byte images have RGB as the image representation, with the band representations set to R,G, and B. For any other band count, the image representation will be set to MULTI and, if a set of default bands is specified for this file, these bands will have their representations set to R, G, and B to indicate that these bands should be displayed by default. See the table below for more information.
Type of Image
Image (Representation)
Band (Representation)
Single-band image
MONO
M
Three-band byte image
RGB
R,G,B
Other image
MULTI
R,G,B (if specified)
- Wavelength information: If wavelength information is not available for the file, or if only one band is being exported, the image category is set to VIS, and the band subcategory is left blank. If wavelength information is available, ENVI will attempt to convert the wavelength into nanometers, then write that information into the band subcategory. In this case, the image category is set based upon the number of input bands: HS is used for files with more than 200 bands, and MS is used for files with 2-200 bands. All other fields are left blank. The BANDSB TRE is automatically created and populated with all available information when the input file contains wavelength information.