
%   FUNCTION: healthy_normals_location 
%       ARGUMENT: number_of_healthy_normals (we provide 14 patients)
%   -----------------------------------------------------------------------
%   This function iterates through the Healthy Normal patients
%   and creates scan filenames which are loaded automatically into SPM to save the
%   user from data entry errors. 

%   NOTE: The only variable you should change in this file is *folderlocation* (line 13). 
%   The folderlocation is where the user has saved the Healthy Normal scans on the hard disk.
%   This location can be chosen by the user based on convenience. The
%   default value is C:\ISAS\Healthy_Normals\

function healthy_normals_scan_filenames = healthy_normals_location (number_of_healthy_normals)
    folderlocation = 'C:\ISAS\Healthy_Normals\'; % this line must be properly defined for automated image selection
    % For reference, we provide a few *folderlocation* definition examples below: 
    % Using different Matlab versions in Windows
    %   folderlocation = 'C:\Matlab6p1\spm2\Healthy_Normals\';
    %   folderlocation = 'C:\Matlab6p5p1\spm2\Healthy_Normals\';
    %   folderlocation = 'C:\Program Files\MATLAB704\spm2\Healthy_Normals\'
    % Installing the Healthy Normals in an independent location
    %   folderlocation = 'C:\ISAS\Healthy_Normals\';
    
    %The filenames are internally composed of a folderlocation, prefix, patient #, and suffix. 
    prefix1 = 'swrHN0';
    prefix2 = 'swrHN00';
    suffix1 = '_D1.img';
    suffix2 = '_D2.img';
    
    % create a cell array to store the filenames
    healthy_normals_scan_filenames = cell(number_of_healthy_normals*2, 1);
    j = 1;
    for i = 1:number_of_healthy_normals
        if i > 9 % using prefix 1 for double digit subject numbers
            filename = [folderlocation prefix1 int2str(i) suffix1];
            % scan 1 of the scan pair
            healthy_normals_scan_filenames {j} = filename;
            j = j + 1;
            filename = [folderlocation prefix1 int2str(i) suffix2];
            % scan 2 of the scan pair
            healthy_normals_scan_filenames {j} = filename;
            j = j + 1;
        else % using prefix 2 for single digit subject numbers
             % placing an addition zero at the beginning of the filename
            filename = [folderlocation prefix2 int2str(i) suffix1];
            % scan 1 of the scan pair
            healthy_normals_scan_filenames {j} = filename;
            j = j + 1;
            filename = [folderlocation prefix2 int2str(i) suffix2];
            % scan 2 of the scan pair
            healthy_normals_scan_filenames {j} = filename;
            j = j + 1;
        end
end