1.cpxfiddle使用说明:
输入复数数据转为标准输出,输入可以为强度,相位,实部或者虚部。输出可以多视,裁剪,镜像,比例处理等。
函数说明:
-w 线段长度(宽度,方位向像元数,x方向)
-e [1.0] 指数: 输出=比例*输出^指数
-s [1.0] 比例: 输出 = 比例 * 输出 ^ 指数
-l [1] 第一(方位向azimuth Y)line
-L [all] 最后(方位向azimuth Y)line
-p [1] 第一(距离向range X)pixel
-P [all] 最后(距离向range X)pixel
-M [1/1] 多视指数在X/Y方向(range/azuimth)
-S [1/1] 裁剪指数在X/Y方向(range/azuimth)
-q [mag] 输出:
NORMAL | MAG | PHASE | MIXED | REAL | IMAG
normal = (real,imag)
magnitude = sqrt(real^ 2 + imag^2)
phase = atan2(imag,real)
mixd = phase overlay, only with -o sunraster
real = line [2*j],
imag = line [2*j +1]
-f [cr4] Input format identifier:
CC1 | CUC1 | CI2 | CI4 | CR4 | CR8
for complex 2x1B char, unsigned char,
short integer, integer, float, double
(major row order pixel interleaved complex data.)
-o [ascii] Output format identifier (to stdout):
UCHAR | SUNRASTER | FLOAT | SHORT | ASCII
uchar, short, sunraster, and float options
write binary to stdout!
-c [gray] Colormap for "-o sunraster" option.
FILENAME | GRAY | JET | HOT | COOL | BERT | HSV
If cmap is a filename, then a ascii file with
256 lines, containing r g b [0:255] is assumed.
If cmap is a identifier, this colormap is used.
-m code Flag to mirror file content in X or Y direction:
X | Y | XY | YX
If mirroring Y then the first output line is
line number P (default last in file). This means
that if -Y is specified, the last line not
necessarely is line -l (firstline default 1)
The same is true for mirroring in X direction.
-r [rmin/rmax] uses given minimum and maximum range on data as scalling parameters.
Basically, it skips data sampling step for statistics (min,max,mean) computation
and defines (min,max,mean) values from given parameters.
It only effects magnitude, normal and mixed mode outputs.
For example, use it to scale coherence maps to 0-1 range.
Tip: no need to use --ignorenan when you are using -r option.
--ignorenan ignores nan values during calculation of min, max and mean for scaling of sunraster outputs.
It only effects magnitude, normal and mixed mode output types.
Additionally, when binary output is done for magnitude images 0 is set instead of nan values.
--fullstat compute min, max and mean evaluating every pixel for scaling of sunraster outputs.
-B b|s Swap bytes.
if -Bs then swap to host order.
(call ntohs or ntohl, thus swapping from big endian
to host type, which is small endian for X86 PC's.)
if -Bb then swap to network order.
(call htons or htonl, thus swapping to big endian
from host type, which is small endian for X86 PC's.)
On a big endian platform both these functions are
defined as NULL macros, and do nothing.
-b Add a scalebar in lower right corner for -o sunraster
Only for -q phase and mixed.
-H bytes Skip Header bytes, e.g., for GENESIS SUNraster floats.
-V Verbose.
-h[elp] This help.
2.函数自带案例:
Check first few values in complex short file (width 100, height 200):
cpxfiddle -w100 -fci2 -qnormal -oascii -L5 -P3 -V -- cpxfile
To generate a grd file for use with GMT, without creating a large
tmpfile, use something like:
cpxfiddle -w100 -fci2 -qphase -ofloat -- cpxfile | \
xyz2grd -Gfile.grd -R1/100/1/200 -Zf
To crop a binary complex float file of width 781 and height 501:
(redirect, or your screen will be flooded with binary output!)
cpxfiddle -w781 -fcr4 -qnormal -ofloat -l101 -L200 \
-p51 -P750 cpxfile > cpxfile.cropped
To convert the phase of the same file to SUNraster format:
cpxfiddle -w781 -fcr4 -qphase -osunraster \
-ccmap.rainbow -- cpxfile > phase.ras
display phase.ras
Where the colortable file is generated by (using GMT):
makecpt -Crainbow -T0/256/1 | \
awk '{if (NR>3&&NR<260){print $2, $3, $4}}' > cmap.rainbow
To create a sort of 8 bit pixmap, visualize with ImageMagick's
display as gray format:
cpxfiddle -qphase -fcr4 -ouchar -w1 -- cpxfile > phase.uc
display -size 781x501 gray:phase.uc
The file phase.uc could also be converted to another format, e.g.:
rawtopgm 781 501 phase.uc > phase.pgm
xv phase.pgm
But easier would have been to use cpxfiddle to generate the
SUNraster file. This can be done by:
cpxfiddle -w100 -qmag -osunraster -e0.3 -s1.1 file.cr4 > file.ras
Where file.cr4 is complex real4, -e is used to equalize the
histogram, and -s to threshold the data (larger scale means
more white). To overlay the phase as layer over the magnitude:
cpxfiddle -w100 -qmixed -osunraster -e0.3 -- file.cr4 > file.ras
xv file.ras
To read the header of a (non complex!) sunraster file
(8 int32 values):
cpxfiddle -w1 -L4 -qnormal -fci4 -- file.ras
This program can be tricked to crop float files (non complex)
This program can be used for conversions of files, trick with -w1
To crop a bigendian file on a linux PC, swap and crop like:
cpxfiddle -w100 -fci2 -qnormal -oshort -Bs -- cpxfile > newfile
To read the content of a (non complex!) float vector with 32 byte header
cpxfiddle -w1 -qnormal -fr4 -H32 -oascii -- file.ras
To scale the content of a float file: coherence map to [ 0 1 ] range.
cpxfiddle -w 1000 -q normal -o sunraster -b -c gray -f r4 cohmap.r4 -r 0,1 > cohmap.ras
BUGS:
-M with -m: First mirrored then multilooked.
-B: Not tested properly, but simply calls functions.
all: If cpxfile is a symbolic link, filesize cannot be
determined, and therefor the number of lines.
Solution: Use the full path or use a hard link.
(lot of options, binary to screen, but these are features.)
SEE ALSO:
cpx2ps, display, rawtopgm, makecpt (GMT)
Please send your comments to: TUDelft, doris_users@tudelft.nl
(BTW: view this help by piping stderr: cpxfiddle -h |& more in csh
or cpxfiddle -h 2>&1 | less in bash.)
3. 实例:
1. 画相关性图
cpxfiddle -w 5000 -q normal -o sunraster -b -c gray -M 2/2 -r 0.0/1.0 -f r4 -l1 -p1 -P5000 ccoherence.raw > ccoherence.ras
2. 画高度图
cpxfiddle -w 5000 -q normal -o sunraster -b -c jet -M 2/2 -f r4 -l1 -p1 -P5000 dem_radar.raw > comprefdem_height.ras
3. 画相位图
cpxfiddle -w 5000 -q normal -o sunraster -b -c jet -M 2/2 -f r4 -l1 -p1 -P5000 refdem.raw > comprefdem_phase.ras
或者
cpxfiddle -w 5000 -q phase -o sunraster -b -c jet -M 2/2 -f cr4 -l1 -p1 -P5000 cint.0.5 filtered > interferogram_filt_pha.ras
4. 画强度图
cpxfiddle -w 5000 -e 0.3 -s 1.0 -q mag -o sunraster -b -c gray -M 2/2 -f cr4 -l1 -p1 -P5000 cint.0.5filtered > interferogram_filt_mag.ras
5. 画强度和相位混合图
cpxfiddle -w 5000 -e 0.3 -s 1.2 -q mixed -o sunraster -b -c hsv -M 2/2 -f cr4 -l1 -p1 -P5000 cint.0.5filtered > interferogram_filt_mix.ras