Skip to content
Snippets Groups Projects
Commit f1ceaefb authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Handle sporadic ilastik error when patches are close in size to largest filters

parent cf3dcef4
No related branches found
No related tags found
No related merge requests found
......@@ -128,11 +128,16 @@ class IlastikPixelClassifierModel(IlastikModel, SemanticSegmentationModel):
"""
Iterative over a patch stack, call inference separately on each cropped patch
"""
from ilastik.applets.featureSelection.opFeatureSelection import FeatureSelectionConstraintError
nc = len(self.labels)
data = np.zeros((img.count, *img.hw, nc, img.nz), dtype=float) # interpret as PYXCZ
for i in range(0, img.count):
sl = img.get_slice_at(i)
data[i][sl[0], sl[1], :, sl[3]] = self.infer(img.iat(i, crop=True))[0].data
try:
data[i][sl[0], sl[1], :, sl[3]] = self.infer(img.iat(i, crop=True))[0].data
except FeatureSelectionConstraintError: # occurs occasionally on small patches
continue
return PatchStack(data), {'success': True}
def label_pixel_class(self, img: GenericImageDataAccessor, px_class: int = 0, px_prob_threshold=0.5, **kwargs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment