Skip to content

Commit

Permalink
Renaming scripts
Browse files Browse the repository at this point in the history
Inner modifications to integrate renaming in the implementation, function
names, help section, etc...

Hopefully complete!
  • Loading branch information
EvelyneBalteau committed May 4, 2017
1 parent 6dc8bbf commit e009049
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 53 deletions.
4 changes: 2 additions & 2 deletions hmri_create_B1Map_process.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function [allub1_img] = hmri_B1Map_process(ub1_img,ustd_img,vdm_img,fpm_img,b1map_params)
function [allub1_img] = hmri_create_B1Map_process(ub1_img,ustd_img,vdm_img,fpm_img,b1map_params)
%==========================================================================
% PURPOSE
% To mask, pad and smooth the unwrapped B1 map.
% Part of the hMRI toolbox, B1+ map calculation, EPI SE/STE protocol.
%
% FORMAT [allub1_img] = hmri_B1Map_process(ub1_img,ustd_img,vdm_img,fpm_img,b1map_params)
% FORMAT [allub1_img] = hmri_create_B1Map_process(ub1_img,ustd_img,vdm_img,fpm_img,b1map_params)
% INPUT ARGUMENTS (all filenames are 1-element cell arrays)
% - ub1_img filename of the unwrapped B1 map
% - ustd_img filename of the unwrapped SD (error) image
Expand Down
6 changes: 3 additions & 3 deletions hmri_create_B1Map_unwarp.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function [fmap_img,unwarp_img] = hmri_B1Map_unwarp(fmfnam, anatfnam, otherfnam, b1map_params)
function [fmap_img,unwarp_img] = hmri_create_B1Map_unwarp(fmfnam, anatfnam, otherfnam, b1map_params)
%==========================================================================
% PURPOSE
% For B0 undistortion of EPI-based B1 maps, part of the hMRI toolbox.
%
% FORMAT [fmap_img,unwarp_img] = hmri_B1Map_unwarp(magfnam, phasefnam, anatfnam, otherfnam, b1map_params)
% FORMAT [fmap_img,unwarp_img] = hmri_create_B1Map_unwarp(magfnam, phasefnam, anatfnam, otherfnam, b1map_params)
% INPUT ARGUMENTS
% - fmfnam filename of the fieldmap images (must be char)
% - anatfnam filename of the image to be undistorted ("anatomical" reference, i.e. SSQ image)
Expand Down Expand Up @@ -101,7 +101,7 @@
%----------------------------------------------------------------------
% Create field map (in Hz) - this routine calls the unwrapping
%----------------------------------------------------------------------
IP.fm = hmri_FieldMap('CreateFieldMap',IP);
IP.fm = hmri_create_FieldMap('CreateFieldMap',IP);

% TL: move created maps to outpath
if IP.maskbrain==1
Expand Down
8 changes: 4 additions & 4 deletions hmri_create_FieldMap.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function varargout = hmri_FieldMap(varargin)
function varargout = hmri_create_FieldMap(varargin)
% This is a fraction of the FieldMap script (case 'createfieldmap')
% rewritten for the hMRI toolbox in order to make use of the original
% SPM12's FieldMap script wherever no modification is required. The
Expand All @@ -8,13 +8,13 @@
% Implementation following FieldMap version:
% $Id: FieldMap.m 6994 2017-01-26 16:19:14Z guillaume $
%
% FORMAT IP.fm = hmri_FieldMap('CreateFieldMap',IP);
% FORMAT IP.fm = hmri_create_FieldMap('CreateFieldMap',IP);
%=======================================================================

persistent IP % Input and results

if nargin == 0
warning('Can only be called for map creation.\nFORMAT: FM = hmri_FieldMap(''CreateFieldMap'',IP);');
warning('Can only be called for map creation.\nFORMAT: FM = hmri_create_FieldMap(''CreateFieldMap'',IP);');
return;
else
Action = varargin{1};
Expand Down Expand Up @@ -63,7 +63,7 @@
if IP.maskbrain==1
IP.fmagP = FieldMap('Magnitude',IP);
% IP.uflags.bmask = pm_brain_mask(IP.fmagP,IP.mflags);
IP.uflags.bmask = hmri_pm_brain_mask(IP.fmagP,IP.mflags);
IP.uflags.bmask = hmri_create_pm_brain_mask(IP.fmagP,IP.mflags);
varargout{2} = IP.fmagP;
end

