FW: [Tcl-nap-users] index
Brought to you by:
dav480,
peter_turner
From: <Har...@cs...> - 2006-05-05 00:16:19
|
-----Original Message----- From: Davies, Harvey (CMAR, Aspendale)=20 Sent: Thursday, 4 May 2006 10:33 To: 'salah jubeh' Subject: RE: [Tcl-nap-users] index =20 -----Original Message----- From: tcl...@li... [mailto:tcl...@li...] On Behalf Of salah jubeh Sent: Wednesday, 3 May 2006 17:47 To: NAP Subject: [Tcl-nap-users] index =20 Hi all =20 i would like to ask how can i use indeces to calculate statistical function for the whole image like mean , percentile , mode ... =20 For example I tried to calulate the max value for an aray extarcted from an hdf file i do that on two steps =20 nap "result=3D [nap_get hdf $img_src [nap_get hdf -list $img_src {^[^:]*$}]]"; =20 nap "min1 =3D [nap "min(min(result))"]" nap "max1 =3D [nap "max(max(result))"]" =20 [>>>] The simplest and most general method is to reshape the array to a vector as in the following: [>>>] nap "vector =3D reshape(result)" [>>>] [nap "min(vector)"] [>>>] [nap "max(vector)"] [>>>]=20 [>>>] For simple reduction functions (e.g. max()) you can avoid creating another array by looping as follows: [>>>] nap "max1 =3D result" [>>>] while {[$max1 rank] > 0} { [>>>] nap "max1 =3D max(max1)" [>>>] } |