forked from ANTsX/ANTs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwarpimages.pl
executable file
·55 lines (47 loc) · 1.51 KB
/
warpimages.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/perl -w
if ($#ARGV >= 0) { $who = join(' ', $ARGV[0]); }
if ($#ARGV >= 1) { $template = join(' ', $ARGV[1]); }
if ($#ARGV >= 2) { $dim = join(' ', $ARGV[2]); } else { $dim=0; }
if ($#ARGV >= 3) { $outnaming = join(' ', $ARGV[3]); } else { $outnaming=""; }
opendir(DIR, $who);
@filelist = glob("$who");
# @filelist2 = glob("$who2");
$ct=0;
print " EXPECTING IMAGE DIMENSION ".$dim." \n \n \n ";
$dir = `pwd`;
$dir=substr($dir,0,length($dir)-1)."/";
$pathpre="/mnt/aibs1/avants/bin/ants/";
$qsname="superfresh.sh";
foreach $name (@filelist)
{
$pre=$outnaming.$name;
$pre=~s/\.[^.]*$//;
print $pre." \n ";
$prog=$pathpre."WarpImageMultiTransform ".$dim;
$exe=$prog." ".$name." ".$pre."deformed.nii ".$pre."Warp.nii ".$pre."Affine.txt -R ".$template;
$exe2 = "/mnt/pkg/sge-root/bin/lx24-x86/qsub -q mac ".$qsname." ".$dir." ".$exe." ";
print $exe."\n";
system $exe2;
# USE qstat TO VERIFY THE JOB IS SUBMITTED
$ct=$ct+1;
}
$user=`whoami`;
chomp($user);
print " you are ".$user." = a jingle-jangle-jungle ";
$atcfn=0;
if ($atcfn) { $waitcmd="vq -s | grep ".$user; }
else { $waitcmd=" qstat -u ".$user." | grep ".substr($qsname,0,4); }
$continuewaiting=1;
if ($continuewaiting) { system "sleep 40"; }
while($continuewaiting)
{
system $waitcmd;
$output = `$waitcmd`;
if ( $output eq "" )
{
$continuewaiting=0;
print "Jobs all finished!\n";
}
else { print " wait ";system "sleep 30"; }
}
closedir(DIR);