Proposed changes to UnwrapComp CMakeLists.txt, unwrapComponents.py and relaxIVdriver.cpp (#324)

* Updated CMakeLists.txt

* Update relaxIVdriver.cpp

* Update unwrapComponents.py

* Fix the paths on lines 445 and 446

* Fixed paths on lines 445 and 446
LT1AB
Bryan Marfito 2021-09-01 07:36:17 +08:00 committed by GitHub
parent b961aa3635
commit ad244f07b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 87 additions and 9 deletions

View File

@ -1,7 +1,20 @@
# TODO check for RelaxIV
InstallSameDir(
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/RelaxIV)
Python_add_library(unwcomp MODULE
bindings/unwcompmodule.cpp
src/RelaxIV/RelaxIV.C
src/relaxIVdriver.cpp
)
target_include_directories(unwcomp PUBLIC include)
InstallSameDir(
__init__.py
phaseUnwrap.py
unwrapComponents.py
unwcomp
)
else()
InstallSameDir(
__init__.py
phaseUnwrap.py
unwrapComponents.py
)
endif()

View File

@ -2,7 +2,7 @@
#include <sstream>
#include <RelaxIV.h>
#include <relaxIVdriver.h>
#include <MCFClass.h>
using namespace MCFClass_di_unipi_it;
@ -13,7 +13,72 @@ inline T ABS( const T x )
}
using namespace std;
extern void SetParam( MCFClass *mcf );
//extern void SetParam( MCFClass *mcf );
template<class T>
static inline void str2val( const char* const str , T &sthg )
{
istringstream( str ) >> sthg;
}
/*--------------------------------------------------------------------------*/
// This function skips comment line in a input stream, where comment line is
// // marked by an initial '#' character
//
void SkipComments( ifstream &iParam , string &buf )
{
do {
iParam >> ws;
getline( iParam , buf );
}
while( buf[ 0 ] == '#' );
}
void SetParam( MCFClass *mcf )
{
ifstream iParam( "config.txt" );
if( ! iParam.is_open() )
return;
string buf;
int num;
SkipComments( iParam , buf );
str2val( buf.c_str(), num ); // get number of int parameters
for( int i = 0 ; i < num ; i++ ) { // read all int parameters
int param , val;
SkipComments( iParam , buf );
str2val( buf.c_str(), param ); // parameter name
SkipComments( iParam , buf );
str2val( buf.c_str(), val ); // parameter value
mcf->SetPar( param , val );
} // end( for( i ) )
SkipComments( iParam , buf );
str2val( buf.c_str() , num ); // get number of double parameters
for( int i = 0 ; i < num ; i++ ) { // read all double parameters
int param;
double val;
SkipComments( iParam , buf );
str2val( buf.c_str(), param ); // parameter name
SkipComments( iParam , buf );
str2val( buf.c_str() , val ); // parameter value
mcf->SetPar( param , val );
} // end( for( i ) )
} // end( SetParam )
vector<int> driver(char *fileName)
{
ifstream iFile(fileName);
@ -30,7 +95,7 @@ vector<int> driver(char *fileName)
// load the network - - - - - - - - - - - - - - - - - - - - - - - - - - - -
cout << "Loading Network :" << fileName << endl;
cout << "Loading Network: " << fileName << endl;
mcf->LoadDMX( iFile );
// set "reasonable" values for the epsilons, if any - - - - - - - - - - - -

View File

@ -327,7 +327,7 @@ band names = {{component (Band 1) }}
dst_ds.SetGeoTransform( self.cc_ds.GetGeoTransform() )
dst_ds.SetProjection( self.cc_ds.GetProjectionRef() )
dstband = dst_ds.GetRasterBand(1)
print('Estimating neighbors of component : %d'%(compNumber))
print('Estimating neighbors of component: %d'%(compNumber))
gdal.ComputeProximity(self.ccband, dstband, options, callback = gdal.TermProgress)
width = self.cc_ds.RasterXSize
@ -442,6 +442,6 @@ if __name__ == "__main__":
import isceobj
unw = UnwrapComponents()
unw.setInpFile('/Users/subrahma/proj/isce/data/filt_topophase.unw.xml')
unw.setConnCompFile('/Users/subrahma/proj/isce/data/filt_topophase.unw.conncomp.xml')
unw.setInpFile(inpFile)
unw.setConnCompFile(ccFile)
unw.unwrapComponents()