#!/usr/bin/env perl # # Compute the total cerebral volume by computing the volume of gray # matter inside the gray surface. # # Copyright Alan C. Evans # Professor of Neurology # McGill University # use strict; use warnings "all"; use File::Basename; use File::Temp qw/ tempdir /; use MNI::Startup; use MNI::FileUtilities qw(check_output_dirs); my $me = &basename($0); my $Help = < 1, CLEANUP => 1 ); # combine left/right gray surfaces my $gray_surface_full = "${TmpDir}/gray_surface_full.obj"; &run( "objconcat", $gray_surface_left, $gray_surface_right, "none", "none", $gray_surface_full, "none" ); # mask out internal gray matter through the cut of the corpus callosum. my $cls_fixed = "${TmpDir}/cls_fixed.mnc"; &run( "minccalc", "-clobber", "-expression", 'if(A[1]>0.5){out=3}else{out=A[0]}', $cls, $callosum_mask, $cls_fixed ); # compute gray volume of the cortex only. &run( "compute_icbm_vols", "-clobber", "-transform", $t1_tal_xfm, "-invert", "-surface_mask", $gray_surface_full, $cls_fixed, $output ); #Execute a system call. sub run { print "@_\n"; system(@_)==0 or die "Command @_ failed with status: $?"; }