Skip to content

Python 1.5 working doc

dj-snyder edited this page Jun 3, 2015 · 1 revision

|
nitf | index Source Code |

* =========================================================================

  • This file is part of NITRO
  • =========================================================================
  • (C) Copyright 2004 - 2008, General Dynamics - Advanced Information Systems
  • NITRO is free software; you can redistribute it and/or modify
  • it under the terms of the GNU Lesser General Public License as published by
  • the Free Software Foundation; either version 3 of the License, or
  • (at your option) any later version.
  • This program is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU Lesser General Public License for more details.
  • You should have received a copy of the GNU Lesser General Public
  • License along with this program; if not, If not,
  • see <http://www.gnu.org/licenses/>.

*

|
Package Contents |

| _nitropy | nitropy |

|

|
Classes |

[ComponentInfo](nitf.html#ComponentInfo)
[DataSource](nitf.html#DataSource)

    BandSource
        FileBandSource
        MemoryBandSource

[DownSampler](nitf.html#DownSampler)
[MaxDownSampler](nitf.html#MaxDownSampler)
[PixelSkipDownSampler](nitf.html#PixelSkipDownSampler)
[Extensions](nitf.html#Extensions)
[Field](nitf.html#Field)
[FieldHeader](nitf.html#FieldHeader)
[FileSecurity](nitf.html#FileSecurity)
[Header](nitf.html#Header)
[DESubheader](nitf.html#DESubheader)
[FileHeader](nitf.html#FileHeader)
[GraphicSubheader](nitf.html#GraphicSubheader)
[ImageSubheader](nitf.html#ImageSubheader)
[LabelSubheader](nitf.html#LabelSubheader)
[RESubheader](nitf.html#RESubheader)
[TextSubheader](nitf.html#TextSubheader)
[IOHandle](nitf.html#IOHandle)
[ImageReader](nitf.html#ImageReader)
[ImageSource](nitf.html#ImageSource)
[ImageWriter](nitf.html#ImageWriter)
[PluginRegistry](nitf.html#PluginRegistry)
[Reader](nitf.html#Reader)
[Record](nitf.html#Record)
[RecordSegment](nitf.html#RecordSegment)
[DESegment](nitf.html#DESegment)
[GraphicSegment](nitf.html#GraphicSegment)
[ImageSegment](nitf.html#ImageSegment)
[LabelSegment](nitf.html#LabelSegment)
[RESegment](nitf.html#RESegment)
[TextSegment](nitf.html#TextSegment)
[SegmentReader](nitf.html#SegmentReader)
[SegmentSource](nitf.html#SegmentSource)
[FileSegmentSource](nitf.html#FileSegmentSource)
[MemorySegmentSource](nitf.html#MemorySegmentSource)
[SegmentWriter](nitf.html#SegmentWriter)
[SubWindow](nitf.html#SubWindow)
[TRE](nitf.html#TRE)
[Writer](nitf.html#Writer)

|
class BandSource(DataSource) | Base BandSource class | Methods defined here:

**__del__**(self)
**__init__**(self, ref)

Methods inherited from DataSource:

**read**(self, size)

|

|
class ComponentInfo | Methods defined here:

**__init__**(self, ref)
**__str__**(self)
**getDataLength**(self)
**getHeaderLength**(self)

|

|
class DESegment(RecordSegment) | #NITF DESegment class | Methods defined here:

**__init__**(self, ref)

Methods inherited from RecordSegment:

**__getitem__**(self, key)
Forward to the SubHeader
**__str__**(self)
Forward to the SubHeader

|

|
class DESubheader(Header) | #NITF DESubheader class |

Method resolution order:
[DESubheader](nitf.html#DESubheader)
[Header](nitf.html#Header)
[FieldHeader](nitf.html#FieldHeader)

Methods inherited from Header:

**__init__**(self, ref, field_list=None)
**__iter__**(self)

Methods inherited from FieldHeader:

**__contains__**(self, key)
**__getitem__**(self, key)
Provide container get
**__setitem__**(self, key, value)
Provide the container 'set' functionality
**__str__**(self)

|

|
class DataSource | Base DataSource class | Methods defined here:

**__del__**(self)
**__init__**(self, ref)
**read**(self, size)

|

|
class DownSampler | Base DownSampler class | Methods defined here:

**__del__**(self)
**__init__**(self, ref)

|

|
class Extensions | TRE Extensions | Methods defined here:

**__call__**(self)
**__getitem__**(self, key)
**__init__**(self, ref)
**__iter__**(self)
**__len__**(self)
**append**(self, tre)
appends the given [TRE](#TRE) to this [Extensions](#Extensions) object
**removeTREsByName**(self, tag)
removes all TREs with the given name

|

|
class Field | #NITF Field object | Methods defined here:

**__init__**(self, ref)
**__int__**(self)
**__str__**(self)
**getLength**(self)
**getString**(self)
**intValue**(self)
**setString**(self, data)

|

|
class FieldHeader | Base class for any Header that has fields

This provides list-based get access to the fields

e.g.

numImages = header['numImages'] | Methods defined here:

**__contains__**(self, key)
**__getitem__**(self, key)
Provide container get
**__init__**(self, ref, field_list=None)
**__iter__**(self)
**__setitem__**(self, key, value)
Provide the container 'set' functionality
**__str__**(self)

|

|
class FileBandSource(BandSource) | BandSource derived from an IOHandle |

Method resolution order:
[FileBandSource](nitf.html#FileBandSource)
[BandSource](nitf.html#BandSource)
[DataSource](nitf.html#DataSource)

Methods defined here:

**__init__**(self, handle, start=0, nbpp=1, pixelskip=0)

Methods inherited from BandSource:

**__del__**(self)

Methods inherited from DataSource:

**read**(self, size)

|

|
class FileHeader(Header) | The FileHeader class

Besides having list-based access to its fields, this class also provides list-based access to its componentInfos.

Supported keys are (case-insensitive): imageInfo, graphicInfo, textInfo, labelInfo, dataExtensionInfo, reservedExtensionInfo

e.g.

infoList = header['imageinfo'] #print the first component info object print infoList[0] |

Method resolution order:
[FileHeader](nitf.html#FileHeader)
[Header](nitf.html#Header)
[FieldHeader](nitf.html#FieldHeader)

Methods defined here:

**__getitem__**(self, key)
**__init__**(self, ref)
**__iter__**(self)
**getComponentInfo**(self, type, index)
**getComponentInfos**(self, type)
**getUDHD**(self)
**getXHD**(self)

Methods inherited from FieldHeader:

**__contains__**(self, key)
**__setitem__**(self, key, value)
Provide the container 'set' functionality
**__str__**(self)

|

|
class FileSecurity(FieldHeader) | #NITF FileSecurity class | Methods defined here:

**__iter__**(self)

Methods inherited from FieldHeader:

**__contains__**(self, key)
**__getitem__**(self, key)
Provide container get
**__init__**(self, ref, field_list=None)
**__setitem__**(self, key, value)
Provide the container 'set' functionality
**__str__**(self)

|

|
class FileSegmentSource(SegmentSource) | SegmentSource derived from an IOHandle | Methods defined here:

**__init__**(self, handle, start=0, byteSkip=0)

Methods inherited from SegmentSource:

**__del__**(self)

|

|
class GraphicSegment(RecordSegment) | #NITF GraphicSegment class | Methods defined here:

**__init__**(self, ref)

Methods inherited from RecordSegment:

**__getitem__**(self, key)
Forward to the SubHeader
**__str__**(self)
Forward to the SubHeader

|

|
class GraphicSubheader(Header) | #NITF GraphicSubheader class |

Method resolution order:
[GraphicSubheader](nitf.html#GraphicSubheader)
[Header](nitf.html#Header)
[FieldHeader](nitf.html#FieldHeader)

Methods defined here:

**getXHD**(self)

Methods inherited from Header:

**__init__**(self, ref, field_list=None)
**__iter__**(self)

Methods inherited from FieldHeader:

**__contains__**(self, key)
**__getitem__**(self, key)
Provide container get
**__setitem__**(self, key, value)
Provide the container 'set' functionality
**__str__**(self)

|

|
class Header(FieldHeader) | #base class for actual NITF headers | Methods defined here:

**__init__**(self, ref, field_list=None)
**__iter__**(self)

Methods inherited from FieldHeader:

**__contains__**(self, key)
**__getitem__**(self, key)
Provide container get
**__setitem__**(self, key, value)
Provide the container 'set' functionality
**__str__**(self)

|

|
class IOHandle | The IOHandle class. | Methods defined here:

**__del__**(self)
#close the handle
**__init__**(self, filename, accessFlags=1, createFlags=13)
**close**(self)
**write**(self, data, size=-1)

Data and other attributes defined here:

|

|
class ImageReader | The ImageReader object

This is created by calling Reader.newImageReader() | Methods defined here:

**__del__**(self)
**__init__**(self, ref, nbpp)
**read**(self, window, downsampler=None)

|

|
class ImageSegment(RecordSegment) | #NITF ImageSegment class | Methods defined here:

**__init__**(self, ref)
**addBands**(self, num=1)
adds the specified number of bands to the image

Methods inherited from RecordSegment:

**__getitem__**(self, key)
Forward to the SubHeader
**__str__**(self)
Forward to the SubHeader

|

|
class ImageSource | Methods defined here:

**__call__**(self)
**__del__**(self)
**__init__**(self)
**__iter__**(self)
**addBand**(self, band)
**getBand**(self, index)

|

|
class ImageSubheader(Header) | #NITF ImageSubheader class |

Method resolution order:
[ImageSubheader](nitf.html#ImageSubheader)
[Header](nitf.html#Header)
[FieldHeader](nitf.html#FieldHeader)

Methods defined here:

**__init__**(self, ref)
**__iter__**(self)
**getBandCount**(self)
**getComments**(self)
**getUDHD**(self)
**getXHD**(self)
**insertComment**(self, comment, index=-1)
Inserts a comment. By default, adds it to the end
**removeComment**(self, index)
Removes the comment at the specified index. If index is out of bounds, nothing is done

Methods inherited from FieldHeader:

**__contains__**(self, key)
**__getitem__**(self, key)
Provide container get
**__setitem__**(self, key, value)
Provide the container 'set' functionality
**__str__**(self)

|

|
class ImageWriter | Methods defined here:

**__del__**(self)
**__init__**(self, ref)
**attachSource**(self, imagesource)

|

|
class LabelSegment(RecordSegment) | #NITF LabelSegment class | Methods defined here:

**__init__**(self, ref)

Methods inherited from RecordSegment:

**__getitem__**(self, key)
Forward to the SubHeader
**__str__**(self)
Forward to the SubHeader

|

|
class LabelSubheader(Header) | #NITF LabelSubheader class |

Method resolution order:
[LabelSubheader](nitf.html#LabelSubheader)
[Header](nitf.html#Header)
[FieldHeader](nitf.html#FieldHeader)

Methods inherited from Header:

**__init__**(self, ref, field_list=None)
**__iter__**(self)

Methods inherited from FieldHeader:

**__contains__**(self, key)
**__getitem__**(self, key)
Provide container get
**__setitem__**(self, key, value)
Provide the container 'set' functionality
**__str__**(self)

|

|
class MaxDownSampler(DownSampler) | Max DownSampler class | Methods defined here:

**__init__**(self, rowSkip=1, colSkip=1)
Default row and column skips are 1, meaning no downsampling

Methods inherited from DownSampler:

**__del__**(self)

|

|
class MemoryBandSource(BandSource) | BandSource derived from memory |

Method resolution order:
[MemoryBandSource](nitf.html#MemoryBandSource)
[BandSource](nitf.html#BandSource)
[DataSource](nitf.html#DataSource)

Methods defined here:

**__init__**(self, data, size=-1, start=0, nbpp=1, pixelskip=0)

Methods inherited from BandSource:

**__del__**(self)

Methods inherited from DataSource:

**read**(self, size)

|

|
class MemorySegmentSource(SegmentSource) | SegmentSource derived from memory | Methods defined here:

**__init__**(self, data, size=-1, start=0, byteSkip=0)

Methods inherited from SegmentSource:

**__del__**(self)

|

|
class PixelSkipDownSampler(DownSampler) | PixelSkip DownSampler class | Methods defined here:

**__init__**(self, rowSkip=1, colSkip=1)
Default row and column skips are 1, meaning no downsampling

Methods inherited from DownSampler:

**__del__**(self)

|

|
class PluginRegistry | Methods defined here:

**__init__**(self)
**canHandleTRE**(self, tre_name)

Static methods defined here:

**instance**()
**loadDir**(dirname)
Loads any plugins in the given directory

|

|
class RESegment(RecordSegment) | #NITF RESegment class | Methods defined here:

**__init__**(self, ref)

Methods inherited from RecordSegment:

**__getitem__**(self, key)
Forward to the SubHeader
**__str__**(self)
Forward to the SubHeader

|

|
class RESubheader(Header) | #NITF RESubheader class |

Method resolution order:
[RESubheader](nitf.html#RESubheader)
[Header](nitf.html#Header)
[FieldHeader](nitf.html#FieldHeader)

Methods inherited from Header:

**__init__**(self, ref, field_list=None)
**__iter__**(self)

Methods inherited from FieldHeader:

**__contains__**(self, key)
**__getitem__**(self, key)
Provide container get
**__setitem__**(self, key, value)
Provide the container 'set' functionality
**__str__**(self)

|

|
class Reader | The Reader class.

Construct a Reader if you need to read a NITF | Methods defined here:

**__del__**(self)
**__init__**(self)
**newGraphicReader**(self, num)
**newImageReader**(self, num)
**read**(self, handle)

|

|
class Record | The Record class.

The NITF Record is the top-level container of the NITF contents. This object contains all of the sub-components of the NITF. | Methods defined here:

**__del__**(self)
**__init__**(self, ref=None, version=101)
**getDataExtensions**(self)
**getGraphics**(self)
**getImages**(self)
**getLabels**(self)
**getReservedExtensions**(self)
**getTexts**(self)
**newGraphicSegment**(self)
Creates a new graphic segment, and updates the numGraphics value
**newImageSegment**(self)
Creates a new image segment, and updates the numImages value

|

|
class RecordSegment | Abstract class for Segments Not intended to be instantiated itself | Methods defined here:

**__getitem__**(self, key)
Forward to the SubHeader
**__init__**(self, ref)
**__str__**(self)
Forward to the SubHeader

|

|
class SegmentReader | The SegmentReader object | Methods defined here:

**__del__**(self)
**__init__**(self, ref)
**getSize**(self)
**read**(self, size)
**tell**(self)

|

|
class SegmentSource | Base SegmentSource class | Methods defined here:

**__del__**(self)
**__init__**(self, ref)

|

|
class SegmentWriter | Methods defined here:

**__del__**(self)
**__init__**(self, ref)
**attachSource**(self, source)

|

|
class SubWindow | The SubWindow class

This is used to specify a subwindow into the image | Methods defined here:

**__init__**(self, image_subheader=None)
**__str__**(self)

|

|
class TRE | Tagged Record Extension | Methods defined here:

**__contains__**(self, field)
**__getitem__**(self, field)
**__init__**(self, ref, size=0)
Create either a new [TRE](#TRE) or refer to an existing underlying [TRE](#TRE) The ref parameter is checked
**__iter__**(self)
**__str__**(self)
**getLength**(self)
**getTag**(self)

Data and other attributes defined here:

|

|
class TextSegment(RecordSegment) | #NITF TextSegment class | Methods defined here:

**__init__**(self, ref)

Methods inherited from RecordSegment:

**__getitem__**(self, key)
Forward to the SubHeader
**__str__**(self)
Forward to the SubHeader

|

|
class TextSubheader(Header) | #NITF TextSubheader class |

Method resolution order:
[TextSubheader](nitf.html#TextSubheader)
[Header](nitf.html#Header)
[FieldHeader](nitf.html#FieldHeader)

Methods defined here:

**__iter__**(self)
**getXHD**(self)

Methods inherited from Header:

**__init__**(self, ref, field_list=None)

Methods inherited from FieldHeader:

**__contains__**(self, key)
**__getitem__**(self, key)
Provide container get
**__setitem__**(self, key, value)
Provide the container 'set' functionality
**__str__**(self)

|

|
class Writer | Methods defined here:

**__del__**(self)
**__init__**(self)
**newGraphicWriter**(self, num)
**newImageWriter**(self, imagenum)
**prepare**(self, record, handle)
**write**(self)

|

|

|
Data | FILE_HEADER_FIELDS = [{'id': 'FHDR', 'name': 'fileHeader'}, {'id': 'FVER', 'name': 'fileVersion'}, {'id': 'CLEVEL', 'name': 'complianceLevel'}, {'id': 'STYPE', 'name': 'systemType'}, {'id': 'OSTAID', 'name': 'originStationID'}, {'id': 'FDT', 'name': 'fileDateTime'}, {'id': 'FTITLE', 'name': 'fileTitle'}, {'id': 'FSCLAS', 'name': 'classification'}, {'id': 'FSCOP', 'name': 'messageCopyNum'}, {'id': 'FSCPYS', 'name': 'messageNumCopies'}, {'id': 'ENCRYP', 'name': 'encrypted'}, {'id': 'FBKGC', 'name': 'backgroundColor'}, {'id': 'ONAME', 'name': 'originatorName'}, {'id': 'OPHONE', 'name': 'originatorPhone'}, {'id': 'FL', 'name': 'fileLength'}, {'id': 'HL', 'name': 'headerLength'}, {'id': 'NUMI', 'name': 'numImages'}, {'id': 'NUMS', 'name': 'numGraphics'}, {'id': 'NUMX', 'name': 'numLabels'}, {'id': 'NUMT', 'name': 'numTexts'}, ...] IMAGE_SUBHEADER_FIELDS = [{'id': 'IM', 'name': 'filePartType'}, {'id': 'IID1', 'name': 'imageId'}, {'id': 'IDATIM', 'name': 'imageDateAndTime'}, {'id': 'TGTID', 'name': 'targetId'}, {'id': 'IID2', 'name': 'imageTitle'}, {'id': 'ISCLAS', 'name': 'imageSecurityClass'}, {'id': 'ISORCE', 'name': 'imageSource'}, {'id': 'NROWS', 'name': 'numRows'}, {'id': 'NCOLS', 'name': 'numCols'}, {'id': 'PVTYPE', 'name': 'pixelValueType'}, {'id': 'IREP', 'name': 'imageRepresentation'}, {'id': 'ICAT', 'name': 'imageCategory'}, {'id': 'ABPP', 'name': 'actualBitsPerPixel'}, {'id': 'PJUST', 'name': 'pixelJustification'}, {'id': 'ICORDS', 'name': 'imageCoordinateSystem'}, {'id': 'IGEOLO', 'name': 'cornerCoordinates'}, {'id': 'NICOM', 'name': 'numImageComments'}, {'id': 'IC', 'name': 'imageCompression'}, {'id': 'COMRAT', 'name': 'compressionRate'}, {'id': 'NBANDS', 'name': 'numImageBands'}, ...] NITF_VER_20 = 100 NITF_VER_21 = 101 NITF_VER_UNKNOWN = 102 |

Clone this wiki locally