def __init__(self, handle, start=0, byteSkip=0): self.error = Error() self.handle = handle #must set this so it doesn't get ref-counted away SegmentSource.__init__( self, nitropy.nitf_SegmentFileSource_construct(handle.ref, start, byteSkip, self.error))
def __init__(self): if PluginRegistry.__instance: self = PluginRegistry.__instance else: PluginRegistry.__instance = self PluginRegistry.__instance.error = Error() PluginRegistry.__instance.ref = nitropy.nitf_PluginRegistry_getInstance(PluginRegistry.__instance.error)
def __init__(self, handle, start=0, nbpp=1, pixelskip=0): self.error = Error() self.handle = handle #must set this so it doesn't get ref-counted away BandSource.__init__( self, nitropy.nitf_FileSource_construct(handle.ref, start, nbpp, pixelskip, self.error))
def __init__(self, ref=None, version=NITF_VER_21): self.error = Error() if ref is not None: self.ref = ref else: self.ref = nitropy.nitf_Record_construct(version, self.error) self.header = FileHeader(self.ref.header)
def _get_listof(self, type): type = type.lower() if type == 'image' or type == 'images': type = 'Image' elif type == 'graphic' or type == 'graphics': type = 'Graphic' elif type == 'text' or type == 'texts': type = 'Text' elif type == 'label' or type == 'labels': type = 'Label' elif type == 'dataextension' or type == 'dataextensions' \ or type == 'de' or type == 'des': type = 'DE' elif type == 'reservedextension' or type == 'reservedextensions' \ or type == 're' or type == 'res': type = 'RE' else: return None arr = [] error = Error() num = eval('nitropy.py_Record_getNum%ss(self.ref)' % type) for i in range(num): arr.append( eval('%sSegment( \ nitropy.py_Record_get%s(self.ref, i, error))' % (type, type))) #could use frozenset to be immutable list... return tuple(arr)
def __init__(self): self.error = Error() self.ref = nitropy.nitf_Writer_construct(self.error) if not self.ref: raise Exception('Unable to create Writer') self._imageWriters, self._graphicWriters = [], [] self.io = None
def __init__(self, data, size=-1, start=0, nbpp=1, pixelskip=0): self.error = Error() if size == -1: size = len(data) BandSource.__init__( self, nitropy.nitf_MemorySource_construct(data, size, start, nbpp, pixelskip, self.error))
def __init__(self, rowSkip = 1, colSkip = 1): """ Default row and column skips are 1, meaning no downsampling """ self.rowSkip = rowSkip self.colSkip = colSkip self.error = Error() DownSampler.__init__(self, nitropy.nitf_MaxDownSample_construct(rowSkip, colSkip, self.error))
def __init__(self, filename, accessFlags=ACCESS_READONLY, createFlags=OPEN_EXISTING): self.filename = filename self.error = Error() self.ref = nitropy.py_IOHandle_create( filename, accessFlags, createFlags, self.error) if self.ref < 0: raise Exception, 'Unable to open IOHandle at location %s' % filename self.open = True
def __init__(self, data, size=-1, start=0, byteSkip=0): self.error = Error() if size == -1: size = len(data) SegmentSource.__init__( self, nitropy.nitf_SegmentMemorySource_construct(data, size, start, byteSkip, self.error))
def __init__(self, ref): """ Create either a new TRE or refer to an existing underlying TRE The ref parameter is checked """ self.error = Error() if not ref or isinstance(ref, str): tag = ref ref = nitropy.nitf_TRE_construct(tag, None, self.error) if not ref: raise Exception('Unable to create TRE with tag \'%s\'' % tag) self.ref = ref
def __init__(self, ref, field_list=None): self.ref = ref self.error = Error() self.fieldMap = {} #set up the map of fields for func in dir(ref): name = str(func) obj = ref.__getattribute__(name) #check if it is a Field if isinstance(obj, nitropy.nitf_Field): self.fieldMap[name.lower()] = 'self.ref.%s' % name if field_list: for field in field_list: self.fieldMap[field['id'].lower()] = 'self.ref.%s' % field['name']
def getComponentInfo(self, type, index): error = Error() return ComponentInfo( nitropy.py_FileHeader_getComponentInfo(self.ref, index, str(type).lower(), error))
def intValue(self): error = Error() return nitropy.py_Field_getInt(self.ref, error)
def setString(self, data): error = Error() retval = nitropy.nitf_Field_setString(self.ref, str(data), error)
def getString(self): error = Error() return nitropy.py_Field_getString(self.ref, error)
def __init__(self, ref): self.ref = ref self.error = Error() self.subheader = None
def __init__(self): self.error = Error() self.ref = nitropy.nitf_Reader_construct(self.error) self.io, self.record = None, None
def __init__(self, ref): self.ref = ref self.error = Error()
def __init__(self, ref, nbpp): self.ref = ref self.error = Error() self.nbpp = nbpp
def loadDir(dirname): """ Loads any plugins in the given directory """ error = Error() if not nitropy.nitf_PluginRegistry_loadDir(dirname, error): raise Exception('Unable to load the directory: %s (error=%s)' % (dirname, error.message))
def __init__(self, ref): self.ref = ref if not hasattr(self, 'error'): self.error = Error()
def __init__(self): self.error = Error() self.ref = nitropy.nitf_ImageSource_construct(self.error) self._attached = []