diff --git a/ChangeLog b/ChangeLog index d28e971..1feb393 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-01-30 Claude Lepage + * add icbm_make_templates.pl + 2006-06-22 Claude Lepage * modify multispectral_stx_registration for new pipeline * use model icbm_avg_152_t1_tal_nlin_symmetric_VI in nlfit_smr diff --git a/NEWS b/NEWS index 7fbe2d7..a7974c2 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ + New in Release 1.6.4 + -------------------- +* Add icbm_make_templates.pl + (not yet packaged as of Jan-30-2007) + New in Release 1.6.3 -------------------- * Modification of multispectral_stx_registration for new pipeline diff --git a/configure.ac b/configure.ac index bb5f80a..7cad8a0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(conglomerate, 1.6.3, bert@bic.mni.mcgill.ca) +AC_INIT(conglomerate, 1.6.4, bert@bic.mni.mcgill.ca) AC_CONFIG_SRCDIR([surface_mask2.c]) AM_INIT_AUTOMAKE AC_CONFIG_HEADERS([config.h]) diff --git a/icbm_make_templates.pl b/icbm_make_templates.pl new file mode 100755 index 0000000..4ff8560 --- /dev/null +++ b/icbm_make_templates.pl @@ -0,0 +1,74 @@ +#! /usr/bin/env perl + +# Generate templates for a given model (inspired by icbm_make_templates +# from Neelin). +# +# Claude Lepage - claude@bic.mni.mcgill.ca +# +# Permission to use, copy, modify, and distribute this software and its +# documentation for any purpose and without fee is hereby granted, +# provided that the above copyright notice appear in all copies. The +# author and the University of Queensland make no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. + +use strict; +use warnings "all"; +use File::Temp qw/ tempdir /; + +# Output prefix +my $PREFIX = "icbm_nlin_template"; + +# Dimensions +my $XSTART = -96; +my $YSTART = -132; +my $ZSTART = -78; + +my $XCENTER = 0; +my $YCENTER = -18; +my $ZCENTER = 18; + +my $XLEN = 192; +my $YLEN = 228; +my $ZLEN = 192; + +my @spacings = ( "0.50", "0.75", "1.00", "1.50", "2.00", "3.00", "4.00", "6.00" ); + +my $date = `date`; +chomp( $date ); + +# make tmpfile +my $tmpdir = &tempdir( "template-XXXX", TMPDIR => 1, CLEANUP => 1 ); + +# Generate the templates at each size + +for( my $i = 0; $i < @spacings; $i++ ) { + + my $dx = $XLEN / $spacings[$i] + 1; + my $dy = $YLEN / $spacings[$i] + 1; + my $dz = $ZLEN / $spacings[$i] + 1; + + my $list = "$dx $dy $dz -xstart $XSTART -ystart $YSTART -zstart $ZSTART " . + "-xstep $spacings[$i] -ystep $spacings[$i] -zstep $spacings[$i] " . + "-xdircos 1 0 0 -ydircos 0 1 0 -zdircos 0 0 1"; + print "creating template ${PREFIX}_${spacings[$i]}mm.mnc...\n"; + + open PIPE, ">${tmpdir}/template_${spacings[$i]}.sh"; + print PIPE "#! /bin/csh -f\n"; + print PIPE "limit filesize 4k\n"; + print PIPE "rawtominc -clobber -byte -input /dev/zero ${PREFIX}_${spacings[$i]}mm.mnc " . + "$list -transverse -sattribute xspace:spacetype=talairach_ " . + "-sattribute yspace:spacetype=talairach_ -sattribute zspace:spacetype=talairach_ " . + "-sattribute xspace:units=mm -sattribute yspace:units=mm -sattribute zspace:units=mm " . + "-sattribute \':history=$date >>> icbm_make_templates\'\n"; + close PIPE; + system( "chmod u+x ${tmpdir}/template_${spacings[$i]}.sh" ); + system( "${tmpdir}/template_${spacings[$i]}.sh" ); + unlink( "${tmpdir}/template_${spacings[$i]}.sh" ); +} + + +sub run { + system(@_) == 0 or die; +} +