Exemplo n.º 1
0
        /// <summary>
        /// Gets the values of the pixels at the given positions
        /// </summary>
        /// <param name="image">The image to get the pixels from</param>
        /// <returns>An array containing the pixel values</returns>
        public ushort[] GetPixels(DICOMImage image)
        {
            Point[]       pixels      = BresenhamLine.GetLine(start, end);
            List <ushort> pixelValues = new List <ushort>();

            foreach (Point pixel in pixels)
            {
                pixelValues.Add(image.GetPixel(pixel));
            }

            return(pixelValues.ToArray());
        }
Exemplo n.º 2
0
        protected void GetMinMaxFromArea(Point center, int size, out int min, out int max)
        {
            min = image.GetPixel(center.X, center.Y);
            max = min;

            for (int i = center.X - size / 2; i < center.X + size / 2; i++)
            {
                for (int j = center.Y - size / 2; j < center.Y + size / 2; j++)
                {
                    ushort pixel = image.GetPixel(i, j);
                    if (pixel < min)
                    {
                        min = pixel;
                    }
                    else if (pixel > max)
                    {
                        max = pixel;
                    }
                }
            }
        }