MCPcopy Create free account
hub / github.com/AIRMEC/HECTOR / segment_tissue

Function segment_tissue

extract_features.py:129–143  ·  view source on GitHub ↗
(img)

Source from the content-addressed store, hash-verified

127 return parser
128
129def segment_tissue(img):
130 img_hsv = cv2.cvtColor(img, cv2.COLOR_RGB2HSV)
131 mthresh = 7
132 img_med = cv2.medianBlur(img_hsv[:, :, 1], mthresh)
133 _, img_prepped = cv2.threshold(img_med, 0, 255, cv2.THRESH_OTSU + cv2.THRESH_BINARY)
134
135 close = 4
136 kernel = np.ones((close, close), np.uint8)
137 img_prepped = cv2.morphologyEx(img_prepped, cv2.MORPH_CLOSE, kernel)
138
139 # Find and filter contours
140 contours, hierarchy = cv2.findContours(
141 img_prepped, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE
142 )
143 return contours, hierarchy
144
145def segment_tissue_deconv_stain(img):
146 """

Callers 1

create_tissue_maskFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected