-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Medical-Image-Analysis-Laboratory/FaBiANv2…
….0-dev ENH: implement local white matter heterogeneities
- Loading branch information
Showing
44 changed files
with
5,221 additions
and
1,440 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% Function that redefines the position of the slice slab that covers % | ||
% the fetal brain volume based on the shift that is applied in the % | ||
% slice thickness direction between the acquisition of two % | ||
% low-resolution series in the same orientation (as it is done in % | ||
% clinical routine in the case of two successive series acquired in the % | ||
% same plane). % | ||
% % | ||
% Fetal_Brain_shift = FOV_shift(Fetal_Brain, shift, orientation); % | ||
% % | ||
% inputs: - Fetal_Brain: segmented high-resolution 3D volume of the % | ||
% fetal brain % | ||
% - shift: displacement (in voxels) of the slice slab in the % | ||
% slice thickness direction % | ||
% - orientation: strict acquisition plane (axial, coronal or % | ||
% sagittal) % | ||
% % | ||
% output: - Fetal_Brain_shift: segmented high-resolution 3D volume of % | ||
% the fetal brain after a shift in the % | ||
% slice thickness direction % | ||
% % | ||
% % | ||
% Hélène Lajous, 2021-08-23 % | ||
% [email protected] % | ||
% % | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
|
||
function Fetal_Brain_shift = FOV_shift(Fetal_Brain, ... | ||
shift, ... | ||
orientation) | ||
|
||
% Input check | ||
if nargin < 3 | ||
error('Missing input(s).'); | ||
elseif nargin > 3 | ||
error('Too many inputs.'); | ||
end | ||
|
||
% Resize the fetal brain volume to allow shifting in any direction | ||
Fetal_Brain_FOV = {1+ceil(abs(shift)):size(Fetal_Brain,1)-ceil(abs(shift)); 1+ceil(abs(shift)):size(Fetal_Brain,2)-ceil(abs(shift)); 1+ceil(abs(shift)):size(Fetal_Brain,3)-ceil(abs(shift))}; | ||
|
||
% Slightly shift the slice slab in the slice thickness direction (as done | ||
% in the clinics) | ||
Fetal_Brain_FOV{orientation} = Fetal_Brain_FOV{orientation} + shift; | ||
|
||
% Mask the fetal brain after having shifted the slice slab | ||
Fetal_Brain_shift = Fetal_Brain(Fetal_Brain_FOV{1}, Fetal_Brain_FOV{2}, Fetal_Brain_FOV{3}); | ||
|
||
% Display message for debugging | ||
sprintf('The fetal brain volume has been shifted by %d voxels in the slice thickness direction.', shift) | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
% Function that redefines the position of the slice slab that covers % | ||
% the fetal brain volume based on the shift that is applied in the % | ||
% slice thickness direction between the acquisition of two % | ||
% low-resolution series in the same orientation (as it is done in % | ||
% clinical routine in the case of two successive series acquired in the % | ||
% same plane). % | ||
% % | ||
% Fetal_Brain_shift = FOV_shift(Fetal_Brain, shift, orientation); % | ||
% % | ||
% inputs: - Fetal_Brain: segmented high-resolution 3D volume of the % | ||
% fetal brain % | ||
% - shift: displacement (in voxels) of the slice slab in the % | ||
% slice thickness direction % | ||
% - orientation: strict acquisition plane (axial, coronal or % | ||
% sagittal) % | ||
% % | ||
% output: - Fetal_Brain_shift: segmented high-resolution 3D volume of % | ||
% the fetal brain after a shift in the % | ||
% slice thickness direction % | ||
% % | ||
% % | ||
% Hélène Lajous, 2021-08-23 % | ||
% [email protected] % | ||
% % | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
||
|
||
function Fetal_Brain_shift = FOV_shift(Fetal_Brain, ... | ||
shift, ... | ||
orientation) | ||
|
||
% Input check | ||
if nargin < 3 | ||
error('Missing input(s).'); | ||
elseif nargin > 3 | ||
error('Too many inputs.'); | ||
end | ||
|
||
% Resize the fetal brain volume to allow shifting in any direction | ||
Fetal_Brain_FOV = {1+ceil(abs(shift)):size(Fetal_Brain,1)-ceil(abs(shift)); 1+ceil(abs(shift)):size(Fetal_Brain,2)-ceil(abs(shift)); 1+ceil(abs(shift)):size(Fetal_Brain,3)-ceil(abs(shift))}; | ||
|
||
% Slightly shift the slice slab in the slice thickness direction (as done | ||
% in the clinics) | ||
Fetal_Brain_FOV{orientation} = Fetal_Brain_FOV{orientation} + shift; | ||
|
||
% Mask the fetal brain after having shifted the slice slab | ||
Fetal_Brain_shift = Fetal_Brain(Fetal_Brain_FOV{1}, Fetal_Brain_FOV{2}, Fetal_Brain_FOV{3}); | ||
|
||
% Display message for debugging | ||
sprintf('The fetal brain volume has been shifted by %d voxels in the slice thickness direction.', shift) | ||
|
||
end |
Oops, something went wrong.