Nitf Image Reader
Decode the pixel data section of an uncompressed (IC=NC or IC=NM) NITF image segment into a row-major ARGB int[] suitable for upload as a Bitmap / BufferedImage / <canvas> ImageData.
Spec coverage (MIL-STD-2500C §5.4.2.5–§5.4.2.10):
IMODE B (band-interleaved-by-block) — supported for all band counts.
IMODE P (band-interleaved-by-pixel) — supported.
IMODE R (band-interleaved-by-row) — supported.
IMODE S (band-sequential, blocks stored band-by-band) — supported.
NBPP ∈ {8, 16} integer pixels (PVTYPE=INT or SI). 1-bit (B) and IEEE floating-point (R) are out of scope here; callers wanting bilevel can pre-quantise to 8-bit themselves.
NBANDS ∈ {1, 3, 4} with IREP ∈ {MONO, RGB, RGB/LUT, MULTI}. MONO with a LUT becomes a paletted lookup; bare MONO maps grey→ARGB. RGB(A) sources are written straight through.
Block masks for IC=NM follow §5.4.1.2 (BMR with 0xFFFFFFFF = missing block, filled with the transparent pixel code if present, otherwise 0). Pad-pixel masks (TMR) are parsed but only the transparent code is used — applying per-pixel TMR data would require a second pass and is left for Phase 2.
16-bit signed values are output as (value + 32768) mapped to 0..255 in the grey ramp; the raw 16-bit grid is also exposed via decodeRaw for callers that want elevation/SAR/temperature data unmangled.
Functions
Decode the pixel grid into a row-major ARGB int[] of length numRows * numCols. Throws IllegalStateException for spec violations or features outside Phase 1's scope.
Decode the pixel grid into a RawImage preserving the source bit depth. Out-of-significant-area pixels are filled with 0 (or with the segment's transparent pixel code if one is declared in the NM mask).