function make_boundaries_main(); % This program was used to generate the label boundaries % for the paper (http://www.mindboggle.info/papers/): % % "Evaluation of 14 nonlinear deformation algorithms % applied to human brain MRI registration" % NeuroImage (2009), doi:10.1016/j.neuroimage.2008.12.037 % by Arno Klein, Jesper Andersson, Babak A. Ardekani, John Ashburner, % Brian Avants, Ming-Chang Chiang, Gary E. Christensen, D. Louis Collins, % James Gee, Pierre Hellier, Joo Hyun Song, Mark Jenkinson, Claude Lepage, % Daniel Rueckert, Paul Thompson, Tom Vercauteren, Roger P. Woods, % J. John Mann, and Ramin V. Parsey. % % This is the main program for constructing brain label boundaries % (calls make_boundaries.m) % % Third party code: % (available from http://www.mathworks.com/matlabcentral/): % nifti toolbox % % (c) 2008, @rno klein %-------------------------------------------------------------- %--------------------------------------------------- % Setup: load parameters and create output directory %--------------------------------------------------- path(path,'/piece-of-mind/registration_study/Programs/nifti'); more off; format compact; time0 = clock; datapath = '/piece-of-mind/registration_study/'; %reg_method = 'FLIRT' %reg_method = 'ART' %reg_method = 'ITK' %reg_method = 'AIR' %reg_method = 'ANIMAL' %reg_method = 'Demons' %reg_method = 'Fluid' %reg_method = 'FNIRT' reg_method = 'SyN' %reg_method = 'SPM5_Normalize_direct_8mm' % 183x219x183 -> 182x218x182 %reg_method = 'SICLE' %reg_method = 'Romeo' %reg_method = 'Pasha' %reg_method = 'HAMMER' %reg_method = 'SPM5_Normalize' %reg_method = 'SPM5_UnifiedSegment' %reg_method = 'SPM5_DARTEL_pairs' verbose = 1; save_results = 1; singles = 0; pairs = 1; if strcmp(reg_method,'SPM5_DARTEL_pairs')==1 atlas_path = [datapath 'Atlases/Atlases_MNIspace_RL_DARTELpairseval/']; else atlas_path = [datapath 'Atlases/Atlases_MNIspace/' ]; end out_path1 = [datapath 'Atlases/Atlases_MNIspace_Borders/' ]; test_path = [datapath 'Transformed_Atlases/' reg_method '/']; out_path2 = [datapath 'Evaluations/' reg_method '/']; labels_path = [datapath 'Labels/' ]; filestem_tags = {'g';'m';'l';'c'}; src_filestems3 = {'l1';'l2';'l3';'l4';'l5';'l6';'l7';'l8';'l9';'l10'; 'l11';'l12';'l13';'l14';'l15';'l16';'l17';'l18';'l19';'l20'; 'l21';'l22';'l23';'l24';'l25';'l26';'l27';'l28';'l29';'l30'; 'l31';'l32';'l33';'l34';'l35';'l36';'l37';'l38';'l39';'l40'}; tgt_filestems3 = src_filestems3; for iset = 3 s=sprintf('src_filestems = src_filestems%d;', iset); eval(s); s=sprintf('tgt_filestems = tgt_filestems%d;', iset); eval(s); s=sprintf('load %s%s_Labels;',labels_path,char(filestem_tags(iset))); eval(s); %----------------------------------------------- % Loop through sources and targets (and atlases) %----------------------------------------------- for itarget = 1 : length( tgt_filestems ) target_name = char(tgt_filestems(itarget)); if singles==1 if verbose > 0 s=sprintf('disp(''%s'');',target_name); eval(s); end s=sprintf('TEST = load_nii(''%s'');',[atlas_path target_name '.img']); eval(s); TEST = double(TEST.img); [Boundaries,Borders] = make_boundaries( TEST, Labels, size(TEST), verbose ); if save_results==1 s = ['save ' out_path1 target_name '_borders.mat Borders;'] eval(s); end end if pairs==1 for isource = 1 : length( src_filestems ) source_name = char(src_filestems(isource)); %-------------- % Image volumes %-------------- if verbose > 0 s=sprintf('disp(''%s_to_%s'');',source_name,target_name); eval(s); end s=sprintf('TEST = load_nii(''%s'');',[test_path source_name '_to_' target_name '.img']); eval(s); TEST = double(TEST.img); if strcmp(reg_method,'SPM5_Normalize_direct_8mm')==1 TEST = TEST(2:end,2:end,2:end); end [Boundaries,Borders] = make_boundaries( TEST, Labels, size(TEST), verbose ); if save_results==1 s = ['save ' out_path2 source_name '_to_' target_name '_borders.mat Borders;']; eval(s); end end end end end disp(['Completed in ' num2str(etime(clock,time0)/60) ' minutes']);