#!/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 $dest_dir = 'fmri_conv'; my %locs = map { my ( $key, $value ) = split " "; $key => $value} read_file $data_dir.'/'.$ifile; foreach my $subject (sort keys %locs) { my ($short) = $subject =~ /0(.*)/; #print "$short\n"; my $orig = '"/nas/corachan/facehbi/F'.$short.'/Serie('.$locs{$subject}.')/Img00001.dcm"'; #print "$orig\n"; my $order = 'mkdir '.$data_dir.'/'.$dest_dir.'/f'.$short.' && dcm2nii -o '.$data_dir.'/'.$dest_dir.'/f'.$short.' '.$orig; print "$order\n"; system($order); }