diff --git a/miscmaths.h b/miscmaths.h index ab16bae50e53e3ebe7d387685f7437c358dd0585..40184ddae611af11bf01d0c7e8ea88109a78f458 100644 --- a/miscmaths.h +++ b/miscmaths.h @@ -181,6 +181,27 @@ namespace MISCMATHS { inline ReturnMatrix median(const Matrix& in){ return quantile(in,2);} inline ReturnMatrix iqr(const Matrix& in){ Matrix res = quantile(in,3) - quantile(in,1); res.Release(); return res;} +// the following give left-right order and voxel2mm coordinate conversions +// consistent with FSLView behaviour (NB: you cannot tell left-right from +// the vox2mm matrix!) + int FslGetLeftRightOrder(int sform_code, const Matrix& sform_mat, + int qform_code, const Matrix& qform_mat); + short FslGetVox2mmMatrix(Matrix& vox2mm, + int sform_code, const Matrix& sform_mat, + int qform_code, const Matrix& qform_mat, + float dx, float dy, float dz); + Matrix FslGetVox2VoxMatrix(const Matrix& flirt_in2ref, + int sform_code_in, const Matrix& sform_mat_in, + int qform_code_in, const Matrix& qform_mat_in, + float dx_in, float dy_in, float dz_in, + int nx_in, int ny_in, int nz_in, + int sform_code_ref, const Matrix& sform_mat_ref, + int qform_code_ref, const Matrix& qform_mat_ref, + float dx_ref, float dy_ref, float dz_ref, + int nx_ref, int ny_ref, int nz_ref); + mat44 newmat_to_mat44(const Matrix& inmat); + Matrix mat44_to_newmat(mat44 inmat); + void cart2sph(const ColumnVector& dir, float& th, float& ph);// cartesian to sperical polar coordinates void cart2sph(const Matrix& dir,ColumnVector& th,ColumnVector& ph);//ditto void cart2sph(const vector<ColumnVector>& dir,ColumnVector& th,ColumnVector& ph);// same but in a vector