#!/usr/bin/perl # Copyright 2015 O. Sotolongo use strict; use warnings; use File::Slurp qw(read_file); use Data::Dump qw(dump); use NEURO qw(populate check_subj load_study print_help get_petdata get_pair achtung shit_done); my $study; @ARGV = ("-h") unless @ARGV; while (@ARGV and $ARGV[0] =~ /^-/) { $_ = shift; last if /^--$/; if (/^-e/) { $study = shift; chomp($study);} if (/^-h/) { print_help $ENV{'PIPEDIR'}.'/doc/dcm_moco.hlp'; exit;} } unless ($study) { print_help $ENV{'PIPEDIR'}.'/doc/dcm_moco.hlp'; exit;} my %std = load_study($study); my $data_dir=$std{'DATA'}; my $ifile = 'ep2d_pace_moco_p2.loc'; my $orig_dir = 'fmri_conv'; my $dest_dir = 'fmri'; my %locs = map { my ( $key, $value ) = split " "; $key => $value} read_file $data_dir.'/'.$ifile; foreach my $subject (sort keys %locs) { my ($short) = $subject =~ /0(.*)/; #my $puaf = sprintf("%04d", $locs{$subject}); my $order = 'cp '.$data_dir.'/'.$orig_dir.'/f'.$short.'/*.nii.gz '.$data_dir.'/'.$dest_dir.'/smc'.$subject.'s'.sprintf("%04d", $locs{$subject}).'.nii.gz'; print "$order\n"; system($order); }