[Scipy-svn] r4065 - trunk/scipy/ndimage/src/segment

scipy-svn@scip... scipy-svn@scip...
Tue Apr 1 16:04:10 CDT 2008


Author: tom.waite
Date: 2008-04-01 16:04:08 -0500 (Tue, 01 Apr 2008)
New Revision: 4065

Modified:
   trunk/scipy/ndimage/src/segment/Segmenter_EXT.c
Log:
Added support for 3D blob extraction and improve the current 2D blob.


Modified: trunk/scipy/ndimage/src/segment/Segmenter_EXT.c
===================================================================
--- trunk/scipy/ndimage/src/segment/Segmenter_EXT.c	2008-04-01 21:03:45 UTC (rev 4064)
+++ trunk/scipy/ndimage/src/segment/Segmenter_EXT.c	2008-04-01 21:04:08 UTC (rev 4065)
@@ -140,6 +140,7 @@
     int num;
     int nd;
     int type;
+    int mask;
     npy_intp *dims;
     unsigned short *fP1;
     unsigned short *fP2;
@@ -147,7 +148,7 @@
     PyObject *iArray = NULL;
     PyObject *eArray = NULL;
 
-    if(!PyArg_ParseTuple(args, "OO", &iArray, &eArray))
+    if(!PyArg_ParseTuple(args, "OOi", &iArray, &eArray, &mask))
 	    goto exit;
 
     fP1  = (unsigned short *)PyArray_DATA(iArray);
@@ -161,8 +162,15 @@
 	    goto exit;
 
     
-    if(!NI_GetBlobs(num, (int)dims[0], (int)dims[1], fP1, fP2, &groups))
+    if(nd == 2){ 
+        if(!NI_GetBlobs2D(num, (int)dims[0], (int)dims[1], fP1, fP2, &groups, mask))
 	    goto exit;
+    }
+    else if(nd == 3){ 
+        if(!NI_GetBlobs3D(num, (int)dims[0], (int)dims[1], (int)dims[2], fP1, fP2, 
+			  &groups, mask))
+	    goto exit;
+    }
 
 exit:
 
@@ -207,6 +215,9 @@
     objNumber = PyArray_DIMS(nArray); // this is the number of labels in the edge image
     myData = (objStruct*)PyArray_DATA(nArray);
 
+    /* need to pass in 2D/3D flag and mask. NI_GetBlobRegions will call
+     * 2D or 3D blob_extraction  */
+
     if(!NI_GetBlobRegions((int)dims[0], (int)dims[1], (int)objNumber[0], fP1, myData))
 	    goto exit;
 



More information about the Scipy-svn mailing list