#!/usr/bin/env perl # # Compute the area at the vertices of the resampled cortical mid surface. # # 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 /; # --- set the help & usage strings --- my $help = < 1, CLEANUP => 1 ); # Invert transformation from stereotaxic to native space. my $inv_trans = "${tmpdir}/inv_trans.xfm"; &run( "xfminvert", $transform_xfm, $inv_trans ); # Transform resampled surface from stereotaxic to native space. my $surface_native = "${tmpdir}/surface_native.obj"; &run( "transform_objects", $surface, $inv_trans, $surface_native ); unlink( $inv_trans ); # Compute areas of resampled surface in native space. &run( "depth_potential", "-area_voronoi", $surface_native, "${tmpdir}/rsl_native_area.txt" ); unlink( $surface_native ); # Normalize areas of resampled surface in native space by areas of model. my $area_model = "${tmpdir}/surface_model_area.txt"; &run( "depth_potential", "-area_voronoi", $model, $area_model ); &run( "vertstats_math", "-old_style_file", "-div", "${tmpdir}/rsl_native_area.txt", $area_model, "${tmpdir}/rsl_native_area_norm.txt" ); # Smooth the normalized areas on the stereotaxic model. &run( "depth_potential", "-smooth", $fwhm, "${tmpdir}/rsl_native_area_norm.txt", $model, "${tmpdir}/rsl_native_area.txt" ); # Unnormalized areas by areas of model. &run( "vertstats_math", "-old_style_file", "-mult", "${tmpdir}/rsl_native_area.txt", $area_model, $area_file ); unlink( $area_model ); unlink( "${tmpdir}/rsl_native_area.txt" ); unlink( "${tmpdir}/rsl_native_area_norm.txt" ); #Execute a system call. sub run { system(@_)==0 or die "Command @_ failed with status: $?"; }