Programming with LEADTOOLS NITF Functions
The National Imagery Transmission Format (NITF) File is defined by the Department Of Defense of the United States. For background on the origination and purpose of this standard, refer to the Department of Defence Interface Standard MIL-STD-2500B (this link takes a minute to load and requires that you have Adobe .pdf reader installed) and the NITFS Technical Board Public Page.
Creating and Parsing NITF Files
The LNITFFile::Create function must be called before calling any other LNITFFile::XXX function. Otherwise, the other LNITFFile::XXX function will return WRPERR_NITF_NOT_CREATED error code. This LNITFFile::Create function is used to create an empty NITF file, or parse an existing NITF file.
To create an empty NITF file, call the LNITFFile::Create function and pass NULL for the pszFileName parameter. To parse an existing NITF file, call the LNITFFile::Create function with a valid file name for the pszFileName parameter.
If the LNITFFile::Create function was used to parse an existing file, information about the NITF file header can be obtained by passing a pointer to NITFHEADER structure to the LNITFFile::GetNITFHeader function. To change the current information about a NITF file header, change the values in the structure pointed to by the pNITFHeader parameter and pass it to the LNITFFile::SetNITFHeader function. When the NITF file header information is no longer needed the function LNITFFile::FreeNITFHeader should be called.
Save the created NITF file by calling the LNITFFile::SaveFile function.
When the class object is no longer needed, call the LNITFFile::Destroy function. For every call to LNITFFile::Create there must be a call to LNITFFile::Destroy.
Appending Data to NITF Files
The following types of data can be appended to NITF files:
Image:
To append an image to a NITF file, call the LNITFFile::AppendImageSegment
function, passing a valid LBitmapBase object that references
the bitmap that holds the image data to be appended to an image segment
in the NITF file.
Graphic:
To append a graphic, call the LNITFFile::AppendGraphicSegment
function, passing a valid LVectorBase object that holds the
graphic data to be appended to the graphic segment in the NITF file.
Text:
To append text, call the LNITFFile::AppendTextSegment
function, passing a valid text file name that holds the text data to be
appended to the text segment in the NITF file.
Getting and Setting Data Headers
It is possible to change information about the following data headers from or to the NITF file:
Image Header:
To obtain information about specific image header from the image segment
in the NITF file, call the LNITFFile::GetImageHeader
function, passing a pointer to an IMAGEHEADER
structure along with the index of the image header in the image segment.
To change the current information of a specific image header, change the
values in the structure pointed to by the pImageHeader
parameter and pass it to the LNITFFile::SetImageHeader
function, specifying the index of the image header in the image segment.
To get the number of the image headers in the image segment inside the
NITF file, call the LNITFFile::GetImageHeaderCount
function. When the image header information is no longer needed the function
LNITFFile::FreeImageHeader
should be called.
Graphic
Header: To obtain information about a specific graphic header from
the graphic segment in the NITF file, call the LNITFFile::GetGraphicHeader
function, passing a pointer to a GRAPHICHEADER
structure along with the index of the graphic header in the graphic segment.
To change the current information for a specific graphic header, change
the values in the structure pointed to by pGraphicsHeader
parameter and pass it to the LNITFFile::SetGraphicHeader
function, specifying the index of the graphic header in the graphic segment.
To get the number of graphic headers in the graphic segment inside the
NITF file, call the LNITFFile::GetGraphicHeaderCount
function. When the graphic header information is no longer needed the
function LNITFFile::FreeGraphicHeader
should be called.
To retrieve an LVectorBase class object as the graphic data for a specific header in the graphic segment of the NITF file, call the LNITFFile::GetVector function, passing the index of the graphic header in the graphic segment.
To change the graphic data of a specific header in the graphic segment of the NITF file, call the LNITFFile::SetVector function, passing the index of the graphic header in the graphic segment along with a valid LVectorBase object that references this graphic data.
Text Header:
To obtain information about a specific text header in a text segment in
the NITF file, call the LNITFFile::GetTextHeader
function, passing a pointer to a TXTHEADER
structure along with the index of the text header in the text segment.
To change the current information for a specific text header, change the
values in the structure pointed to by the pTextHeader
parameter and pass it to the LNITFFile::SetTextHeader
function, specifying the index of the text header in the text segment.
To get the number of the text headers in the text segment inside the NITF
file, call the LNITFFile::GetTextHeaderCount
function. When the text header information is no longer needed the function
LNITFFile::FreeTextHeader
should be called. To obtain the text data for a specific header in the
text segment of the NITF file, call the LNITFFile::GetTextSegment
function, passing the index of the text header in the text segment.
For more information, refer to:
See Also: