#!/usr/bin/perl use strict; use warnings; use File::Slurp qw(read_file); use File::Find::Rule; use File::Basename qw(basename); use Data::Dump qw(dump); use File::Copy::Recursive qw(dirmove); use NEURO4 qw(load_project print_help shit_done); @ARGV = ("-h") unless @ARGV; while (@ARGV and $ARGV[0] =~ /^-/) { $_ = shift; last if /^--$/; if (/^-h/) { print_help $ENV{'PIPEDIR'}.'/doc/make_dti_report.hlp'; exit;} } my $study = shift; unless ($study) { print_help $ENV{'PIPEDIR'}.'/doc/make_dti_report.hlp'; exit;} my %std = load_project($study); my $w_dir=$std{'WORKING'}; my $d_dir=$std{'DATA'}; # Redirect ouput to logfile (do it only when everything is fine) my $debug = "$d_dir/.debug_report.log"; open STDOUT, ">$debug" or die "Can't redirect stdout"; open STDERR, ">&STDOUT" or die "Can't dup stdout"; my $order = "slicesdir -o "; my @names = find(file => 'name' => "*mni_to_b0.nii.gz", in => $w_dir); foreach my $name (sort @names){ (my $warped = $name) =~ s/mni_to_b0/hifi_b0/; $order .= $warped.' '.$name." "; } chdir $w_dir; system($order); print "$order\n"; dirmove('slicesdir', 'dtis');