Example #1
0
        /// <summary>
        /// Provides the transform from
        /// </summary>
        /// <param name="gantryAngle">gantry angle in degrees (IEC)</param>
        /// <param name="collimatorAngle">collimator angle in degrees (IEC)</param>
        /// <param name="patientSupportAngle">support anlge in degrees (IEC)</param>
        /// <returns></returns>
        public static Mat BEVTransform(double gantryAngle, double collimatorAngle, double patientSupportAngle, Mat dicomToIEC)
        {
            var gantryTx = GantryTransform(gantryAngle);

            var    collTx = MatMaker.Identity(4, 4);
            double cAngle = collimatorAngle * Math.PI / 180;

            collTx.Set(0, 0, (float)Math.Cos(cAngle));
            collTx.Set(1, 0, (float)Math.Sin(cAngle));
            collTx.Set(0, 1, (float)-Math.Sin(cAngle));
            collTx.Set(1, 1, (float)Math.Cos(cAngle));

            var    supportTx = MatMaker.Identity(4, 4);
            double sAngle    = -patientSupportAngle * Math.PI / 180;

            supportTx.Set(0, 0, (float)Math.Cos(sAngle));
            supportTx.Set(1, 0, (float)Math.Sin(sAngle));
            supportTx.Set(0, 1, (float)-Math.Sin(sAngle));
            supportTx.Set(1, 1, (float)Math.Cos(sAngle));
            var step1  = (dicomToIEC * supportTx).ToMat();
            var step2  = (step1 * gantryTx).ToMat();
            var result = (step2 * collTx).ToMat();

            return(result);
        }
Example #2
0
        public static Mat GantryTransform(double gantryAngle)
        {
            var    gantryTx = MatMaker.Identity(4, 4);
            double gAngle   = gantryAngle * Math.PI / 180;

            gantryTx.Set(0, 0, (float)Math.Cos(gAngle));
            gantryTx.Set(2, 0, (float)Math.Sin(gAngle));
            gantryTx.Set(0, 2, (float)-Math.Sin(gAngle));
            gantryTx.Set(2, 2, (float)Math.Cos(gAngle));
            return(gantryTx);
        }