Пример #1
0
        /// <summary>
        /// Only allow an epsilon away from true axial, insist on square pixels.
        /// </summary>
        /// <param name="sopClassUid"></param>
        /// <param name="volumeOrigin"></param>
        /// <param name="iop"></param>
        /// <param name="voxelDims"></param>
        /// <returns></returns>
        public bool Propose(DicomUID sopClassUid, Point3D volumeOrigin, Matrix3 iop, Point3D voxelDims, out string reason)
        {
            // Restrict to MaxAngleFromAxialInRadians from True Axial.
            Point3D xAxis = new Point3D(1, 0, 0);
            Point3D yAxis = new Point3D(0, 1, 0);
            Point3D zAxis = new Point3D(0, 0, 1);

            var minCosine = Math.Cos(MaxAngleFromAxialInRadians);

            var xAxisT = iop * xAxis;
            var yAxisT = iop * yAxis;
            var zAxisT = iop * zAxis;

            var isWithinAngle    = Point3D.DotProd(xAxis, xAxisT) >= minCosine && Point3D.DotProd(yAxis, yAxisT) >= minCosine && Point3D.DotProd(zAxis, zAxisT) >= minCosine;
            var isPixelIsotropic = voxelDims[0] == voxelDims[1];

            if (!isWithinAngle)
            {
                reason = NonAxialMessage;
                return(false);
            }
            else
            if (!isPixelIsotropic)
            {
                reason = NonSquarePixelMessage;
                return(false);
            }
            reason = string.Empty;
            return(true);
        }
Пример #2
0
 /// <summary>
 /// Gets the slice position from the image orientation to patient matrix direction and origin.
 /// </summary>
 /// <param name="direction">The image orientation to patient matrix.</param>
 /// <param name="origin">The origin 3-dimensional point.</param>
 /// <returns>The position of the slice.</returns>
 private static double GetSlicePosition(Matrix3 direction, Point3D origin)
 => Point3D.DotProd(direction.Column(2), origin);