Expand Down
4 changes: 2 additions & 2 deletions hmri_create_MTProt.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [fR1, fR2s, fMT, fA, PPDw, PT1w] = hmri_MTProt(jobsubj, P_trans, P_receiv) %#ok<*STOUT>
function [fR1, fR2s, fMT, fA, PPDw, PT1w] = hmri_create_MTProt(jobsubj, P_trans, P_receiv) %#ok<*STOUT>

% Evaluation function for multi-contrast multi-echo FLASH protocol
% P_mtw, P_pdw, P_t1w (retrieved from jobsubj.raw_mpm): MTw, PDw, T1w
Expand Down Expand Up @@ -578,7 +578,7 @@

% Use masked MT image to calculate transformation for ACPC realignment
% (to increase robustness in segmentation):
[~,R] = hmri_comm_adjust(1,V_MT.fname,V_MT.fname,8,0,fullfile(spm('Dir'),'canonical','avg152T1.nii'));
[~,R] = hmri_create_comm_adjust(1,V_MT.fname,V_MT.fname,8,0,fullfile(spm('Dir'),'canonical','avg152T1.nii'));

% Collect all images from all defined output directories:
allpaths = jobsubj.path;
Expand Down
2 changes: 1 addition & 1 deletion hmri_create_RFsens.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function jobsubj = hmri_RFsens(jobsubj)
function jobsubj = hmri_create_RFsens(jobsubj)
% RF sensitivity calculation as part of the hmri toolbox
% Based on a script by Daniel Papp
% Wellcome Trust Centre for Neuroimaging (WTCN), London, UK.
Expand Down
16 changes: 9 additions & 7 deletions hmri_create_b1map.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function P_trans = hmri_run_b1map(jobsubj)
function P_trans = hmri_create_b1map(jobsubj)

%% Processing of B1 maps for B1 bias correction
% FORMAT P_trans = hmri_run_b1map(jobsubj)
% FORMAT P_trans = hmri_create_b1map(jobsubj)
% jobsubj - are parameters for one subject out of the job list.
% NB: ONE SINGLE DATA SET FROM ONE SINGLE SUBJECT IS PROCESSED HERE,
% LOOP OVER SUBJECTS DONE AT HIGHER LEVEL.
Expand Down Expand Up @@ -164,13 +164,15 @@
% Corresponding scanning protocol/sequence: al_B1mapping
% Input: 11 pairs of (SE, STE) images for B1 map calculation and 3 images
% for B0 map calculation.
% This macro calls the functions hmri_B1Map_unwarp and hmri_B1Map_process
% for correction of image distortions, padding and smoothing of the images.
% This macro calls the functions hmri_create_B1Map_unwarp and
% hmri_create_B1Map_process for correction of image distortions, padding
% and smoothing of the images.
% Output:
% - distorted B1 (B1map_*) and error (SDmap_*) maps
% - undistorted B1 (uB1map_*) and error (uSDmap_*) maps
% - undistorted, masked and padded B1 maps (muB1map_*)
% - undistorted, masked, padded and smoothed B1 maps (smuB1map_*) i.e. FULLY PROCESSED
% - undistorted, masked, padded and smoothed B1 maps (smuB1map_*)
% i.e. FULLY PROCESSED
% At each voxel, this macro selects the 5 pairs of (SE,STE image) (out of
% 11) with maximum signal amplitude in the SE images.
% The sum of square image of all SE images is created (SumOfSq) and
Expand Down Expand Up @@ -295,7 +297,7 @@
otherfnam{2} = W_save.fname;

% unwarp
[fmap_img,unwarp_img] = hmri_B1Map_unwarp(fmfnam, anatfnam, otherfnam, b1map_params);
[fmap_img,unwarp_img] = hmri_create_B1Map_unwarp(fmfnam, anatfnam, otherfnam, b1map_params);
uanat_img{1} = unwarp_img{1}.fname;
ub1_img{1} = unwarp_img{2}.fname;
ustd_img{1} = unwarp_img{3}.fname;
Expand Down Expand Up @@ -341,7 +343,7 @@
%--------------------------------------------------------------------------
fpm_img{1} = fmap_img{1};
vdm_img{1} = fmap_img{2};
[allub1_img] = hmri_B1Map_process(ub1_img,ustd_img,vdm_img,fpm_img,b1map_params);
[allub1_img] = hmri_create_B1Map_process(ub1_img,ustd_img,vdm_img,fpm_img,b1map_params);

