#!/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 NEURO qw(load_study print_help achtung shit_done); @ARGV = ("-h") unless @ARGV; while (@ARGV and $ARGV[0] =~ /^-/) { $_ = shift; last if /^--$/; if (/^-h/) { print_help $ENV{'PIPEDIR'}.'/doc/fsl2fs.hlp'; exit;} } my $study = shift; unless ($study) { print_help $ENV{'PIPEDIR'}.'/doc/make_pet_report.hlp'; exit;} my %std = load_study($study); #Run this script ONLY on "Detritus" #or change the paths to the correct ones 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' => "*_b0_to_t1.nii.gz", in => $w_dir); foreach my $name (sort @names){ (my $tmpl = $name) =~ s/_b0_to_t1/_t1_reoriented/; $order .= $name.' '.$tmpl." "; } chdir $w_dir; system($order); print "$order\n"; dirmove('slicesdir', 'dtis');