#! /usr/bin/env perl # # Make an asymmetry map for cortical surface position. # # Claude Lepage - claude@bic.mni.mcgill.ca # # Copyright Alan C. Evans # Professor of Neurology # McGill University # use strict; use warnings "all"; use Getopt::Tabular; use File::Basename; use File::Temp qw/ tempdir /; my($Help, $Usage, $me); $me = &basename($0); $Help = < 1, CLEANUP => 1 ); # # Left/right differences by hemisphere: # # must flip right hemisphere to look like the left one. &do_cmd( 'param2xfm', '-scales', -1, 1, 1, "${tmpdir}/flip.xfm" ); &do_cmd( 'transform_objects', $right_surface, "${tmpdir}/flip.xfm", "${tmpdir}/right_flipped.obj" ); unlink( "${tmpdir}/flip.xfm" ); # must transform the surfaces to native space. &do_cmd( 'xfminvert', $t1_xfm, "${tmpdir}/t1_invert.xfm" ); &do_cmd( 'transform_objects', "${tmpdir}/right_flipped.obj", "${tmpdir}/t1_invert.xfm", "${tmpdir}/right_native.obj" ); &do_cmd( 'transform_objects', $left_surface, "${tmpdir}/t1_invert.xfm", "${tmpdir}/left_native.obj" ); unlink( "${tmpdir}/right_flipped.obj" ); unlink( "${tmpdir}/t1_invert.xfm" ); # compute the distance between surfaces at the vertices. &do_cmd( 'diff_surfaces', "${tmpdir}/left_native.obj", "${tmpdir}/right_native.obj", 'link', $diff_surface ); unlink( "${tmpdir}/left_native.obj" ); unlink( "${tmpdir}/right_native.obj" ); # Left-right distance by hemisphere, on reconstructed full surface # (left+right surfaces combined). if( defined $diff_surface_full ) { if(-e $diff_surface_full && !$clobber){ die "$me: $diff_surface_full exists, -clobber to overwrite\n\n"; } &do_cmd( 'cat', $diff_surface, $diff_surface, ' > ', $diff_surface_full ); } sub do_cmd { print STDOUT "@_\n" if $verbose; system("@_") == 0 or die; }