Mercurial > hg > orthanc-stone
diff OrthancStone/Sources/Toolbox/CoordinateSystem3D.cpp @ 1717:391c798e4dae
fix for KNIX sample dataset
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 01 Dec 2020 10:08:26 +0100 |
parents | af312e145980 |
children | 9ac2a65d4172 |
line wrap: on
line diff
--- a/OrthancStone/Sources/Toolbox/CoordinateSystem3D.cpp Tue Dec 01 08:58:53 2020 +0100 +++ b/OrthancStone/Sources/Toolbox/CoordinateSystem3D.cpp Tue Dec 01 10:08:26 2020 +0100 @@ -33,24 +33,32 @@ { void CoordinateSystem3D::CheckAndComputeNormal() { - // DICOM expects normal vectors to define the axes: "The row and - // column direction cosine vectors shall be normal, i.e., the dot - // product of each direction cosine vector with itself shall be - // unity." - // http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.6.2.html + /** + * DICOM expects normal vectors to define the axes: "The row and + * column direction cosine vectors shall be normal, i.e., the dot + * product of each direction cosine vector with itself shall be + * unity." + * http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.6.2.html + **/ if (!LinearAlgebra::IsNear(boost::numeric::ublas::norm_2(axisX_), 1.0) || !LinearAlgebra::IsNear(boost::numeric::ublas::norm_2(axisY_), 1.0)) { LOG(WARNING) << "Invalid 3D geometry: Axes are not normal vectors"; SetupCanonical(); } - - // The vectors within "Image Orientation Patient" must be - // orthogonal, according to the DICOM specification: "The row and - // column direction cosine vectors shall be orthogonal, i.e., - // their dot product shall be zero." - // http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.6.2.html - else if (!LinearAlgebra::IsCloseToZero(boost::numeric::ublas::inner_prod(axisX_, axisY_))) + + /** + * The vectors within "Image Orientation Patient" must be + * orthogonal, according to the DICOM specification: "The row and + * column direction cosine vectors shall be orthogonal, i.e., + * their dot product shall be zero." + * http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.6.2.html + * + * The "0.00001" threshold is needed for KNIX (on this sample + * image, the inner product equals "0.000003", which is rejected + * by "LinearAlgebra::IsCloseToZero()"). + **/ + else if (!LinearAlgebra::IsNear(0, boost::numeric::ublas::inner_prod(axisX_, axisY_), 0.00001)) { LOG(WARNING) << "Invalid 3D geometry: Image orientation patient is not orthogonal"; SetupCanonical();