Example #1
0
void MetadataReader::doImageSubheader(const std::string& key,
                                      ::nitf::ImageSubheader& subheader)
{
    writeField(key, "IID1", subheader.getImageId());
    writeField(key, "IDATIM", subheader.getImageDateAndTime());
    writeField(key, "TGTID", subheader.getTargetId());
    writeField(key, "IID2", subheader.getImageTitle());
    writeField(key, "ISCLAS", subheader.getImageSecurityClass());
    
    ::nitf::FileSecurity security = subheader.getSecurityGroup();
    doSecurity(key, "I", security);

    writeField(key, "ENCRYP", subheader.getEncrypted());
    writeField(key, "ISORCE", subheader.getImageSource());
    writeField(key, "NROWS", subheader.getNumRows());
    writeField(key, "NCOLS", subheader.getNumCols());
    writeField(key, "PVTYPE", subheader.getPixelValueType());
    writeField(key, "IREP", subheader.getImageRepresentation());
    writeField(key, "ICAT", subheader.getImageCategory());
    writeField(key, "ABPP", subheader.getActualBitsPerPixel());
    writeField(key, "PJUST", subheader.getPixelJustification());
    writeField(key, "ICORDS", subheader.getImageCoordinateSystem());
    writeField(key, "IGEOLO", subheader.getCornerCoordinates());
    writeField(key, "NICOM", subheader.getNumImageComments());

    ::nitf::List list = subheader.getImageComments();
    doComments(key, list);
    
    writeField(key, "IC", subheader.getImageCompression());
    writeField(key, "COMRAT", subheader.getCompressionRate());
    writeField(key, "NBANDS", subheader.getNumImageBands());
    writeField(key, "XBANDS", subheader.getNumMultispectralImageBands());

    doBands(key, subheader);

    writeField(key, "ISYNC", subheader.getImageSyncCode());
    writeField(key, "IMODE", subheader.getImageMode());
    writeField(key, "NBPR", subheader.getNumBlocksPerRow());
    writeField(key, "NBPC", subheader.getNumBlocksPerCol());
    writeField(key, "NPPBH", subheader.getNumPixelsPerHorizBlock());
    writeField(key, "NPPVB", subheader.getNumPixelsPerVertBlock());
    writeField(key, "NBPP", subheader.getNumBitsPerPixel());
    writeField(key, "IDLVL", subheader.getImageDisplayLevel());
    writeField(key, "IALVL", subheader.getImageAttachmentLevel());
    writeField(key, "ILOC", subheader.getImageLocation());
    writeField(key, "IMAG", subheader.getImageMagnification());
}
std::pair<int, int> NITFReadControl::getIndices(nitf::ImageSubheader& subheader)
{

    std::string imageID = subheader.getImageId().toString();
    str::trim(imageID);
    // There is definitely something in here
    std::pair<int, int> imageAndSegment;
    imageAndSegment.first = 0;
    imageAndSegment.second = 0;

    int iid = str::toType<int>(imageID.substr(4, 3));

    /*
     *  Always first = 0, second = N - 1 (where N is numSegments)
     *
     */
    if (mContainer->getDataType() == DataType::COMPLEX)
    {
        // We need to find the SICD data here, and there is
        // only one
        if (iid != 0)
        {
            imageAndSegment.second = iid - 1;
        }
    }
    /*
     *  First is always iid - 1
     *  Second is always str::toType<int>(substr(7)) - 1
     */
    else
    {
        // If its SIDD, we need to check the first three
        // digits within the IID
        imageAndSegment.first = iid - 1;
        imageAndSegment.second = str::toType<int>(imageID.substr(7)) - 1;
    }
    return imageAndSegment;
}