-
Notifications
You must be signed in to change notification settings - Fork 75
Description
Hi,
I have been trying using the notebook to segment some thin section scans, but I could not make it work. It seems to break at the point of creating the masks using SAM. I can see an image output with some grains recognised, but this is the error message below. Possibly something I missed and not a bug? Thanks! Marco
creating masks using SAM...
100%|██████████| 1516/1516 [02:31<00:00, 9.98it/s]
finding overlapping polygons...
1451it [00:01, 726.57it/s]
finding best polygons...
100%|██████████| 555/555 [00:09<00:00, 56.12it/s]
creating labeled image...
100%|██████████| 530/530 [00:01<00:00, 360.15it/s]
IndexError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_9148\1514985980.py in
1 # SAM segmentation, using the point prompts from the Unet:
----> 2 all_grains, labels, mask_all, grain_data, fig, ax = seg.sam_segmentation(
3 sam,
4 image,
5 image_pred,
~\Dropbox\University\Frosinone\Sezioni_Sottili\segmentverygrain\segmenteverygrain-v0.2.3\segmenteverygrain\segmenteverygrain.py in sam_segmentation(sam, image, image_pred, coords, labels, min_area, plot_image, remove_edge_grains, remove_large_objects)
806 ax.imshow(image)
807 plot_image_w_colorful_grains(image, all_grains, ax, cmap="Paired")
--> 808 plot_grain_axes_and_centroids(
809 all_grains, labels, ax, linewidth=1, markersize=10
810 )
~\Dropbox\University\Frosinone\Sezioni_Sottili\segmentverygrain\segmenteverygrain-v0.2.3\segmenteverygrain\segmenteverygrain.py in plot_grain_axes_and_centroids(all_grains, labels, ax, linewidth, markersize)
1748 regions = regionprops(labels.astype("int"))
1749 for ind in range(len(all_grains) - 1):
-> 1750 y0, x0 = regions[ind].centroid
1751 orientation = regions[ind].orientation
1752 x1 = x0 + np.cos(orientation) * 0.5 * regions[ind].minor_axis_length
IndexError: list index out of range