Skip to content

Commit

Permalink
Merge pull request #18 from samuelstjean/fix_memmap_bug
Browse files Browse the repository at this point in the history
fix the numpy memmap keepdim bug
  • Loading branch information
samuelstjean committed Apr 26, 2016
2 parents 4f52aee + 165ea51 commit 3c6abb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Changelog

## [0.2.1] - 2016-04-26

- Fixed a bug in the nlsam script where .nii would be memmaped and crash with an invalid dimension broadcast. Thansk to Jelle Veraart for reporting.

## [0.2] - 2016-04-19

- stabilization script is now clipping values to zero (Bai et al. 2014) as used in the paper.
The previous release was using the Koay et al. 2009 approach, which could produce negative values in really noisy cases.

- More doc to the readme.
- Added link to the synthetic and in vivo data used in the experiments.
- Linux binaries now needs glibc >= 2.13 (Debian 7 and newer) instead of glibc >= 2.21 (Ubuntu 15.04 and newer).
<!--- - Linux binaries now needs glibc >= 2.13 (Debian 7 and newer) instead of glibc >= 2.21 (Ubuntu 15.04 and newer). (debina is giving me trouble, might be jessie from now on or centos)-->
- Removed the source archive and wheel files, as one can grab the source archive from github instead.

## [0.1] - 2016-03-22
Expand Down
24 changes: 2 additions & 22 deletions scripts/nlsam
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,15 @@ def main():
print("Now denoising " + os.path.realpath(args.input))

vol = nib.load(args.input)
data = vol.get_data()
data = np.array(vol.get_data())
vol.uncache()
affine = vol.get_affine()

sigma = nib.load(args.sigma).get_data()**2

greedy_subsampler = True
implausible_signal_boost = True
b0_thresh = 10
n_iter = args.iterations

original_dtype = data.dtype
Expand Down Expand Up @@ -127,29 +128,8 @@ def main():
if data.shape[:-1] != mask.shape:
raise ValueError('data shape is {}, but mask shape {} is different!'.format(data.shape, mask.shape))



crop=False
if crop:
print("cropping data and mask")
ca = 51#20#80#23
cb = 56#170#170#150#86#27#data.shape[1]
# [90:, 88:96, 40:] [90:140, 90:160, 38:46]
# isbi : [:,22:28, :]
#mask_data=np.ones_like(data[...,0],dtype=np.bool)
data = data[:, ca:cb]#[40:129,40:129,...]#[90:150, :165, ...] #88:96, 40:]
original_shape = data.shape[:-1] + (original_shape[-1],)
# data_orig = data_orig[:, ca:cb]#[40:129,40:129,...]#[90:150, :165, ...]#88:96, 40:]
# mask_noise = mask_noise[:, ca:cb]#[40:129,40:129,...]#[90:150, :165, ...]#88:96, 40:]
mask = mask[:, ca:cb]#[40:129,40:129,...]#[90:150, :165, ...]#88:96, 40:]
# gold_standard = gold_standard[:, ca:cb]#[40:129,40:129,...]#[90:150, :165, ...]#88:96, 40:]
sigma = sigma[:, ca:cb]



bvals, bvecs = read_bvals_bvecs(args.bvals, args.bvecs)

b0_thresh = 10
b0_loc = tuple(np.where(bvals <= b0_thresh)[0])
num_b0s = len(b0_loc)

Expand Down

0 comments on commit 3c6abb0

Please sign in to comment.