MCPcopy Create free account
hub / github.com/HiLab-git/WORD / __call__

Method __call__

scribbles_generator.py:187–210  ·  view source on GitHub ↗
(self, lab, seg_lab, iterations=1)

Source from the content-addressed store, hash-verified

185 return True
186
187 def __call__(self, lab, seg_lab, iterations=1):
188 self.previous_bifurPts = []
189 self.output = np.zeros_like(lab)
190 self.lst_output = np.zeros_like(lab)
191 components = get_largest_two_component_2D(lab, threshold=15)
192 if len(components) > 1:
193 for c in components:
194 start = self.__find_start(c)
195 self.__detect_neighbor_bifur_state(c, start)
196 else:
197 c = components[0]
198 start = self.__find_start(c)
199 self.__detect_neighbor_bifur_state(c, start)
200 self.__detect_loop_branch(self.end)
201 struct = ndimage.generate_binary_structure(2, 2)
202 output = ndimage.morphology.binary_dilation(
203 self.output, structure=struct, iterations=iterations)
204 shift_y = random.randint(-6, 6)
205 shift_x = random.randint(-6, 6)
206 if np.sum(seg_lab) > 1000:
207 output = translate_img(output.astype(np.uint8), shift_x, shift_y)
208 output = random_rotation(output)
209 output = output * seg_lab
210 return output
211
212
213def scrible_2d(label, iteration=[4, 10]):

Callers

nothing calls this directly

Calls 6

__find_startMethod · 0.95
__detect_loop_branchMethod · 0.95
translate_imgFunction · 0.85
random_rotationFunction · 0.85

Tested by

no test coverage detected