Skip to content

Commit

Permalink
#193 - Changed the method to find the centroids
Browse files Browse the repository at this point in the history
The centroids are now calculated with the myelin array rather than the axon array when trying to fill the axons.
  • Loading branch information
Stoyan-I-A committed Mar 25, 2019
1 parent fe61ee6 commit 20e1176
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ads_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ def onFillAxons_button(self, event):
myelinArray = myelinMaskOverlay[:, :, 0]

# Get the centroid indexes
watershedData, centroidIndexMap = self.getWatershedSegmentation(axonArray, myelinArray, returnCentroids=True)
del watershedData
centroidIndexMap = self.getMyelinCentroids(myelinArray)


# # Crate an RGB array for the myelin image. The floodfill only uses RBG images.
# arrayShape = [myelinArray.shape[0], myelinArray.shape[1]]
Expand All @@ -290,6 +290,16 @@ def onFillAxons_button(self, event):
self.overlayList.append(axonMaskOverlay)


def getMyelinCentroids(self, im_myelin):
# Label each myelin object
im_myelin_label = measure.label(im_myelin)
# Find the centroids of the myelin objects
myelin_objects = measure.regionprops(im_myelin_label)
ind_centroid = ([int(props.centroid[0]) for props in myelin_objects],
[int(props.centroid[1]) for props in myelin_objects])
return ind_centroid



def getWatershedSegmentation(self, im_axon, im_myelin, returnCentroids=False):
"""
Expand Down Expand Up @@ -390,3 +400,4 @@ def getLogo(self):
def supportedViews():
from fsleyes.views.orthopanel import OrthoPanel
return [OrthoPanel]

0 comments on commit 20e1176

Please sign in to comment.