% set metadata for processing B1 images
% define generic header for B1 process
Expand Down
2 changes: 1 addition & 1 deletion hmri_create_comm_adjust.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [M,R] = hmri_comm_adjust(option,Ref,Other,Nits,doshear,Template)
function [M,R] = hmri_create_comm_adjust(option,Ref,Other,Nits,doshear,Template)

% This function is a version of comm_adjust.m customized for T1 like
% images, i.e. MT images. Now it is necessary to define as input parameter
Expand Down
12 changes: 6 additions & 6 deletions hmri_create_pm_brain_mask.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function bmask = hmri_pm_brain_mask(P,flags)
function bmask = hmri_create_pm_brain_mask(P,flags)
% Calculate a brain mask in hMRI Toolbox
% This is pm_brain_mask (SPM12/toolbox/FieldMap) modified for the hMRI
% toolbox. Calls hmri_pm_segment instead of pm_segment. This is the only
% modification, syntax is unchanged otherwise.
% toolbox. Calls hmri_create_pm_segment instead of pm_segment. This is the
% only modification, syntax is unchanged otherwise.
%
% FORMAT bmask = hmri_pm_brain_mask(P,flags)
% FORMAT bmask = hmri_create_pm_brain_mask(P,flags)
%
% P - is a single pointer to a single image
%
Expand Down Expand Up @@ -50,8 +50,8 @@
% seg_flags.estimate.reg=flags.reg;
% seg_flags.graphics = flags.graphics;
% VO=pm_segment(P.fname,flags.template,seg_flags);
% % In hmri_pm_brain_mask, replaced by:
VO = hmri_pm_segment(P.fname);
% % In hmri_create_pm_brain_mask, replaced by:
VO = hmri_create_pm_segment(P.fname);

bmask=double(VO(1).dat)+double(VO(2).dat)+double(VO(3).dat)>0;

Expand Down
6 changes: 3 additions & 3 deletions hmri_create_pm_segment.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function VO = hmri_pm_segment(InputImage)
function VO = hmri_create_pm_segment(InputImage)
% To segment the brain and extract a brain mask in the hMRI Toolbox
% This function replaces pm_segment used in the FieldMap toolbox
% (SPM12/toolbox/FieldMap). Used in hmri_pm_brain_mask.
% (SPM12/toolbox/FieldMap). Used in hmri_create_pm_brain_mask.
%
% FORMAT: VO = hmri_pm_segment(P.fname).
% FORMAT: VO = hmri_create_pm_segment(P.fname).
%
%==========================================================================
% Written by Lester Melie-Garcia
Expand Down
2 changes: 1 addition & 1 deletion hmri_create_process_data_spec.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function job = hmri_process_data_spec(job)
function job = hmri_create_process_data_spec(job)
if isfield(job.data_spec, 'sdata_multi')
% ---- MT ----
s = 1;
Expand Down
4 changes: 2 additions & 2 deletions hmri_create_unicort.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function out = hmri_run_unicort(P_PDw, P_R1, jobsubj)
% function P = hmri_run_unicort(P_PDw, P_R1, jobsubj)
function out = hmri_create_unicort(P_PDw, P_R1, jobsubj)
% function P = hmri_create_unicort(P_PDw, P_R1, jobsubj)
% P_PDw: proton density weighted FLASH image (small flip angle image) for
% masking
% P_R1: R1 (=1/T1) map estimated from dual flip angle FLASH experiment
Expand Down
4 changes: 2 additions & 2 deletions hmri_proc_MPMsmooth.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function fn_out = hmri_MPMsmooth(fn_wMPM, fn_mwTC, fn_TPM, fwhm, l_TC)
function fn_out = hmri_proc_MPMsmooth(fn_wMPM, fn_mwTC, fn_TPM, fwhm, l_TC)
% Applying tissue specific smoothing, aka. weighted averaging, in order to
% limit partial volume effect.
%
% FORMAT
% fn_out = hmri_MPMsmooth(fn_wMPM, fn_mwTC, fn_TPM, fwhm)
% fn_out = hmri_proc_MPMsmooth(fn_wMPM, fn_mwTC, fn_TPM, fwhm)
%
% INPUT
% - fn_wMPM : filenames (char array) of the warped MPM, i.e. the
Expand Down
18 changes: 9 additions & 9 deletions hmri_run_create.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
function out = hmri_run_mpr(job)
function out = hmri_run_create(job)
%==========================================================================
% PURPOSE
% Calculation of multiparameter maps using B1 maps for B1 bias correction.
% If no B1 maps available, one can choose not to correct for B1 bias or
% apply UNICORT.
%==========================================================================
job = hmri_process_data_spec(job);
job = hmri_create_process_data_spec(job);

