LNITFFile::GetImageHeader

#include "ltwrappr.h"

L_INT LNITFFile::GetImageHeader(uIndex, pImageHeader)

L_UINT uIndex;

/* index of the image segment*/

pIMAGEHEADER pImageHeader;

/* pointer to a IMAGEHEADER structure */

Retrieves the image header information of a specific graphic segment.

Parameter

Description

uIndex

A zero-based index of the image segment in the NITF file.

pImageHeader

Pointer to an IMAGEHEADER structure to be updated with the image header information of the specified image segment at the index uIndex.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To retrieve the number of the image segments available in the NITF file, call the LNITFFile::GetImageHeaderCount function.

To change the image header information for a specific graphic segment, call the LNITFFile::SetImageHeader function.

Required DLLs and Libraries

LTNTF

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LNITFFile::Create, LNITFFile::Destroy, LNITFFile::GetStatus, LNITFFile::SaveFile, LNITFFile::AppendImageSegment, LNITFFile::AppendGraphicSegment, LNITFFile::AppendTextSegment, LNITFFile::SetVector, LNITFFile::GetVector, LNITFFile::GetNITFHeader, LNITFFile::SetNITFHeader, LNITFFile::GetGraphicHeaderCount, LNITFFile::GetGraphicHeader, LNITFFile::SetGraphicHeader, LNITFFile::GetImageHeaderCount, LNITFFile::SetImageHeader, LNITFFile::GetTextHeaderCount, LNITFFile::GetTextHeader, LNITFFile::SetTextHeader.

Topics:

NITF Functions: Getting and Setting Header Information.

 

Programming with LEADTOOLS NITF Functions.

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LNITFFile_GetImageHeaderExample()
{
   WRPUNLOCKSUPPORT();
   //Parse the NITF file
   LNITFFile Nitf; 
   Nitf.Create (MAKE_IMAGE_PATH(TEXT("test.ntf")));
   L_UINT uFlags = 0; 
   IMAGEHEADER ImageHeader; 
   L_UINT uCount; 
   L_UINT i = 0; 
   memset(&ImageHeader, 0, sizeof(IMAGEHEADER)); 
   // Check if the NITF File is empty or invalid
   uFlags = Nitf.GetStatus ();
   if((uFlags & NITF_FILE_EMPTY) == NITF_FILE_EMPTY) 
   {
      MessageBox(NULL, TEXT("NITF file is empty"), 0, 0);
      return SUCCESS;
   }
   if((uFlags & NITF_FILE_VALID) != NITF_FILE_VALID) 
   {
      MessageBox(NULL, TEXT("NITF file is invalid"), 0, 0);
      return SUCCESS;
   }
   // Update the graphic header
   uCount = Nitf.GetImageHeaderCount ();
   for( i = 0; i < uCount; ++i) 
   {
      if(Nitf.GetImageHeader(i, &ImageHeader) == SUCCESS) 
      {
         ImageHeader.nILOCCol = 50; 
         ImageHeader.nILOCRow = 50; 
         Nitf.SetImageHeader (i, &ImageHeader); 
         Nitf.FreeImageHeader(&ImageHeader);
      }
   }
   Nitf.SaveFile (MAKE_IMAGE_PATH(TEXT("test1.ntf")));
   Nitf.Destroy ();
   return SUCCESS;
}