Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
bcdarwin committed Oct 25, 2016
2 parents ea6251a + 2a68afd commit cfe58aa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
New in Version 0.1.17
=====================
* fix bug in TFCE implementation
* fix linking on OS X

New in Version 0.1.16
=====================
* fix compilation against static HDF5 libs
Expand Down
2 changes: 1 addition & 1 deletion m4/smr_WITH_BUILD_PATH.m4
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AC_DEFUN([smr_WITH_BUILD_PATH],
for d in `echo $withval | tr : ' '`; do
test -d $d || AC_MSG_ERROR([build path $d not found.])
test -d $d/include && CPPFLAGS="$CPPFLAGS -I$d/include"
test -d $d/lib && LDFLAGS="$LDFLAGS -L$d/lib"
test -d $d/lib && LDFLAGS="$LDFLAGS -L$d/lib -Wl,-rpath,$d/lib"
done
])
])
14 changes: 9 additions & 5 deletions python/TFCE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from numpy import *
import operator


def tfce(invol, outvol, dh=0.1, E=0.5, H=2.0):
def tfce(invol, outvol, dh=0.1, E=0.5, H=2.0, negative = False):
#infile = "1.mnc"
#out = "1-tfce.mnc"

Expand Down Expand Up @@ -43,7 +43,11 @@ def tfce(invol, outvol, dh=0.1, E=0.5, H=2.0):
if (labeled(x,y,z) > 0) {
int e = labeled(x,y,z);
//std::cout << data(x,y,z) << " " << h << " " << sizes(e) << std::endl;
data(x,y,z) = data(x,y,z) + (pow(h, H) * pow(sizes(e), E) * dh);
if(negative == 1){
data(x,y,z) = data(x,y,z) - (pow(h, H) * pow(sizes(e), E) * dh);
} else {
data(x,y,z) = data(x,y,z) + (pow(h, H) * pow(sizes(e), E) * dh);
}
//data(x,y,z) = n;
}}}}
"""
Expand All @@ -52,7 +56,7 @@ def tfce(invol, outvol, dh=0.1, E=0.5, H=2.0):
labeled = l[0]

weave.inline(code, ['data', 'nx', 'ny', 'nz', 'labeled', 'h',
'H', 'E', 'sizes', 'dh'],
'H', 'E', 'sizes', 'dh', 'negative'],
type_converters=weave.converters.blitz,
compiler='gcc')

Expand Down Expand Up @@ -101,8 +105,8 @@ Smith and Nichols. Threshold-free cluster enhancement: addressing problems of sm
tfce(invol, outvol, options.dh, options.E, options.H)
if options.pos_and_neg == "both" or options.pos_and_neg == "neg":
invol.data = invol.data * -1
tfce(invol, outvol, options.dh, options.E, options.H)
tfce(invol, outvol, options.dh, options.E, options.H, negative = True)

outvol.writeFile()
outvol.closeVolume()


2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys

setup(name="python-stuffs",
version='0.1.16',
version='0.1.17',
scripts=["python/TFCE",
"python/smooth_vector",
"python/measure_xcorr",
Expand Down

0 comments on commit cfe58aa

Please sign in to comment.