Skip to content
Snippets Groups Projects
Commit 203478e6 authored by Mark Jenkinson's avatar Mark Jenkinson
Browse files

Added MJ left-right changes back

parent 7360f972
Branches MJlrfix_branch
No related tags found
No related merge requests found
......@@ -30,9 +30,6 @@ Option<bool> verbose(string("-v,--verbose"), false,
Option<bool> help(string("-h,--help"), false,
string("display this message"),
false, no_argument);
Option<bool> medxcoords(string("-m,--medx"), false,
string("use MEDx coordinate conventions"),
false, no_argument);
Option<bool> mm(string("--mm"), false,
string("use mm, not voxel, coordinates"),
false, no_argument);
......@@ -123,15 +120,6 @@ void copyconvert(const vector<triple<T> >& oldcoords,
}
template <class T, class S>
void medx2voxcoord(vector<triple<T> >& coords, const volume<S>& vol)
{
int ymax = vol.ysize();
for (unsigned int n=0; n<coords.size(); n++) {
coords[n].y = (T) (ymax - 1) - coords[n].y;
}
}
template <class S>
void vox2mmcoord(vector<triple<float> >& coords,
......@@ -143,7 +131,7 @@ void vox2mmcoord(vector<triple<float> >& coords,
cc(1) = coords[n].x;
cc(2) = coords[n].y;
cc(3) = coords[n].z;
cc = vol.sform_mat() * cc;
cc = vol.vox2mm_mat() * cc;
coords[n].x = cc(1);
coords[n].y = cc(2);
coords[n].z = cc(3);
......@@ -157,7 +145,7 @@ void applyvoxelxfm(vector<triple<T> >& coords, const Matrix& mat,
const volume<S>& source, const volume<S>& dest)
{
Matrix voxmat;
voxmat = dest.sampling_mat().i() * mat * source.sampling_mat();
voxmat = Vox2VoxMatrix(mat,source,dest);
ColumnVector vec(4);
for (unsigned int n=0; n<coords.size(); n++) {
vec << coords[n].x << coords[n].y << coords[n].z << 1.0;
......@@ -306,15 +294,10 @@ void print_results(const vector<int>& idx,
applyvoxelxfm(fcog,trans,zvol,stdvol);
if (!copename.unset()) applyvoxelxfm(fcopemaxpos,trans,zvol,stdvol);
}
if ( medxcoords.value() && (!mm.value()) ) {
medx2voxcoord(fmaxpos,zvol);
medx2voxcoord(fcog,zvol);
if (!copename.unset()) medx2voxcoord(fcopemaxpos,cope);
}
if (mm.value()) {
if ( !transformname.unset() && !stdvolname.unset() ) refvol = &stdvol;
if (verbose.value()) {
cout << "Using matrix : " << endl << refvol->sform_mat() << endl;
cout << "Using matrix : " << endl << refvol->vox2mm_mat() << endl;
}
vox2mmcoord(fmaxpos,*refvol);
vox2mmcoord(fcog,*refvol);
......@@ -413,8 +396,6 @@ void print_results(const vector<int>& idx,
if ( !transformname.unset() && !stdvolname.unset() )
applyvoxelxfm(lmaxlistR,trans,zvol,stdvol);
if ( medxcoords.value() && (!mm.value()) )
medx2voxcoord(lmaxlistR,zvol);
if (mm.value()) {
vox2mmcoord(lmaxlistR,*refvol);
}
......@@ -584,7 +565,6 @@ int main(int argc,char *argv[])
options.add(dLh);
options.add(fractional);
options.add(numconnected);
options.add(medxcoords);
options.add(mm);
options.add(minv);
options.add(no_table);
......
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