コード例 #1
0
ファイル: MatrixExtensions.cs プロジェクト: zzti/Evil-DICOM
 public static void DrawAllContours(this Mat mat, Point[][] ctrs, StructureLook look)
 {
     for (int i = 0; i < ctrs.Length; i++)
     {
         mat.DrawContours(ctrs, i, look.OutlineColor, look.OutlineThickness);
     }
 }
コード例 #2
0
        /// <summary>
        /// Draws the contour in patient coordinates on the slice voxels (which are voxel coordinates)
        /// </summary>
        /// <param name="structure">the structure to draw</param>
        /// <param name="z">the z slice to draw the structure</param>
        /// <returns></returns>
        public Mat DrawContourOnSlice(int z, StructureLook look)
        {
            if (!sliceZContours.Any())
            {
                ConstructStructureSlicesOnImage(_im);
            }

            var slice = _im.GetZPlaneBySlice(z);

            if (slice.Type() == MatType.CV_32FC1)
            {
                //Dose file
                double min, max;
                slice.MinMaxIdx(out min, out max);
                var wL = slice.WindowAndLevel(max * 0.95, max * 0.10);
                slice.Dispose();
                var color = wL.CvtColor(ColorConversionCodes.GRAY2RGB);
                wL.Dispose();
                slice = color;
            }

            var contours = GetContoursOnSliceZ(z);

            for (int i = 0; i < contours.Length; i++)
            {
                slice.DrawContours(contours, i, look.OutlineColor, look.OutlineThickness);
            }

            return(slice);
        }
コード例 #3
0
        /// <summary>
        /// Draws the contour in patient coordinates on the slice voxels (which are voxel coordinates)
        /// </summary>
        /// <param name="structure">the structure to draw</param>
        /// <param name="z">the z slice to draw the structure</param>
        /// <returns></returns>
        public Mat DrawContourOnSlice(Mat imSlice, int z, StructureLook look)
        {
            var contours = GetContoursOnSliceZ(z);

            for (int i = 0; i < contours.Length; i++)
            {
                imSlice.DrawContours(contours, i, look.OutlineColor, look.OutlineThickness);
            }

            return(imSlice);
        }