debian/0000755000000000000000000000000012171732463007174 5ustar debian/changelog0000644000000000000000000000075412170065511011044 0ustar snaphu (1.4.2-2) unstable; urgency=low * Updated homapage URL and watch file * Use canonical URLs for VCS fields in the control file * Fixed copyright format URL * Fixed a typo in the short package description (Closes: #716792) -- Antonio Valentino Mon, 08 Apr 2013 20:45:57 +0200 snaphu (1.4.2-1) unstable; urgency=low * Initial release (Closes: #606882) -- Antonio Valentino Thu, 27 Dec 2012 10:45:54 +0000 debian/compat0000644000000000000000000000000212170065511010362 0ustar 9 debian/control0000644000000000000000000000424612170065511010575 0ustar Source: snaphu Section: non-free/science Priority: optional Maintainer: Debian GIS Project Uploaders: Antonio Valentino Build-Depends: debhelper (>= 9.0.0) Standards-Version: 3.9.4 Homepage: http://www.stanford.edu/group/radar/softwareandlinks/sw/snaphu/ Vcs-Git: git://anonscm.debian.org/pkg-grass/snaphu.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-grass/snaphu.git Package: snaphu Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: Statistical-Cost, Network-Flow Algorithm for 2D Phase Unwrapping Two-dimensional phase unwrapping is the process of recovering unambiguous phase data from a 2-D array of phase values known only modulo 2pi rad. . There are many applications, like Magnetic Resonance Imaging (MRI), Synthetic Aperture Radar (SAR), fringe pattern analysis, tomography and spectroscopy, which as part of their fundamental operation depend upon the extraction of a phase signal from their input image. Usually the phase is available in a form that suffers from 2-pi phase jumps due to the use of the mathematical arctangent function, which produces an inherently wrapped output. This wrapped phase is unusable until the phase discontinuities are removed. . SNAPHU is an implementation of the Statistical-cost, Network-flow Algorithm for Phase Unwrapping particularly suitable for SAR interferometry applications. This algorithm poses phase unwrapping as a maximum a posteriori probability (MAP) estimation problem, the objective of which is to compute the most likely unwrapped solution given the observable input data. Because the statistics relating the input data to the solution depend on the measured quantity, SNAPHU incorporates three built-in statistical models, for topography data, deformation data, and smooth generic data. The posed optimization problem is solved approximately with use of network-flow techniques. . As SNAPHU uses an iterative optimization procedure, its execution time depends on the difficulty of the interferogram. In single-tile mode the required memory is on the order of 100 MB per 1,000,000 pixels in the input interferogram. debian/copyright0000644000000000000000000000755712170065511011135 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: snaphu Source: http://www-star.stanford.edu/sar_group/snaphu Files: * Copyright: 2002 Board of Trustees, Leland Stanford Jr. University License: Except as noted below, permission to use, copy, modify, and distribute, this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the copyright holders be used in advertising or publicity pertaining to distribution of the software with specific, written prior permission, and that no fee is charged for further distribution of this software, or any modifications thereof. The copyright holder makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. . THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA, PROFITS, QPA OR GPA, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - The parts of this software derived from the CS2 minimum cost flow solver written by A. V. Goldberg and B. Cherkassky are governed by the terms of the copyright holder of that software. Permission has been granted to use and distrubute that software for strictly noncommercial purposes as part of this package, provided that the following copyright notice from the original distribution and URL accompany the software: . COPYRIGHT C 1995 IG Systems, Inc. Permission to use for evaluation purposes is granted provided that proper acknowledgments are given. For a commercial licence, contact igsys@eclipse.net. . This software comes with NO WARRANTY, expressed or implied. By way of example, but not limitation, we make no representations of warranties of merchantability or fitness for any particular purpose or that the use of the software components or documentation will not infringe any patents, copyrights, trademarks, or other rights. . http://www.igsystems.com/cs2 Files: src/snaphu_cs2* Copyright: 1995 IG Systems, Inc License: Permission to use for evaluation purposes is granted provided that proper acknowledgments are given. For a commercial licence, contact igsys@eclipse.net. . This software comes with NO WARRANTY, expressed or implied. By way of example, but not limitation, we make no representations of warranties of merchantability or fitness for any particular purpose or that the use of the software components or documentation will not infringe any patents, copyrights, trademarks, or other rights. . http://www.igsystems.com/cs2 Files: debian/* Copyright: 2010-2011 Antonio Valentino License: GPL-3+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . On Debian systems, the complete text of the GNU General Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". debian/dirs0000644000000000000000000000003312170065511010044 0ustar usr/bin usr/share/man/man1 debian/doc-base0000644000000000000000000000040612170065511010564 0ustar Document: snaphu Title: SNAPHU Man Page Author: Curtis W. Chen Abstract: This document describes SNAPHU command line tool usage Section: Science/Geoscience Format: HTML Index: /usr/share/doc/snaphu/snaphu_man1.html Files: /usr/share/doc/snaphu/snaphu_man1.html debian/docs0000644000000000000000000000006012170065511010033 0ustar README man/snaphu_man1.txt man/snaphu_man1.html debian/examples0000644000000000000000000000001112170065511010715 0ustar config/* debian/patches/0000755000000000000000000000000012170065511010613 5ustar debian/patches/fix-compilation-warnings.patch0000644000000000000000000001145612170065511016573 0ustar Fix a few compilation warning and also prevent a segfault when logging is enabled. --- a/src/snaphu_cost.c +++ b/src/snaphu_cost.c @@ -40,11 +40,11 @@ outfileT *outfiles){ long row, col, maxcol, tempcost; - long poscost, negcost, costtypesize; + long poscost, negcost, costtypesize=0; float **pwr, **corr; - short **weights, **rowweight, **colweight, **scalarcosts; - void **costs, **rowcost, **colcost; - void (*CalcStatCost)(); + short **weights, **rowweight, **colweight, **scalarcosts=NULL; + void **costs, **rowcost=NULL, **colcost=NULL; + void (*CalcStatCost)()=NULL; /* read weights */ weights=NULL; --- a/src/snaphu_io.c +++ b/src/snaphu_io.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include --- a/src/snaphu_util.c +++ b/src/snaphu_util.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include --- a/src/snaphu_solver.c +++ b/src/snaphu_solver.c @@ -53,7 +53,7 @@ candidateT *candidatelist, *candidatebag, *tempcandidateptr; nodeT *from, *to, *cycleapex, *node1, *node2, *leavingparent, *leavingchild; nodeT *root, *mntpt, *oldmntpt, *skipthread, *tempnode1, *tempnode2; - nodeT *firstfromnode, *firsttonode; + nodeT *firstfromnode=NULL, *firsttonode=NULL; nodeT **apexlist; float **unwrappedphase; @@ -2203,7 +2203,7 @@ signed char **residue, signed char **arcstatus, nodeT **nodes, nodeT *ground, long nrow, long ncol){ - long row, col, todir, arcrow, arccol, arcdir; + long row, col=0, todir=0, arcrow, arccol, arcdir; long arcnum, upperarcnum, ngroundarcs; nodeT *from, *to, *nextnode; nodesuppT **nodesupp; --- a/src/snaphu_tile.c +++ b/src/snaphu_tile.c @@ -172,9 +172,9 @@ long i, row, col, maxcol; long arcrow, arccol, arcnum, fromdist, arcdist; long regioncounter, *regionsizes, regionsizeslen, *thisregionsize; - long closestregiondist, closestregion, lastfromdist; + long closestregiondist, closestregion=0, lastfromdist; long costthresh, minsize, maxcost; - short **regions; + short **regions=NULL; nodeT **nodes; nodeT *source, *from, *to, *ground; char regionfile[MAXSTRLEN]; @@ -887,8 +887,8 @@ long nlines, long linelen){ long tilerow, tilecol, ntilerow, ntilecol, ntiles, rowovrlp, colovrlp; - long i, j, k, ni, nj, dummylong, costtypesize; - long nrow, ncol, prevnrow, prevncol, nextnrow, nextncol; + long i, j, k, ni, nj, dummylong, costtypesize=0; + long nrow, ncol, prevnrow=0, prevncol, nextnrow, nextncol; long n, ncycle, nflowdone, nflow, candidatelistsize, candidatebagsize; long nnodes, maxnflowcycles, arclen, narcs, sourcetilenum, flowmax; long *totarclens; @@ -1195,7 +1195,7 @@ void ***nextcostsptr, long *nextnrowptr, long *nextncolptr){ - long nexttilelinelen, nexttilenlines, costtypesize; + long nexttilelinelen, nexttilenlines, costtypesize=0; tileparamT nexttileparams[1]; outfileT nexttileoutfiles[1]; char nextfile[MAXSTRLEN], tempstring[MAXTMPSTRLEN]; @@ -1315,7 +1315,7 @@ float *unwphaseabove, float *unwphasebelow, void *costsabove, void *costsbelow){ - long ni, nj, readtilelinelen, readtilenlines, costtypesize; + long ni, nj, readtilelinelen, readtilenlines, costtypesize=0; long ntilerow, ntilecol, rowovrlp, colovrlp; tileparamT tileparams[1]; outfileT outfilesabove[1], outfilesbelow[1]; @@ -1487,7 +1487,7 @@ short *nscndryarcs, long *totarclens, short **bulkoffsets, paramT *params){ - long i, j, row, col, nnrow, nncol, tilenum, costtypesize; + long i, j, row, col, nnrow, nncol, tilenum, costtypesize=0; long nnewnodes, nnewarcs, npathsout, flowmax, totarclen; long nupdatednontilenodes, updatednontilenodesize, ntilecol; short **flows; @@ -2383,7 +2383,7 @@ long mincost, mincostflow; long *scndrycostarr; long double templongdouble; - double sigsq, sumsigsqinv, tempdouble, tileedgearcweight; + double sigsq=0, sumsigsqinv, tempdouble, tileedgearcweight; short **flows; void **costs; nodeT *tempnode, *primarytail, *scndrytail, *scndryhead; @@ -2922,7 +2922,7 @@ FILE *outfp; float **unwphase, **tileunwphase, **mag, **tilemag; float *outline; - long row, col, colstart, nrow, ncol, nnrow, nncol, maxcol; + long row, col, colstart, nrow=0, ncol, nnrow, nncol, maxcol; long readtilelinelen, readtilenlines, nextcoloffset, nextrowoffset; long tilerow, tilecol, ntilerow, ntilecol, rowovrlp, colovrlp; long ni, nj, tilenum; --- a/src/snaphu_cs2.c +++ b/src/snaphu_cs2.c @@ -637,6 +637,7 @@ i_price, /* price of node i */ dp; /* current arc partial residual cost */ +a_max = NULL; p_max = price_min; i_price = i -> price; debian/patches/hardening.patch0000644000000000000000000000117112170065511013573 0ustar CFLAGS setup has been modified to extent the settings of the external environment. CPPFLAGS and LDFLAGS are now used during the build phase. --- a/src/Makefile +++ b/src/Makefile @@ -13,8 +13,8 @@ # If you specify -D NO_CS2, the program will be compiled without the # CS2 MCF solver module. -CC = cc -CFLAGS = -O3 # -D NO_CS2 +#CC = cc +CFLAGS += -O3 # -D NO_CS2 LIBS = -lm BINDIR = ../bin INSTALLDIR = /usr/local/bin @@ -32,7 +32,7 @@ all: $(SNAPHU) $(SNAPHU): snaphu.c $(OBJS) snaphu.h Makefile - $(CC) $(CFLAGS) \ + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ snaphu.c \ $(OBJS) \ -o $(SNAPHU) \ debian/patches/man-page-hyphens.patch0000644000000000000000000000561712170065511015006 0ustar Escape hyphens in the manpage. --- a/man/man1/snaphu.1 +++ b/man/man1/snaphu.1 @@ -348,15 +348,15 @@ .fi Unwrap the same file as above, but use brightness information from the -file ``ampfile,'' set the perpendicular baseline to -165 m at +file ``ampfile,'' set the perpendicular baseline to \-165 m at midswath, and place the output in a file called ``unwrappedfile'' (coherence data are generated automatically if ``wrappedfile'' contains complex data and ``ampfile'' contains amplitude data from both SAR images): .nf - snaphu wrappedfile 1024 -a ampfile \\\ - -b -165 -o unwrappedfile + snaphu wrappedfile 1024 \-a ampfile \\\ + \-b \-165 \-o unwrappedfile .fi Unwrap the interferogram as above, but read correlation @@ -364,8 +364,8 @@ the interferogram and amplitude data: .nf - snaphu wrappedfile 1024 -a ampfile -c corrfile \\\ - -b -165 -o unwrappedfile + snaphu wrappedfile 1024 \-a ampfile \-c corrfile \\\ + \-b \-165 \-o unwrappedfile .fi The following is equivalent to the previous example, but input @@ -377,25 +377,25 @@ # This is a comment line which will be ignored AMPFILE ampfile CORRFILE corrfile - BPERP -165 + BPERP \-165 OUTFILE unwrappedfile - snaphu -v -f configfile wrappedfile 1024 + snaphu \-v \-f configfile wrappedfile 1024 .fi Unwrap the same interferogram, but use only the MST initialization (with scalar statistical weights) and write the output to ``mstfile'': .nf - snaphu -f configfile -i wrappedfile 1024 -o mstfile + snaphu \-f configfile \-i wrappedfile 1024 \-o mstfile .fi Read the unwrapped data in ``mstfile'' and use that as the initialization to the modified network-simplex solver: .nf - snaphu -f configfile -u mstfile 1024 -o unwrappedfile + snaphu \-f configfile \-u mstfile 1024 \-o unwrappedfile .fi Note that in the previous two examples, the output file name in the @@ -408,7 +408,7 @@ initialization: .nf - snaphu -f configfile wrappedfile 1024 --mcf + snaphu \-f configfile wrappedfile 1024 \--mcf .fi Unwrap the interferogram once again, but first flatten it with the @@ -416,7 +416,7 @@ after unwrapping: .nf - snaphu -f configfile wrappedfile 1024 -e estfile + snaphu \-f configfile wrappedfile 1024 \-e estfile .fi The following assumes that the wrapped input interferogram measures @@ -424,14 +424,14 @@ correlation data: .nf - snaphu -d wrappedfile 1024 -c corrfile + snaphu \-d wrappedfile 1024 \-c corrfile .fi Unwrap the input interferogram by minimizing the unweighted congruent L2 norm: .nf - snaphu -p 2 -n wrappedfile 1024 + snaphu \-p 2 \-n wrappedfile 1024 .fi Unwrap the interferogram as a three-by-four set of tiles that overlap @@ -439,8 +439,8 @@ processors: .nf - snaphu wrappedfile 1024 -f configfile \\\ - --tile 3 4 30 30 --nproc 2 + snaphu wrappedfile 1024 \-f configfile \\\ + \--tile 3 4 30 30 \--nproc 2 .fi .SH "HINTS AND TIPS" debian/patches/series0000644000000000000000000000010612170065511012025 0ustar fix-compilation-warnings.patch man-page-hyphens.patch hardening.patch debian/rules0000755000000000000000000000104112170065511010240 0ustar #!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 DH_OPTIONS=--sourcedirectory=src %: dh $@ override_dh_auto_build: mkdir -p bin dh_auto_build --sourcedirectory=src override_dh_auto_install: dh_auto_install --sourcedirectory=src -- INSTALLDIR=../debian/snaphu/usr/bin/ MANDIR=../debian/snaphu/usr/share/man override_dh_auto_clean: dh_auto_clean --sourcedirectory=src $(MAKE) -C src clobber rm -rf bin .PHONY: override_dh_auto_build override_dh_auto_install override_dh_auto_clean debian/source/0000755000000000000000000000000012170065511010464 5ustar debian/source/format0000644000000000000000000000001412170065511011672 0ustar 3.0 (quilt) debian/watch0000644000000000000000000000021412170065511010212 0ustar # Compulsory line, this is a version 3 file version=3 http://www.stanford.edu/group/radar/softwareandlinks/sw/snaphu/snaphu-v(.*)\.tar\.gz