Skip to content

Commit

Permalink
fix to LPS bug
Browse files Browse the repository at this point in the history
  • Loading branch information
frankyeh committed Aug 16, 2018
1 parent 1f2e8a2 commit 465b1c4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions io/nifti.hpp
Expand Up @@ -995,8 +995,9 @@ class nifti_base
}
handle_qform();


if(std::fabs(nif_header2.srow_x[0]) < std::fabs(nif_header2.srow_x[1]))
// swap x y
if(std::fabs(nif_header2.srow_y[1]) < std::fabs(nif_header2.srow_x[1]) &&
std::fabs(nif_header2.srow_z[1]) < std::fabs(nif_header2.srow_x[1]))
{
if(change_header)
{
Expand All @@ -1008,7 +1009,9 @@ class nifti_base
}
tipl::swap_xy(out);
}
if(std::fabs(nif_header2.srow_x[0]) < std::fabs(nif_header2.srow_x[2]))
// swap x z
if(std::fabs(nif_header2.srow_y[2]) < std::fabs(nif_header2.srow_x[2]) &&
std::fabs(nif_header2.srow_z[2]) < std::fabs(nif_header2.srow_x[2]))
{
if(change_header)
{
Expand All @@ -1020,7 +1023,9 @@ class nifti_base
}
tipl::swap_xz(out);
}
if(std::fabs(nif_header2.srow_y[1]) < std::fabs(nif_header2.srow_y[2]))
// swap y z
if(std::fabs(nif_header2.srow_x[2]) < std::fabs(nif_header2.srow_y[2]) &&
std::fabs(nif_header2.srow_z[2]) < std::fabs(nif_header2.srow_y[2]))
{
if(change_header)
{
Expand Down

0 comments on commit 465b1c4

Please sign in to comment.