def init(self, imgIn, nameOut, **kwargs): if isinstance(nameOut, str): #create generic image self._imgOut = Image() width = imgIn.getWidth() accessmode = 'write' bands = imgIn.getBands() scheme = imgIn.getInterleavedScheme() typec = imgIn.getDataType() #For now extract one band at the time. Might extend to do #multiple bands band = 1 #create output image of the same type as input self._imgOut.initImage(nameOut, accessmode, width, typec, band, scheme) self._imgOut.createImage() #if created here then need to finalize at the end self._outCreatedHere = True elif (nameOut, Image): self._imgOut = nameOut else: print( "Error. The second argument of BandExtractor.init() must be a string or an Image object" ) raise TypeError imgIn.createImage( ) # just in case has not been run before. if it was run then it does not have any effect accessorIn = imgIn.getImagePointer() accessorOut = self._imgOut.getImagePointer() FL.init(self._filter, accessorIn, accessorOut)
def init(self, imgIn, nameOut, **kwargs): """Method to pass the input and output image to the filter""" # check if the output image nameOut is provided. If it is a string create the image here using # the input image as template if isinstance(nameOut, str): #create generic image self._imgOut = Image() width = imgIn.getWidth() accessmode = 'write' bands = imgIn.getBands() scheme = imgIn.getInterleavedScheme() typec = imgIn.getDataType() #The assumption is that the imgIn is complex. The single component is the imgIn data type without the C # for instace CREAL becomes REAL typeF = typec[1:] #create output image of the same type as input self._imgOut.initImage(nameOut, accessmode, width, typeF, bands, scheme) self._imgOut.createImage() #if created here then need to finalize at the end self._outCreatedHere = True elif (nameOut, Image): self._imgOut = nameOut else: print( "Error. The second argument of ComplexExtractor.init() must be a string or an Image object" ) raise TypeError imgIn.createImage( ) # just in case has not been run before. if it was run then it does not have any effect accessorIn = imgIn.getImagePointer() accessorOut = self._imgOut.getImagePointer() FL.init(self._filter, accessorIn, accessorOut)
def __init__(self,typeExtractor,band): Filter.__init__(self) self.logger = logging.getLogger('isce.isceobj.ImageFilter.BandExtractor') #get the filter C++ object pointer self._filter = FL.createFilter(typeExtractor,band) self._outCreatedHere = False self._imgOut = None
def __init__(self, typeExtractor, fromWhat): """Initialize the filter passing what is extracted and from what type of complex image""" Filter.__init__(self) self.logger = logging.getLogger( 'isce.isceobj.ImageFilter.ComplexExtractor') #possible inputs #(MagnitudeExctractor,'cartesian') #(MagnitudeExctractor,'polar') #(PhaseExctractor,'cartesian') #(PhaseExctractor,'polar') #(RealExctractor,'cartesian') #(ImagExctractor,'cartesian') #(RealExctractor,'polar') #(ImagExctractor,'polar') #get the filter C++ object pointer calling the Filtermodule.cpp which calls the FilterFactory.cpp self._filter = FL.createFilter(typeExtractor, fromWhat) self._outCreatedHere = False self._imgOut = None
def setEndLine(self, line): """Set the line where extraction should end""" FL.setEndLine(self._filter, line)
def setStartLine(self, line): """Set the line where extraction should start""" FL.setStartLine(self._filter, line)
def selectBand(self, band): """Select a specified band from the Image""" FL.selectBand(self._filter, band)
def extract(self): """Perform the data extraction""" FL.extract(self._filter)
def finalize(self): """Call to the bindings finalize. Subclass can extend it but needs to call the baseclass one""" FL.finalize(self._filter)