The NITF image header (sarpy.io.general.nitf_elements.image)¶
The image subheader definitions.
- class sarpy.io.general.nitf_elements.image.ImageBand(**kwargs)¶
Bases:
NITFElement
Single image band, part of the image bands collection
- IREPBAND: str¶
Representation. This field shall contain a valid indicator of the processing required to display the nth band of the image with regard to the general image type as recorded in the IREP field. The significance of each band in the image can be derived from the combination of the ICAT, and ISUBCAT fields. Valid values of the IREPBAND field depend on the value of the IREP field.
- Type:
str
- ISUBCAT: str¶
Subcategory. The purpose of this field is to provide the significance of the band of the image with regard to the specific category (ICAT field) of the overall image.
- Type:
str
- IFC: str¶
Image Filter Condition. Takes values in
{'N'}
. Default value isN
.- Type:
str
- IMFLT: str¶
Standard Image Filter Code. This field is reserved for future use.
- Type:
str
- classmethod minimum_length()¶
The minimum size in bytes that takes to write this header element.
- Return type:
int
- property LUTD¶
The Look-up Table (LUT) data.
- Return type:
None|numpy.ndarray
- property NLUTS¶
Number of LUTS for the Image Band. This field shall contain the number of LUTs associated with the nth band of the image. LUTs are allowed only if the value of the PVTYPE field is
INT
orB
.- Return type:
int
- property NELUTS¶
Number of LUT Entries for the Image Band. This field shall contain the number of entries in each of the LUTs for the nth image band.
- Return type:
int
- classmethod from_bytes(value, start)¶
- Parameters:
value (bytes|str) – the header string to scrape
start (int) – the beginning location in the string
- get_bytes_length()¶
Get the length of the serialized bytes array
- Return type:
int
- to_bytes()¶
Write the object to a properly packed str.
- Return type:
bytes
- to_json()¶
Serialize element to a json representation. This is intended to allow a simple presentation of the element.
- Return type:
dict
- class sarpy.io.general.nitf_elements.image.ImageSegmentHeader(**kwargs)¶
Bases:
NITFElement
The image segment header - see standards document Joint BIIF Profile (JBP) for more information.
- IM: str¶
File part type. Takes values in
{'IM'}
. Default value isIM
.- Type:
str
- IID1: str¶
Image Identifier 1. This field shall contain a valid alphanumeric identification code associated with the image. The valid codes are determined by the application.
- Type:
str
- IDATIM: str¶
Image Date and Time. This field shall contain the time (UTC) of the image acquisition in the format
YYYYMMDDhhmmss
.- Type:
str
- TGTID: str¶
Target Identifier. This field shall contain the identification of the primary target in the format,
BBBBBBBBBBOOOOOCC
, consisting of ten characters of Basic Encyclopedia (BE) identifier, followed by five characters of facility OSUFFIX, followed by the two character country code as specified in FIPS PUB 10-4.- Type:
str
- IID2: str¶
Image Identifier 2. This field can contain the identification of additional information about the image.
- Type:
str
- Security: NITFSecurityTags¶
The image security tags.
- Type:
- ENCRYP: str¶
Encryption. Takes values in
{'0'}
. Default value is0
.- Type:
str
- ISORCE: str¶
Image Source. This field shall contain a description of the source of the image. If the source of the data is classified, then the description shall be preceded by the classification, including codeword(s).
- Type:
str
- NROWS: int¶
Only the rows indexed 0 to the value of the NROWS field minus 1 of the image contain significant data. The pixel fill values are determined by the application. Default value is
0
.- Type:
int
- Type:
Number of Significant Rows in Image. This field shall contain the total number of rows of significant pixels in the image. When the product of the values of the NPPBV field and the NBPC field is greater than the value of the NROWS field (\(NPPBV \cdot NBPC > NROWS\)), the rows indexed with the value of the NROWS field to (\(NPPBV\cdot NBPC - 1\)) shall contain fill data. NOTE
- NCOLS: int¶
Only the columns indexed 0 to the value of the NCOLS field minus 1 of the image contain significant data. The pixel fill values are determined by the application. Default value is
0
.- Type:
int
- Type:
Number of Significant Columns in Image. This field shall contain the total number of columns of significant pixels in the image. When the product of the values of the NPPBH field and the NBPR field is greater than the NCOLS field (\(NPPBH\cdot NBPR > NCOLS\)), the columns indexed with the value of the NCOLS field to (\(NPPBH\cdot NBPR - 1\)) shall contain fill data. NOTE
- PVTYPE: str¶
Pixel Value Type. This field shall contain an indicator of the type of computer representation used for the value for each pixel for each band in the image. Takes values in
{'R', 'INT', 'SI', 'B', 'C'}
.- Type:
str
- IREP: str¶
Image Representation. This field shall contain a valid indicator of the processing required in order to display an image. Takes values in
{'NODISPLY', 'RGB/LUT', 'MONO', 'NVECTOR', 'YCbCr601', 'RGB', 'POLAR', 'VPH', 'MULTI'}
. Default value isNODISPLY
.- Type:
str
- ICAT: str¶
Image Category. This field shall contain a valid indicator of the specific category of image, raster or grid data. The specific category of an IS reveals its intended use or the nature of its collector. Default value is
SAR
.- Type:
str
- ABPP: int¶
Actual Bits-Per-Pixel Per Band. This field shall contain the number of “significant bits” for the value in each band of each pixel without compression. Even when the image is compressed, ABPP contains the number of significant bits per pixel that were present in the image before compression. This field shall be less than or equal to Number of Bits Per Pixel (field NBPP). The number of adjacent bits within each NBPP is used to represent the value. Default value is
0
.- Type:
int
- PJUST: str¶
Pixel Justification. When ABPP is not equal to NBPP, this field indicates whether the significant bits are left justified (
L
) or right justified (R
). Takes values in{'R', 'L'}
. Default value isR
.- Type:
str
- ICORDS: str¶
Image Coordinate Representation. This field shall contain a valid code indicating the type of coordinate representation used for providing an approximate location of the image in the Image Geographic Location field (IGEOLO). Takes values in
{'', 'N', 'D', 'S', 'U', 'G'}
. Default value isG
.- Type:
str
- Comments: ImageComments¶
The image comments.
- Type:
ImageComments
- Bands: ImageBands¶
The image bands.
- Type:
ImageBands
- ISYNC: int¶
Image Sync code. This field is reserved for future use. Default value is
0
.- Type:
int
- IMODE: str¶
Image Mode. This field shall indicate how the Image Pixels are stored in the NITF file. Takes values in
{'B', 'R', 'P', 'S'}
. Default value isP
.- Type:
str
- NBPR: int¶
Number of Blocks Per Row. This field shall contain the number of image blocks in a row of blocks (paragraph 5.4.2.2) in the horizontal direction. If the image consists of only a single block, this field shall contain the value one. Default value is
1
.- Type:
int
- NBPC: int¶
Number of Blocks Per Column. This field shall contain the number of image blocks in a column of blocks (paragraph 5.4.2.2) in the vertical direction. If the image consists of only a single block, this field shall contain the value one. Default value is
1
.- Type:
int
- NPPBH: int¶
Number of Pixels Per Block Horizontal. This field shall contain the number of pixels horizontally in each block of the image. It shall be the case that the product of the values of the NBPR field and the NPPBH field is greater than or equal to the value of the NCOLS field (\(NBPR\cdot NPPBH \geq NCOLS\)). When NBPR is
1
, setting the NPPBH value to0
designates that the number of pixels horizontally is specified by the value in NCOLS. Default value is0
.- Type:
int
- NPPBV: int¶
Number of Pixels Per Block Vertical. This field shall contain the number of pixels vertically in each block of the image. It shall be the case that the product of the values of the NBPC field and the NPPBV field is greater than or equal to the value of the NROWS field (\(NBPC\cdot NPPBV \geq NROWS\)). When NBPC is
1
, setting the NPPBV value to0
designates that the number of pixels vertically is specified by the value in NROWS. Default value is0
.- Type:
int
- NBPP: int¶
Number of Bits Per Pixel Per Band. Default value is
0
.- Type:
int
- IDLVL: int¶
Image Display Level. This field shall contain a valid value that indicates the display level of the image relative to other displayed file components in a composite display. The valid values are
1-999
. The display level of each displayable segment (image or graphic) within a file shall be unique. Default value is0
.- Type:
int
- IALVL: int¶
Attachment Level. This field shall contain a valid value that indicates the attachment level of the image. Default value is
0
.- Type:
int
- ILOC: str¶
Image Location. The image location is the location of the first pixel of the first line of the image. This field shall contain the image location offset from the ILOC or SLOC value of the segment to which the image is attached or from the origin of the CCS when the image is unattached (IALVL contains
0
). A row or column value of0
indicates no offset. Positive row and column values indicate offsets down and to the right while negative row and column values indicate offsets up and to the left.- Type:
str
- IMAG: str¶
Image Magnification. This field shall contain the magnification (or reduction) factor of the image relative to the original source image. Decimal values are used to indicate magnification, and decimal fraction values indicate reduction. For example,
2.30
indicates the original image has been magnified by a factor of2.30
, while0.5
indicates the original image has been reduced by a factor of 2. Default value is1.0
.- Type:
str
- UserHeader: UserHeaderType¶
User defined header.
- Type:
- ExtendedHeader: UserHeaderType¶
Extended subheader - TRE list.
- Type:
- property is_masked¶
Does this image segment contain a mask?
- Type:
bool
- property is_compressed¶
Is this image segment compressed?
- Type:
bool
- property IC¶
Image Compression. This field shall contain a valid code indicating the form of compression used in representing the image data.
Valid values for this field are,
C1
to represent bi-level,C3
to represent JPEG,C4
to represent Vector Quantization,C5
to represent lossless JPEG,I1
to represent down sampled JPEG, andNC
to represent the image is not compressed. Also valid areM1, M3, M4
, andM5
for compressed images, andNM
for uncompressed images indicating an image that contains a block mask and/or a pad pixel mask.C6
andM6
are reserved values that will represent a future correlated multicomponent compression algorithm.C7
andM7
are reserved values that will represent a future complex SAR compression.C8
andM8
are the values for ISO standard compression JPEG 2000.The format of a mask image is identical to the format of its corresponding non-masked image except for the presence of an Image Data Mask at the beginning of the image data area. The format of the Image Data Mask is described in paragraph 5.4.3.2 and is shown in table A-3(A). The definitions of the compression schemes associated with codes
C1/M1, C3/M3, C4/M4, C5/M5
are given, respectively, in ITU- T T.4, AMD2, MIL-STD-188-198A, MIL-STD- 188-199, and NGA N0106-97.C1
is found in ITU- T T.4 AMD2,C3
is found in MIL-STD-188-198A,C4
is found in MIL-STD-188-199, andC5
andI1
are found in NGA N0106-97. (NOTE:C2
(ARIDPCM) is not valid in NITF 2.1.) The definition of the compression scheme associated with codesC8/M8
is found in ISO/IEC 15444- 1:2000 (with amendments 1 and 2).- Type:
str
- property COMRAT¶
Compression Rate Code. If the IC field contains one of
C1, C3, C4, C5, C8, M1, M3, M4, M5, M8, I1
, this field shall be contain a code indicating the compression rate for the image.If IC is
NC
orNM
, then this will be set toNone
.- Type:
None|str
- property IGEOLO¶
Image Geographic Location. This field, when present, shall contain an approximate geographic location which is not intended for analytical purposes (e.g., targeting, mensuration, distance calculation); it is intended to support general user appreciation for the image location (e.g., cataloguing). The representation of the image corner locations is specified in the ICORDS field. The locations of the four corners of the (significant) image data shall be given in image coordinate order: (0,0), (0, MaxCol), (MaxRow, MaxCol), (MaxRow, 0). MaxCol and MaxRow shall be determined from the values contained, respectively, in the NCOLS field and the NROWS field.
- Type:
None|str
- property mask_subheader: None | MaskSubheader¶
The mask subheader, if it has been appended.
- Type:
None|MaskSubheader
- classmethod minimum_length()¶
The minimum size in bytes that takes to write this header element.
- Return type:
int
- get_uncompressed_block_size() int ¶
Gets the size of an uncompressed block.
Note that if IMODE == ‘S’, then each block consists of a single band. Otherwise, a block consists of all bands.
- Return type:
int
- get_full_uncompressed_image_size() int ¶
Gets the full size in bytes of the uncompressed image including any padding in the blocks.
- Return type:
int
- get_clevel() int ¶
Gets the CLEVEL value for this image segment.
- Return type:
int
- classmethod from_bytes(value, start)¶
- Parameters:
value (bytes|str) – the header string to scrape
start (int) – the beginning location in the string
- get_bytes_length()¶
Get the length of the serialized bytes array
- Return type:
int
- to_bytes()¶
Write the object to a properly packed str.
- Return type:
bytes
- to_json()¶
Serialize element to a json representation. This is intended to allow a simple presentation of the element.
- Return type:
dict
- class sarpy.io.general.nitf_elements.image.ImageSegmentHeader0(**kwargs)¶
Bases:
NITFElement
The image segment header for NITF version 2.0 - see standards document MIL-STD-2500A for more information.
- IM: str¶
File part type. Takes values in
{'IM'}
. Default value isIM
.- Type:
str
- IID: str¶
Image Identifier 1. This field shall contain a valid alphanumeric identification code associated with the image. The valid codes are determined by the application.
- Type:
str
- IDATIM: str¶
Image Date and Time. This field shall contain the time (UTC) of the image acquisition in the format
YYYYMMDDhhmmss
.- Type:
str
- TGTID: str¶
Target Identifier. This field shall contain the identification of the primary target in the format,
BBBBBBBBBBOOOOOCC
, consisting of ten characters of Basic Encyclopedia (BE) identifier, followed by five characters of facility OSUFFIX, followed by the two character country code as specified in FIPS PUB 10-4.- Type:
str
- ITITLE: str¶
Image Identifier 2. This field can contain the identification of additional information about the image.
- Type:
str
- Security: NITFSecurityTags0¶
The image security tags.
- Type:
- ENCRYP: str¶
Encryption. Takes values in
{'0'}
. Default value is0
.- Type:
str
- ISORCE: str¶
Image Source. This field shall contain a description of the source of the image. If the source of the data is classified, then the description shall be preceded by the classification, including codeword(s).
- Type:
str
- NROWS: int¶
Only the rows indexed 0 to the value of the NROWS field minus 1 of the image contain significant data. The pixel fill values are determined by the application. Default value is
0
.- Type:
int
- Type:
Number of Significant Rows in Image. This field shall contain the total number of rows of significant pixels in the image. When the product of the values of the NPPBV field and the NBPC field is greater than the value of the NROWS field (\(NPPBV \cdot NBPC > NROWS\)), the rows indexed with the value of the NROWS field to (\(NPPBV\cdot NBPC - 1\)) shall contain fill data. NOTE
- NCOLS: int¶
Only the columns indexed 0 to the value of the NCOLS field minus 1 of the image contain significant data. The pixel fill values are determined by the application. Default value is
0
.- Type:
int
- Type:
Number of Significant Columns in Image. This field shall contain the total number of columns of significant pixels in the image. When the product of the values of the NPPBH field and the NBPR field is greater than the NCOLS field (\(NPPBH\cdot NBPR > NCOLS\)), the columns indexed with the value of the NCOLS field to (\(NPPBH\cdot NBPR - 1\)) shall contain fill data. NOTE
- PVTYPE: str¶
Pixel Value Type. This field shall contain an indicator of the type of computer representation used for the value for each pixel for each band in the image. Takes values in
{'R', 'INT', 'SI', 'B', 'C'}
.- Type:
str
- IREP: str¶
Image Representation. This field shall contain a valid indicator of the processing required in order to display an image. Takes values in
{'NODISPLY', 'RGB/LUT', 'MONO', 'NVECTOR', 'YCbCr601', 'RGB', 'POLAR', 'VPH', 'MULTI'}
. Default value isNODISPLY
.- Type:
str
- ICAT: str¶
Image Category. This field shall contain a valid indicator of the specific category of image, raster or grid data. The specific category of an IS reveals its intended use or the nature of its collector. Default value is
SAR
.- Type:
str
- ABPP: int¶
Actual Bits-Per-Pixel Per Band. This field shall contain the number of “significant bits” for the value in each band of each pixel without compression. Even when the image is compressed, ABPP contains the number of significant bits per pixel that were present in the image before compression. This field shall be less than or equal to Number of Bits Per Pixel (field NBPP). The number of adjacent bits within each NBPP is used to represent the value. Default value is
0
.- Type:
int
- PJUST: str¶
Pixel Justification. When ABPP is not equal to NBPP, this field indicates whether the significant bits are left justified (
L
) or right justified (R
). Takes values in{'R', 'L'}
. Default value isR
.- Type:
str
- ICORDS: str¶
Image Coordinate Representation. This field shall contain a valid code indicating the type of coordinate representation used for providing an approximate location of the image in the Image Geographic Location field (IGEOLO). Takes values in
{'U', 'N', 'G', 'C'}
. Default value isG
.- Type:
str
- Comments: ImageComments¶
The image comments.
- Type:
ImageComments
- Bands: ImageBands¶
The image bands.
- Type:
ImageBands
- ISYNC: int¶
Image Sync code. This field is reserved for future use. Default value is
0
.- Type:
int
- IMODE: str¶
Image Mode. This field shall indicate how the Image Pixels are stored in the NITF file. Takes values in
{'B', 'R', 'P', 'S'}
. Default value isP
.- Type:
str
- NBPR: int¶
Number of Blocks Per Row. This field shall contain the number of image blocks in a row of blocks (paragraph 5.4.2.2) in the horizontal direction. If the image consists of only a single block, this field shall contain the value one. Default value is
1
.- Type:
int
- NBPC: int¶
Number of Blocks Per Column. This field shall contain the number of image blocks in a column of blocks (paragraph 5.4.2.2) in the vertical direction. If the image consists of only a single block, this field shall contain the value one. Default value is
1
.- Type:
int
- NPPBH: int¶
Number of Pixels Per Block Horizontal. This field shall contain the number of pixels horizontally in each block of the image. It shall be the case that the product of the values of the NBPR field and the NPPBH field is greater than or equal to the value of the NCOLS field (\(NBPR\cdot NPPBH \geq NCOLS\)). When NBPR is
1
, setting the NPPBH value to0
designates that the number of pixels horizontally is specified by the value in NCOLS. Default value is0
.- Type:
int
- NPPBV: int¶
Number of Pixels Per Block Vertical. This field shall contain the number of pixels vertically in each block of the image. It shall be the case that the product of the values of the NBPC field and the NPPBV field is greater than or equal to the value of the NROWS field (\(NBPC\cdot NPPBV \geq NROWS\)). When NBPC is
1
, setting the NPPBV value to0
designates that the number of pixels vertically is specified by the value in NROWS. Default value is0
.- Type:
int
- NBPP: int¶
Number of Bits Per Pixel Per Band. Default value is
0
.- Type:
int
- IDLVL: int¶
Image Display Level. This field shall contain a valid value that indicates the display level of the image relative to other displayed file components in a composite display. The valid values are
1-999
. The display level of each displayable segment (image or graphic) within a file shall be unique. Default value is0
.- Type:
int
- IALVL: int¶
Attachment Level. This field shall contain a valid value that indicates the attachment level of the image. Default value is
0
.- Type:
int
- ILOC: str¶
Image Location. The image location is the location of the first pixel of the first line of the image. This field shall contain the image location offset from the ILOC or SLOC value of the segment to which the image is attached or from the origin of the CCS when the image is unattached (IALVL contains
0
). A row or column value of0
indicates no offset. Positive row and column values indicate offsets down and to the right while negative row and column values indicate offsets up and to the left.- Type:
str
- IMAG: str¶
Image Magnification. This field shall contain the magnification (or reduction) factor of the image relative to the original source image. Decimal values are used to indicate magnification, and decimal fraction values indicate reduction. For example,
2.30
indicates the original image has been magnified by a factor of2.30
, while0.5
indicates the original image has been reduced by a factor of 2. Default value is1.0
.- Type:
str
- UserHeader: UserHeaderType¶
User defined header.
- Type:
- ExtendedHeader: UserHeaderType¶
Extended subheader - TRE list.
- Type:
- property is_masked¶
Does this image segment contain a mask?
- Type:
bool
- property is_compressed¶
Is this image segment compressed?
- Type:
bool
- property IC¶
Image Compression. This field shall contain a valid code indicating the form of compression used in representing the image data.
Valid values for this field are,
C1
to represent bi-level,C3
to represent JPEG,C4
to represent Vector Quantization,C5
to represent lossless JPEG,I1
to represent down sampled JPEG, andNC
to represent the image is not compressed. Also valid areM1, M3, M4
, andM5
for compressed images, andNM
for uncompressed images indicating an image that contains a block mask and/or a pad pixel mask.C6
andM6
are reserved values that will represent a future correlated multicomponent compression algorithm.C7
andM7
are reserved values that will represent a future complex SAR compression.C8
andM8
are the values for ISO standard compression JPEG 2000.The format of a mask image is identical to the format of its corresponding non-masked image except for the presence of an Image Data Mask at the beginning of the image data area. The format of the Image Data Mask is described in paragraph 5.4.3.2 and is shown in table A-3(A). The definitions of the compression schemes associated with codes
C1/M1, C3/M3, C4/M4, C5/M5
are given, respectively, in ITU- T T.4, AMD2, MIL-STD-188-198A, MIL-STD- 188-199, and NGA N0106-97.C1
is found in ITU- T T.4 AMD2,C3
is found in MIL-STD-188-198A,C4
is found in MIL-STD-188-199, andC5
andI1
are found in NGA N0106-97. (NOTE:C2
(ARIDPCM) is not valid in NITF 2.1.) The definition of the compression scheme associated with codesC8/M8
is found in ISO/IEC 15444- 1:2000 (with amendments 1 and 2).- Type:
str
- classmethod from_bytes(value, start)¶
- Parameters:
value (bytes|str) – the header string to scrape
start (int) – the beginning location in the string
- get_bytes_length()¶
Get the length of the serialized bytes array
- Return type:
int
- to_bytes()¶
Write the object to a properly packed str.
- Return type:
bytes
- to_json()¶
Serialize element to a json representation. This is intended to allow a simple presentation of the element.
- Return type:
dict
- property COMRAT¶
Compression Rate Code. If the IC field contains one of
C1, C3, C4, C5, C8, M1, M3, M4, M5, M8, I1
, this field shall be contain a code indicating the compression rate for the image.If IC is
NC
orNM
, then this will be set toNone
.- Type:
None|str
- property IGEOLO¶
Image Geographic Location. This field, when present, shall contain an approximate geographic location which is not intended for analytical purposes (e.g., targeting, mensuration, distance calculation); it is intended to support general user appreciation for the image location (e.g., cataloguing). The representation of the image corner locations is specified in the ICORDS field. The locations of the four corners of the (significant) image data shall be given in image coordinate order: (0,0), (0, MaxCol), (MaxRow, MaxCol), (MaxRow, 0). MaxCol and MaxRow shall be determined from the values contained, respectively, in the NCOLS field and the NROWS field.
- Type:
None|str
- property mask_subheader: None | MaskSubheader¶
The mask subheader, if it has been appended.
- Type:
None|MaskSubheader
- classmethod minimum_length()¶
The minimum size in bytes that takes to write this header element.
- Return type:
int
- get_uncompressed_block_size() int ¶
Gets the size of an uncompressed block.
Note that if IMODE == ‘S’, then each block consists of a single band. Otherwise, a block consists of all bands.
- Return type:
int
- get_full_uncompressed_image_size() int ¶
Gets the full size in bytes of the uncompressed image including any padding in the blocks.
- Return type:
int
- get_clevel() int ¶
Gets the CLEVEL value for this image segment.
- Return type:
int