out.R1 = {};
out.R2s = {};
Expand All @@ -17,7 +17,7 @@
% each subject:
for in=1:numel(job.subj)
local_job.subj = job.subj(in);
out_temp = hmri_mpr_local(local_job);
out_temp = hmri_create_local(local_job);
out.subj(in) = out_temp.subj(1);
out.R1{end+1} = out.subj(in).R1{1};
out.R2s{end+1} = out.subj(in).R2s{1};
Expand All @@ -30,7 +30,7 @@
%% =======================================================================%
% LOCAL SUBFUNCTION (PROCESSING FOR ONE SUBJET)
%=========================================================================%
function out_loc = hmri_mpr_local(job)
function out_loc = hmri_create_local(job)

% determine output directory path
try
Expand Down Expand Up @@ -61,22 +61,22 @@
job.subj.path.respath = respath;

% run B1 map calculation for B1 bias correction
P_trans = hmri_run_b1map(job.subj);
P_trans = hmri_create_b1map(job.subj);

% check, if RF sensitivity profile was acquired and do the recalculation
% accordingly
if ~isfield(job.subj.sensitivity,'RF_none')
job.subj = hmri_RFsens(job.subj);
job.subj = hmri_create_RFsens(job.subj);
end

P_receiv = [];

% run hmri_MTProt to evaluate the parameter maps
[fR1, fR2s, fMT, fA, PPDw, PT1w] = hmri_MTProt(job.subj, P_trans, P_receiv);
% run hmri_create_MTProt to evaluate the parameter maps
[fR1, fR2s, fMT, fA, PPDw, PT1w] = hmri_create_MTProt(job.subj, P_trans, P_receiv);

% apply UNICORT if required, and collect outputs:
if strcmp(job.subj.b1_type,'UNICORT')
out_unicort = hmri_run_unicort(PPDw, fR1, job.subj);
out_unicort = hmri_create_unicort(PPDw, fR1, job.subj);
out_loc.subj.R1 = {out_unicort.R1u};
else
out_loc.subj.R1 = {fR1};
Expand Down
2 changes: 1 addition & 1 deletion hmri_run_proc_smooth.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
fn_mwTC{jj} = job.vols_tc{jj}{i_subj};
end

fn_out = hmri_MPMsmooth(char(fn_wMPM), char(fn_mwTC), fn_TPM, job.fwhm, l_TC);
fn_out = hmri_proc_MPMsmooth(char(fn_wMPM), char(fn_mwTC), fn_TPM, job.fwhm, l_TC);

for jj = 1:n_TCs
for kk = 1:n_pams
Expand Down
2 changes: 1 addition & 1 deletion tbx_cfg_hmri.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
'and will include a number of (as yet unspecified) extensions in ',...
'future updates. Please report any bugs or problems to [email protected].']
}';
hmri.values = {tbx_scfg_hmri_crm tbx_scfg_hmri_proc };
hmri.values = {tbx_scfg_hmri_create tbx_scfg_hmri_proc };
end

15 changes: 7 additions & 8 deletions tbx_scfg_hmri_create.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function crm = tbx_scfg_hmri_crm
function crm = tbx_scfg_hmri_create
% Configuration file for the "histological MRI" (hMRI) toolbox
% Previously named "Voxel-Based Quantification" (VBQ)
% -> Dealing with the creation of the maps
Expand Down Expand Up @@ -291,8 +291,8 @@
data_spec.val = { sdata };
create_mpr.val = { data_spec };
create_mpr.help = {'hMRI map creation can handle data sets with and without B0/B1 maps.'};
create_mpr.prog = @hmri_run_mpr;
create_mpr.vout = @vout_create_mpr;
create_mpr.prog = @hmri_run_create;
create_mpr.vout = @vout_create;
% ---------------------------------------------------------------------
% crm Create maps
% ---------------------------------------------------------------------
Expand All @@ -309,13 +309,12 @@
% ========================================================================
%% VOUT & OTHER SUBFUNCTIONS
% ========================================================================
% The RUN functions :
% - out = hmri_run_mpr_b0_b1(job)
% - out = hmri_run_mpr_unicort(job)
% are defined separately.
% The RUN function:
% - out = hmri_run_create(job)
% is defined separately.
%_______________________________________________________________________

function dep = vout_create_mpr(job)
function dep = vout_create(job)
% This depends on job contents, which may not be present when virtual
% outputs are calculated.

Expand Down

0 comments on commit e009049

Please sign in to comment.