Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
avwutils
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
avwutils
Commits
50532fd0
Commit
50532fd0
authored
20 years ago
by
Mark Jenkinson
Browse files
Options
Downloads
Patches
Plain Diff
Added fmriborient and stopped EDITOR being
used in avwedithd - as it is almost always set to vi!
parent
03a5edd4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+1
-0
1 addition, 0 deletions
Makefile
fmriborient
+110
-0
110 additions, 0 deletions
fmriborient
fsledithd
+4
-4
4 additions, 4 deletions
fsledithd
with
115 additions
and
4 deletions
Makefile
+
1
−
0
View file @
50532fd0
...
...
@@ -23,6 +23,7 @@ XFILES = avwcpgeom avwmerge avwnvols avwsplit \
avwstats avwcomplex avwstats++ avwfft avwmeants avwcheck avwswapdim avwconv avwslice avworient
SCRIPTS
=
avwval avwchpixdim avwanimate sliceanimate avwsize avwinfo avwedithd avwchfiletype
FSCRIPTS
=
fmriborient
RUNAVWS
=
avw2ascii avwmaths avwcc avwroi avwfill avwinterleave
...
...
This diff is collapsed.
Click to expand it.
fmriborient
0 → 100755
+
110
−
0
View file @
50532fd0
#!/bin/sh
if
[
$#
-lt
1
]
;
then
echo
"
$0
<list of files>"
echo
" Fixes the orientation of all pre-3.2beta nifti1 files written in fmrib"
exit
1
fi
FSLDIR
=
/usr/local/fsltest
export
FSLDIR
for
fm
in
$@
;
do
stdspace
=
0
;
if
[
`
$FSLDIR
/bin/imtest
$fm
`
=
1
]
;
then
fn
=
`
$FSLDIR
/bin/imglob
$fm
`
fb
=
`
$FSLDIR
/bin/remove_ext
$fn
`
if
[
X
`
$FSLDIR
/bin/avwval
$fb
descrip
`
!=
XFSL3.2beta
]
;
then
# make a backup copy and check to see if it copied OK (exit if not)
ftmp
=
`
echo
${
fn
}
|
sed
's/.nii/_niifix.nii/'
`
if
[
X
$ftmp
=
X
$fn
]
;
then
ftmp
=
${
fn
}
_niifix
fi
/bin/cp
-p
$fn
${
ftmp
}
if
[
`
$FSLDIR
/bin/imtest
${
ftmp
}
`
!=
1
]
;
then
echo
"FAIL 1"
echo
${
fb
}
>>
/tmp/NIIFIXFAILS
;
exit
2
;
fi
statsA
=
`
$FSLDIR
/bin/avwstats++
${
fb
}
-R
-V
`
statsB
=
`
$FSLDIR
/bin/avwstats++
${
ftmp
}
-R
-V
`
min
=
`
echo
$statsA
|
awk
'{ print $1 }'
`
mint
=
`
echo
$statsB
|
awk
'{ print $1 }'
`
if
[
$min
!=
$mint
]
;
then
echo
"FAIL 2:
$min
$mint
"
echo
${
fb
}
>>
/tmp/NIIFIXFAILS
;
exit
2
;
fi
max
=
`
echo
$statsA
|
awk
'{ print $2 }'
`
maxt
=
`
echo
$statsB
|
awk
'{ print $2 }'
`
if
[
$max
!=
$maxt
]
;
then
echo
"FAIL 3:
$max
$maxt
"
echo
${
fb
}
>>
/tmp/NIIFIXFAILS
;
exit
2
;
fi
mvv
=
`
echo
$statsA
|
awk
'{ print $3 }'
`
mvvt
=
`
echo
$statsB
|
awk
'{ print $3 }'
`
if
[
$mvv
!=
$mvvt
]
;
then
echo
"FAIL 4:
$mvv
$mvvt
"
echo
${
fb
}
>>
/tmp/NIIFIXFAILS
;
exit
2
;
fi
# OK, now remove orientation information
$FSLDIR
/bin/avworient
-deleteorient
$fb
# check if it should be in standard space
hdrinfo
=
`
$FSLDIR
/bin/avwhd
$fn
`
;
nx
=
`
echo
$hdrinfo
|
sed
's/ \([a-z]\)/X\1/g'
|
tr
'X'
'\n'
|
grep
dim1 |
head
-1
|
awk
'{ print $2 }'
`
;
ny
=
`
echo
$hdrinfo
|
sed
's/ \([a-z]\)/X\1/g'
|
tr
'X'
'\n'
|
grep
dim2 |
head
-1
|
awk
'{ print $2 }'
`
;
nz
=
`
echo
$hdrinfo
|
sed
's/ \([a-z]\)/X\1/g'
|
tr
'X'
'\n'
|
grep
dim3 |
head
-1
|
awk
'{ print $2 }'
`
;
dx
=
`
echo
$hdrinfo
|
sed
's/ \([a-z]\)/X\1/g'
|
tr
'X'
'\n'
|
grep
pixdim1 |
head
-1
|
awk
'{ print $2 }'
`
;
dy
=
`
echo
$hdrinfo
|
sed
's/ \([a-z]\)/X\1/g'
|
tr
'X'
'\n'
|
grep
pixdim2 |
head
-1
|
awk
'{ print $2 }'
`
;
dz
=
`
echo
$hdrinfo
|
sed
's/ \([a-z]\)/X\1/g'
|
tr
'X'
'\n'
|
grep
pixdim3 |
head
-1
|
awk
'{ print $2 }'
`
;
if
[
$nx
-eq
91
-a
$ny
-eq
109
-a
$nz
-eq
91
]
;
then
if
[
`
echo
"(
$dx
*
$dx
- 4.0 ) * 1000"
| bc
-l
`
-eq
0
]
;
then
if
[
`
echo
"(
$dy
*
$dy
- 4.0 ) * 1000"
| bc
-l
`
-eq
0
]
;
then
if
[
`
echo
"(
$dz
*
$dz
- 4.0 ) * 1000"
| bc
-l
`
-eq
0
]
;
then
# treat it as a standard space image
$FSLDIR
/bin/avwcpgeom /usr/local/fsl/etc/standard/avg152T1
$fb
-d
fi
fi
fi
fi
# check if stats are still OK, if not then restore copy
if
[
`
$FSLDIR
/bin/imtest
${
fb
}
`
!=
1
]
;
then
/bin/cp
-p
${
ftmp
}
${
fn
}
echo
"FAIL 5:
${
fb
}
"
echo
${
fb
}
>>
/tmp/NIIFIXFAILS
;
exit
2
;
fi
statsA
=
`
$FSLDIR
/bin/avwstats++
${
fb
}
-R
-V
`
;
statsB
=
`
$FSLDIR
/bin/avwstats++
${
ftmp
}
-R
-V
`
;
min
=
`
echo
$statsA
|
awk
'{ print $1 }'
`
mint
=
`
echo
$statsB
|
awk
'{ print $1 }'
`
if
[
$min
!=
$mint
]
;
then
/bin/cp
-p
${
ftmp
}
${
fn
}
echo
"FAIL 6:
$min
$mint
"
echo
${
fb
}
>>
/tmp/NIIFIXFAILS
;
exit
2
;
fi
max
=
`
echo
$statsA
|
awk
'{ print $2 }'
`
maxt
=
`
echo
$statsB
|
awk
'{ print $2 }'
`
if
[
$max
!=
$maxt
]
;
then
/bin/cp
-p
${
ftmp
}
${
fn
}
echo
"FAIL 7:
$max
$maxt
"
echo
${
fb
}
>>
/tmp/NIIFIXFAILS
;
exit
2
;
fi
mvv
=
`
echo
$statsA
|
awk
'{ print $3 }'
`
mvvt
=
`
echo
$statsB
|
awk
'{ print $3 }'
`
if
[
$mvv
!=
$mvvt
]
;
then
/bin/cp
-p
${
ftmp
}
${
fn
}
echo
"FAIL 8:
$mvv
$mvvt
"
echo
${
fb
}
>>
/tmp/NIIFIXFAILS
;
exit
2
;
fi
# if all checks are fine then remove the backup
$FSLDIR
/bin/imrm
${
ftmp
}
fi
fi
done
This diff is collapsed.
Click to expand it.
fsledithd
+
4
−
4
View file @
50532fd0
...
...
@@ -23,11 +23,11 @@ if [ _$FSLDIR = _ ] ; then
export
FSLDIR
fi
if
[
X
$EDITOR
=
X
]
;
then
EDITOR
=
pico
if
[
X
$
FSL
EDITOR
=
X
]
;
then
FSL
EDITOR
=
pico
fi
if
[
$#
-ge
2
]
;
then
EDITOR
=
$2
FSL
EDITOR
=
$2
fi
tmpbase
=
`
${
FSLDIR
}
/bin/tmpnam
`
;
...
...
@@ -67,7 +67,7 @@ echo " " >> ${tmpbase}
echo
"/>"
>>
${
tmpbase
}
# edit header, reprocess and pass onto avwcreatehd
${
EDITOR
}
${
tmpbase
}
${
FSL
EDITOR
}
${
tmpbase
}
cat
${
tmpbase
}
|
grep
-v
'^[ ]*#'
|
grep
-v
'^[ ]*$'
>
${
tmpbase2
}
${
FSLDIR
}
/bin/avwcreatehd
${
tmpbase2
}
$1
...
...
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