Skip to content
Snippets Groups Projects
Commit ab80717c authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Initial import

parents
No related branches found
No related tags found
No related merge requests found
File added
#!/bin/bash
set -e
function neq() {
n1=$1
n2=$2
result=`echo "$n1 == $n2" | bc`
if [[ "$result" == "0" ]]; then
echo "$n1 != $n2"
return 0;
fi
# echo "$n1 == $n2"
return 1;
}
function fslcreatehd_test() {
dim0=$1; shift
dim1=$1; shift
dim2=$1; shift
dim3=$1; shift
dim4=$1; shift
pixdim1=$1; shift
pixdim2=$1; shift
pixdim3=$1; shift
pixdim4=$1; shift
originx=$1; shift
originy=$1; shift
originz=$1; shift
fname=$1; shift
# echo "$originx * $pixdim1"
originx=`echo "$originx * $pixdim1" | bc`
originy=`echo "$originy * $pixdim2" | bc`
originz=`echo "$originz * $pixdim3" | bc`
got_dim0=` fslhd 3d | egrep "^dim0" | tr -s '\t' | cut -f 2`
got_dim1=` fslhd 3d | egrep "^dim1" | tr -s '\t' | cut -f 2`
got_dim2=` fslhd 3d | egrep "^dim2" | tr -s '\t' | cut -f 2`
got_dim3=` fslhd 3d | egrep "^dim3" | tr -s '\t' | cut -f 2`
got_dim4=` fslhd 3d | egrep "^dim4" | tr -s '\t' | cut -f 2`
got_pixdim1=`fslhd 3d | egrep "^pixdim1" | tr -s '\t' | cut -f 2`
got_pixdim2=`fslhd 3d | egrep "^pixdim2" | tr -s '\t' | cut -f 2`
got_pixdim3=`fslhd 3d | egrep "^pixdim3" | tr -s '\t' | cut -f 2`
got_pixdim4=`fslhd 3d | egrep "^pixdim4" | tr -s '\t' | cut -f 2`
got_originx=`fslhd 3d | egrep "^sto_xyz:1" | cut -d ' ' -f 4`
got_originy=`fslhd 3d | egrep "^sto_xyz:2" | cut -d ' ' -f 4`
got_originz=`fslhd 3d | egrep "^sto_xyz:3" | cut -d ' ' -f 4`
if neq $dim0 $got_dim0; then return 1; fi
if neq $dim1 $got_dim1; then return 1; fi
if neq $dim2 $got_dim2; then return 1; fi
if neq $dim3 $got_dim3; then return 1; fi
if neq $dim4 $got_dim4; then return 1; fi
if neq $pixdim1 $got_pixdim1; then return 1; fi
if neq $pixdim2 $got_pixdim2; then return 1; fi
if neq $pixdim3 $got_pixdim3; then return 1; fi
if neq $pixdim4 $got_pixdim4; then return 1; fi
if neq $originx $got_originx; then return 1; fi
if neq $originy $got_originy; then return 1; fi
if neq $originz $got_originz; then return 1; fi
return 0
}
fslcreatehd 5 5 5 1 0.5 1.5 1.25 1 1 2 3 2 3d.nii.gz
fslcreatehd_test 3 5 5 5 1 0.5 1.5 1.25 1 1 2 3 2 3d.nii.gz
#!/bin/bash
set -e
fslcreatehd 5 5 5 5 0.5 1.5 1.25 0.7 1.5 2.5 3.5 2 header.nii.gz
if [ `fslhd header.nii.gz | grep "pixdim1" != "
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment