Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
misc_scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
misc_scripts
Commits
6af7ebbb
Commit
6af7ebbb
authored
18 years ago
by
David Flitney
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
0ec10654
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
correct_and_average
+73
-0
73 additions, 0 deletions
correct_and_average
with
74 additions
and
1 deletion
Makefile
+
1
−
1
View file @
6af7ebbb
...
...
@@ -2,6 +2,6 @@ include ${FSLCONFDIR}/default.mk
PROJNAME
=
misc_scripts
SCRIPTS
=
regscript remove_vols replacevols replace_and_average_fmrib linkbedpost
SCRIPTS
=
regscript remove_vols replacevols replace_and_average_fmrib linkbedpost
ocmr_preproc correct_and_average
all
:
This diff is collapsed.
Click to expand it.
correct_and_average
0 → 100755
+
73
−
0
View file @
6af7ebbb
#!/bin/sh
# Copyright (C) 2004 University of Oxford
#
# SHCOPYRIGHT
usage
()
{
echo
"Usage :
$0
<big4D dataset> <avg file>"
echo
""
echo
" This script assumes that there are 3"
echo
" separate averages of 0, 29, 0, 31, 0, 0, 0 b-values"
echo
" You need to also run Make_bvecs in matlab"
echo
" <artefactfile> is optional"
exit
1
}
[
$#
-lt
2
]
&&
usage
data
=
`
remove_ext
${
1
}
`
;
if
[
`
imtest
$data
`
-eq
0
]
;
then
echo
"Cannot find image called
$1
"
;
exit
fi
avgfile
=
$2
;
if
[
!
-e
$avgfile
]
;
then
echo
" Cannot find
$2
"
exit
fi
numlines
=
`
cat
$avgfile
|grep
-v
'^ *$'
|wc
-l
`
;
numavgs
=
`
expr
$numlines
- 1
`
;
scans_per_avg
=
`
cat
$avgfile
|sed
's/, *$/ /g'
|sed
's/[^,]/ /g'
|sed
-n
'1p'
|wc
-w
`
;
scans_per_avg
=
`
expr
$scans_per_avg
+ 1
`
b0_numbers
=
`
cat
$avgfile
|grep
-v
'^ *$'
|sed
-n
"
${
numlines
}
p"
`
;
ab0
=
`
echo
$b0_numbers
|awk
'{print \$1}'
`
eddy_correct
${
1
}
${
$}
${
1
}
_b0_correct
$ab0
total_vols=
`
avwval
$1
dim4
`
;
vols_per_avg=
`
echo
"10k
$total_vols
$numavgs
/ p"
|dc -
`
;
avwroi
${
1
}
data 0
${
vols_per_avg
}
;
avwmaths data -mul 0 data;
avg=1;scan=1;
while [
${
avg
}
-le
${
numavgs
}
]; do
scan=1
#echo
${
scan
}
${
scans_per_avg
}
while [
${
scan
}
-le
${
scans_per_avg
}
]; do
tmp=
`
cat
$avgfile
|sed
-n
"
${
avg
}
p"
|awk
-F
,
"{ print
\\
$$
scan }"
`
;
echo
$avg
$scan
$tmp
$vols_per_avg
avwroi
${
$}
${
1
}
_b0_correct
${
$}avg_
${
avg
}
_scan_
${
scan
}
$tmp
;
scan=
`
expr
$scan
+ 1
`
;
done
avwmerge -t
${
$}avg_
${
avg
}
_all
`
imglob
-oneperimage
${
$}avg_
${
avg
}
_scan_
*
`
avwmaths data
-add
${
$}avg_
${
avg
}
_all
data;
avg=
`
expr
$avg
+ 1
`
;
done
avwmaths data -div
${
numavgs
}
data;
rm
${
$}
*
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment