-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
exposes agglomeration routine to python
- Loading branch information
Stephen Plaza
committed
Nov 20, 2015
1 parent
e87c855
commit dc3c5c2
Showing
3 changed files
with
90 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import sys | ||
import h5py | ||
import numpy | ||
|
||
segh5 = sys.argv[1] | ||
predh5 = sys.argv[2] | ||
classifier = sys.argv[3] | ||
threshold = float(sys.argv[4]) | ||
|
||
from neuroproof import Agglomeration | ||
|
||
# open as uint32 and float respectively | ||
seg = numpy.array(h5py.File(segh5)['stack'], numpy.uint32) | ||
pred = numpy.array(h5py.File(predh5)['volume/predictions'], numpy.float32) | ||
|
||
pred = pred.transpose((2,1,0,3)) | ||
pred = pred.copy() | ||
|
||
res = Agglomeration.agglomerate(seg, pred, classifier, threshold) | ||
|
||
# should be 232 unique labels (including 0) in the resulting segmentation | ||
if len(numpy.unique(res)) != 232: | ||
exit(1) | ||
|
||
print "SUCCESS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters