Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code to clip out-of-dwi fiber coordinates #93

Merged
merged 1 commit into from
Dec 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions life/fe/feConnectomeEncoding.m
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@

% Compute voxels
voxel_coord = round(fibers) + 1;

% Clip coordinates to within imgsize
voxel_coord(voxel_coord<1)=1;
voxel_coord(1, voxel_coord(1,:)>imgsize(1))=imgsize(1);
voxel_coord(2, voxel_coord(2,:)>imgsize(2))=imgsize(2);
voxel_coord(3, voxel_coord(3,:)>imgsize(3))=imgsize(3);

cols = sub2ind(imgsize, voxel_coord(1,:)', voxel_coord(2,:)', voxel_coord(3,:)');

% Compute atoms
Expand Down
9 changes: 9 additions & 0 deletions life/fe/feConnectomeSetDwi.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
dwiGet(dwi, 'diffusion bvals'));
fe = feSet(fe, sprintf('bvecs indices %s',tag), ...
dwiGet(dwi, 'diffusionimagenums'));


dim = dwi.nifti.dim;
coords = fe.roi.coords;
coords(coords<1)=1;
coords(coords(:,1)>dim(1), 1)=dim(1);
coords(coords(:,2)>dim(2), 2)=dim(2);
coords(coords(:,3)>dim(3), 3)=dim(3);
fe.roi.coords = coords;

% Extract the dwi signal at the coordinates of the connectome
fe = feSet(fe, sprintf('diffusion signal image %s',tag), ...
Expand Down
1 change: 0 additions & 1 deletion life/utility/fefgGet.m
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@
% matrix of integers.
% val = round(horzcat(fg.fibers{:})');
val = round(horzcat(fg.fibers{:})')+1;
val(val<1)=1;
val = unique(val,'rows');

case {'allimagecoords'}
Expand Down