コード例 #1
0
ファイル: RegionOfInterest.cs プロジェクト: yt876/rt-dtools
        /// <summary>
        /// Finds whether a point is inside the ROI, by interpolating between ROI slices
        /// Only use this if you are checking a SINGLE point, otheriwse use ContainsXYCoordsInterpolated
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <returns></returns>
        public bool ContainsPointInterpolated(double x, double y, double z)
        {
            if (!ZRange.Contains(z))
            {
                return(false);
            }

            BinaryMask mask = GetInterpolatedMask(z);

            return(mask.ContainsPoint(x, y));
        }
コード例 #2
0
ファイル: RegionOfInterest.cs プロジェクト: yt876/rt-dtools
        /// <summary>
        /// Bulk processes whether an array of x and y coords are inside the roi, with interpolation
        /// </summary>
        /// <param name="xy">Vertices accessed by (row,col) </param>
        /// <param name="z"></param>
        /// <returns></returns>
        public bool[,] ContainsXYCoordsInterpolated(double[, ][] xy, double z)
        {
            BinaryMask mask = GetInterpolatedMask(z);
            int        cols = xy.GetLength(1);
            int        rows = xy.GetLength(0);

            bool[,] pointsInside = new bool[rows, cols];
            for (int col = 0; col < cols; col++)
            {
                for (int row = 0; row < rows; row++)
                {
                    pointsInside[row, col] = mask.ContainsPoint(xy[row, col][0], xy[row, col][1]);
                }
            }
            return(pointsInside);
        }
コード例 #3
0
 public bool ContainsPoint(double x, double y)
 {
     return(BinaryMask.ContainsPoint(x, y));
 }