Skip to content

Instantly share code, notes, and snippets.

@jefferis
Created November 25, 2013 00:59
Show Gist options
  • Save jefferis/7634686 to your computer and use it in GitHub Desktop.
Save jefferis/7634686 to your computer and use it in GitHub Desktop.
Test possible round trip bug in CMTK Compose/Decompose methods exposed by dof2mat/mat2dof
#!/usr/bin/env bash
# The idea of this script is to do a round trip test on a CMTK affine
# registration using the dof2mat/mat2dof tools
mkdir -p testinit.list
cat <<EOF > testinit.list/registration
! TYPEDSTREAM 1.1
registration {
reference_study "reference"
floating_study "floating"
affine_xform {
xlate 100 50 50
rotate 3 3 3
scale 1 1.1 1.1
shear 0 0 0
center 0 0 0
}
}
EOF
cat <<EOF > testinit.list/studylist
! TYPEDSTREAM 1.1
source {
studyname "reference"
}
source {
studyname "floating"
}
EOF
# Set if required
# CMTKBIN="../core/build24v2/bin/"
DOF2MAT="${CMTKBIN}dof2mat"
MAT2DOF="${CMTKBIN}mat2dof"
# note that --transpose is required which always strikes me as a bit odd ...
$DOF2MAT --transpose testinit.list > testinit.mat
$DOF2MAT --transpose testinit.list | $MAT2DOF --list testroundtrip.list
gunzip -f testroundtrip.list/registration.gz
diff testinit.list testroundtrip.list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment