def computeCoherence(slc1name, slc2name, corname, virtual=True): slc1 = isceobj.createImage() slc1.load(slc1name + '.xml') slc1.createImage() slc2 = isceobj.createImage() slc2.load(slc2name + '.xml') slc2.createImage() cohImage = isceobj.createOffsetImage() cohImage.setFilename(corname) cohImage.setWidth(slc1.getWidth()) cohImage.setAccessMode('write') cohImage.createImage() cor = Correlation() cor.configure() cor.wireInputPort(name='slc1', object=slc1) cor.wireInputPort(name='slc2', object=slc2) cor.wireOutputPort(name='correlation', object=cohImage) cor.coregisteredSlcFlag = True cor.calculateCorrelation() cohImage.finalizeImage() slc1.finalizeImage() slc2.finalizeImage() return
def runCoherence(self, method="phase_gradient"): logger.info("Calculating Coherence") # Initialize the amplitude # resampAmpImage = self.insar.resampAmpImage # ampImage = isceobj.createAmpImage() # IU.copyAttributes(resampAmpImage, ampImage) # ampImage.setAccessMode('read') # ampImage.createImage() # ampImage = self.insar.getResampOnlyAmp().copy(access_mode='read') ampImage = isceobj.createImage() ampImage.load(self.insar.getResampOnlyAmp().filename + '.xml') ampImage.setAccessMode('READ') ampImage.createImage() # Initialize the flattened inteferogram topoflatIntFilename = self.insar.topophaseFlatFilename intImage = isceobj.createImage() intImage.load(self.insar.topophaseFlatFilename + '.xml') intImage.setAccessMode('READ') intImage.createImage() # widthInt = self.insar.resampIntImage.getWidth() # intImage.setFilename(topoflatIntFilename) # intImage.setWidth(widthInt) # intImage.setAccessMode('read') # intImage.createImage() # Create the coherence image cohFilename = topoflatIntFilename.replace('.flat', '.cor') cohImage = isceobj.createOffsetImage() cohImage.setFilename(cohFilename) cohImage.setWidth(intImage.width) cohImage.setAccessMode('write') cohImage.createImage() cor = Correlation() cor.configure() cor.wireInputPort(name='interferogram', object=intImage) cor.wireInputPort(name='amplitude', object=ampImage) cor.wireOutputPort(name='correlation', object=cohImage) cohImage.finalizeImage() intImage.finalizeImage() ampImage.finalizeImage() cor.calculateCorrelation() # try: # CORRELATION_METHOD[method](cor) # except KeyError: # print("Unrecognized correlation method") # sys.exit(1) # pass return None
def runCoherence(self, method="phase_gradient"): logger.info("Calculating Coherence") import os resampAmpImage = os.path.join(self.insar.ifgDirname, self.insar.ifgFilename) topoflatIntFilename = os.path.join(self.insar.ifgDirname, self.insar.ifgFilename) if '.flat' in resampAmpImage: resampAmpImage = resampAmpImage.replace('.flat', '.amp') elif '.int' in resampAmpImage: resampAmpImage = resampAmpImage.replace('.int', '.amp') else: resampAmpImage += '.amp' # Initialize the amplitude # resampAmpImage = self.insar.resampAmpImage # ampImage = isceobj.createAmpImage() # IU.copyAttributes(resampAmpImage, ampImage) # ampImage.setAccessMode('read') # ampImage.createImage() # ampImage = self.insar.getResampOnlyAmp().copy(access_mode='read') ampImage = isceobj.createImage() ampImage.load(resampAmpImage + '.xml') ampImage.setAccessMode('READ') ampImage.createImage() # Initialize the flattened inteferogram # topoflatIntFilename = self.insar.topophaseFlatFilename intImage = isceobj.createImage() intImage.load(topoflatIntFilename + '.xml') intImage.setAccessMode('READ') intImage.createImage() # widthInt = self.insar.resampIntImage.getWidth() # intImage.setFilename(topoflatIntFilename) # intImage.setWidth(widthInt) # intImage.setAccessMode('read') # intImage.createImage() # Create the coherence image cohFilename = topoflatIntFilename.replace('.flat', '.cor') cohImage = isceobj.createOffsetImage() cohImage.setFilename(cohFilename) cohImage.setWidth(intImage.width) cohImage.setAccessMode('write') cohImage.createImage() cor = Correlation() cor.configure() cor.wireInputPort(name='interferogram', object=intImage) cor.wireInputPort(name='amplitude', object=ampImage) cor.wireOutputPort(name='correlation', object=cohImage) cohImage.finalizeImage() intImage.finalizeImage() ampImage.finalizeImage() cor.calculateCorrelation() # NEW COMMANDS added by YL --start import subprocess subprocess.getoutput( 'MULTILOOK_FILTER_ISCE.py -a ./interferogram/topophase.amp -c ./interferogram/topophase.cor' ) subprocess.getoutput( 'CROP_ISCE_stripmapApp.py -a ./interferogram/topophase.amp -c ./interferogram/topophase.cor' ) subprocess.getoutput( 'imageMath.py -e="a_0;a_1" --a ./interferogram/topophase.amp -o ./interferogram/resampOnlyImage1.amp -s BIL -t FLOAT' ) self.geocode_list += ['./interferogram/resampOnlyImage1.amp'] # NEW COMMANDS added by YL --end # try: # CORRELATION_METHOD[method](cor) # except KeyError: # print("Unrecognized correlation method") # sys.exit(1) # pass return None