function atlas_registration_test(iter)

SD_atlas = CreateEmptyAtlas('lh');
parms = SD_atlas.parms;
parms.unfoldBool = 0;

for i = 1:39
    
    mris_SD_register(fullfile(parms.SUBJECTS_DIR, parms.subject_cell{i}, 'surf', 'lh.sphere'), ... 
        fullfile('..', 'freesurfer', 'lh.DW.Atlas1to39.2.10.mat'), ...
        fullfile(parms.SUBJECTS_DIR, parms.subject_cell{i}, 'surf', ['lh.atlas.klein.' iter '.sphere']), iter)
end


for i = 1:38
    
    parms.SUBJECT = parms.subject_cell{i};
    parms.surf_filename = ['atlas.klein.' iter '.sphere'];
    parms.metric_surf_filename = 'white';
    parms.annot_filename = 'aparc_edited.annot';
    fixed_subject = MARS2_readSbjMesh(parms);
    fixed_subject.metricVerts = fixed_subject.metricVerts/fixed_subject.surface_scaling_factor;
    weights = MARS_computeWeightsOfMeshVertices(fixed_subject, 'metric');
    
    parms.SUBJECT = parms.subject_cell{i+1};
    parms.surf_filename = ['atlas.klein.' iter '.sphere'];
    parms.metric_surf_filename = 'white';
    parms.annot_filename = 'aparc_edited.annot';
    moving_subject = MARS2_readSbjMesh(parms);
    moving_subject.metricVerts = moving_subject.metricVerts/moving_subject.surface_scaling_factor;
    
    OutputLabels = MARS_NNInterpolate(fixed_subject.vertices, moving_subject, moving_subject.MARS_label);
    
    [temp, dice_overall(i)] = MARS_computeDice(fixed_subject, OutputLabels, 1, weights);
    
    save(['atlas_dice.' iter '.mat'], 'dice_overall');
end

