def estCoherence(outfile, corfile): from mroipac.icu.Icu import Icu #Create phase sigma correlation file here filtImage = isceobj.createIntImage() filtImage.load(outfile + '.xml') filtImage.setAccessMode('read') filtImage.createImage() phsigImage = isceobj.createImage() phsigImage.dataType = 'FLOAT' phsigImage.bands = 1 phsigImage.setWidth(filtImage.getWidth()) phsigImage.setFilename(corfile) phsigImage.setAccessMode('write') phsigImage.createImage() icuObj = Icu(name='sentinel_filter_icu') icuObj.configure() icuObj.unwrappingFlag = False icuObj.useAmplitudeFlag = False #icuObj.correlationType = 'NOSLOPE' icuObj.icu(intImage=filtImage, phsigImage=phsigImage) phsigImage.renderHdr() filtImage.finalizeImage() phsigImage.finalizeImage()
def create_phsig(ifg_file, cor_file=None): from mroipac.icu.Icu import Icu logger.info("Estimating spatial coherence based phase sigma") if cor_file is None: ext = os.path.splitext(ifg_file)[1] cor_file = ifg_file.replace(ext, ".cor") logger.info("writing output to %s", cor_file) # Create phase sigma correlation file here intImage = isceobj.createIntImage() intImage.load(ifg_file.replace(".xml", "") + ".xml") intImage.setAccessMode("read") intImage.createImage() phsigImage = isceobj.createImage() phsigImage.dataType = "FLOAT" phsigImage.bands = 1 phsigImage.setWidth(intImage.getWidth()) phsigImage.setFilename(cor_file) phsigImage.setAccessMode("write") phsigImage.createImage() icuObj = Icu(name="filter_icu") icuObj.configure() icuObj.unwrappingFlag = False icuObj.useAmplitudeFlag = False icuObj.icu(intImage=intImage, phsigImage=phsigImage) phsigImage.renderHdr() intImage.finalizeImage() phsigImage.finalizeImage()
def runUnwrapIcu(infile, outfile): from mroipac.icu.Icu import Icu #Setup images #ampImage # ampImage = obj.insar.resampAmpImage.copy(access_mode='read') # width = self.ampImage.getWidth() img = isceobj.createImage() img.load(infile + '.xml') width = img.getWidth() #intImage intImage = isceobj.createIntImage() intImage.initImage(infile, 'read', width) intImage.createImage() #unwImage unwImage = isceobj.Image.createImage() unwImage.setFilename(outfile) unwImage.setWidth(width) unwImage.imageType = 'unw' unwImage.bands = 2 unwImage.scheme = 'BIL' unwImage.dataType = 'FLOAT' unwImage.setAccessMode('write') unwImage.createImage() #unwrap with icu icuObj = Icu() icuObj.filteringFlag = False icuObj.useAmplitudeFlag = False icuObj.singlePatch = True icuObj.initCorrThreshold = 0.1 icuObj.icu(intImage=intImage, unwImage = unwImage) #ampImage.finalizeImage() intImage.finalizeImage() unwImage.finalizeImage() unwImage.renderHdr()
def runUnwrap(self): '''Specific connector from an insarApp object to a Snaphu object.''' wrapName = os.path.join(self._insar.mergedDirname, self._insar.filtFilename) unwrapName = os.path.join(self._insar.mergedDirname, self._insar.unwrappedIntFilename) print(wrapName, unwrapName) #intImage intImage = isceobj.createImage() intImage.load(wrapName + '.xml') intImage.setAccessMode('READ') intImage.createImage() #unwImage unwImage = isceobj.Image.createUnwImage() unwImage.setFilename(unwrapName) unwImage.setWidth(intImage.getWidth()) unwImage.imageType = 'unw' unwImage.bands = 2 unwImage.scheme = 'BIL' unwImage.dataType = 'FLOAT' unwImage.setAccessMode('write') unwImage.createImage() icuObj = Icu(name='topsapp_icu') icuObj.configure() icuObj.useAmplitudeFlag = False icuObj.icu(intImage=intImage, unwImage=unwImage) #At least one can query for the name used self._insar.connectedComponentsFilename = icuObj.conncompFilename intImage.finalizeImage() unwImage.finalizeImage() unwImage.renderHdr()
def runFilter(self): if not self.doInSAR: return logger.info("Applying power-spectral filter") mergedir = self._insar.mergedDirname filterStrength = self.filterStrength # Initialize the flattened interferogram inFilename = os.path.join(mergedir, self._insar.mergedIfgname) intImage = isceobj.createIntImage() intImage.load(inFilename + '.xml') intImage.setAccessMode('read') intImage.createImage() widthInt = intImage.getWidth() # Create the filtered interferogram filtIntFilename = os.path.join(mergedir, self._insar.filtFilename) filtImage = isceobj.createIntImage() filtImage.setFilename(filtIntFilename) filtImage.setWidth(widthInt) filtImage.setAccessMode('write') filtImage.createImage() objFilter = Filter() objFilter.wireInputPort(name='interferogram', object=intImage) objFilter.wireOutputPort(name='filtered interferogram', object=filtImage) objFilter.goldsteinWerner(alpha=filterStrength) intImage.finalizeImage() filtImage.finalizeImage() del filtImage #Create phase sigma correlation file here filtImage = isceobj.createIntImage() filtImage.setFilename(filtIntFilename) filtImage.setWidth(widthInt) filtImage.setAccessMode('read') filtImage.createImage() phsigImage = isceobj.createImage() phsigImage.dataType = 'FLOAT' phsigImage.bands = 1 phsigImage.setWidth(widthInt) phsigImage.setFilename( os.path.join(mergedir, self._insar.coherenceFilename)) phsigImage.setAccessMode('write') phsigImage.setImageType( 'cor' ) #the type in this case is not for mdx.py displaying but for geocoding method phsigImage.createImage() icuObj = Icu(name='topsapp_filter_icu') icuObj.configure() icuObj.unwrappingFlag = False icuObj.useAmplitudeFlag = False icuObj.icu(intImage=filtImage, phsigImage=phsigImage) filtImage.finalizeImage() phsigImage.finalizeImage() phsigImage.renderHdr()