Exemple #1
0
        // watershed.c (1034, 1)
        // wshedBasins(wshed, ppixa, pnalevels) as int
        // wshedBasins(L_WSHED *, PIXA **, NUMA **) as l_ok
        ///  <summary>
        /// wshedBasins()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/wshedBasins/*"/>
        ///  <param name="wshed">[in] - </param>
        ///  <param name="ppixa">[out][optional] - mask of watershed basins</param>
        ///  <param name="pnalevels">[out][optional] - watershed levels</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int wshedBasins(
            L_WShed wshed,
            out Pixa ppixa,
            out Numa pnalevels)
        {
            if (wshed == null)
            {
                throw new ArgumentNullException("wshed cannot be Nothing");
            }

            IntPtr ppixaPtr     = IntPtr.Zero;
            IntPtr pnalevelsPtr = IntPtr.Zero;
            int    _Result      = Natives.wshedBasins(wshed.Pointer, out ppixaPtr, out pnalevelsPtr);

            if (ppixaPtr == IntPtr.Zero)
            {
                ppixa = null;
            }
            else
            {
                ppixa = new Pixa(ppixaPtr);
            };
            if (pnalevelsPtr == IntPtr.Zero)
            {
                pnalevels = null;
            }
            else
            {
                pnalevels = new Numa(pnalevelsPtr);
            };

            return(_Result);
        }
Exemple #2
0
        // watershed.c (305, 1)
        // wshedApply(wshed) as int
        // wshedApply(L_WSHED *) as l_ok
        ///  <summary>
        /// wshedApply()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/wshedApply/*"/>
        ///  <param name="wshed">[in] - generated from wshedCreate()</param>
        ///   <returns>0 if OK, 1 on error Iportant note: 1 This is buggy.  It seems to locate watersheds that are duplicates.  The watershed extraction after complete fill grabs some regions belonging to existing watersheds. See prog/watershedtest.c for testing.</returns>
        public static int wshedApply(
            L_WShed wshed)
        {
            if (wshed == null)
            {
                throw new ArgumentNullException("wshed cannot be Nothing");
            }

            int _Result = Natives.wshedApply(wshed.Pointer);

            return(_Result);
        }
Exemple #3
0
        // watershed.c (1094, 1)
        // wshedRenderColors(wshed) as Pix
        // wshedRenderColors(L_WSHED *) as PIX *
        ///  <summary>
        /// wshedRenderColors()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/wshedRenderColors/*"/>
        ///  <param name="wshed">[in] - </param>
        ///   <returns>pixd initial image with all basins filled, or NULL on error</returns>
        public static Pix wshedRenderColors(
            L_WShed wshed)
        {
            if (wshed == null)
            {
                throw new ArgumentNullException("wshed cannot be Nothing");
            }

            IntPtr _Result = Natives.wshedRenderColors(wshed.Pointer);

            if (_Result == IntPtr.Zero)
            {
                return(null);
            }

            return(new Pix(_Result));
        }
Exemple #4
0
        // watershed.c (250, 1)
        // wshedDestroy(pwshed) as Object
        // wshedDestroy(L_WSHED **) as void
        ///  <summary>
        /// wshedDestroy()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/wshedDestroy/*"/>
        ///  <param name="pwshed">[in,out] - will be set to null before returning</param>
        public static void wshedDestroy(
            ref L_WShed pwshed)
        {
            IntPtr pwshedPtr = IntPtr.Zero;         if (pwshed != null)

            {
                pwshedPtr = pwshed.Pointer;
            }

            Natives.wshedDestroy(ref pwshedPtr);
            if (pwshedPtr == IntPtr.Zero)
            {
                pwshed = null;
            }
            else
            {
                pwshed = new L_WShed(pwshedPtr);
            };
        }