mmkamani7/Skeletonization

The code works just for one image

Ng-ms opened this issue · 6 comments

Ng-ms commented

i tried the code with my image (512x512 ) but it did not work , what can i change to make it work for my data ?

What error do you get? If you resize your image is it working?

Ng-ms commented

ValueError Traceback (most recent call last)
in ()
1 print(mir_delD_yn.shape)
----> 2 fluxMap = flux(mir_delD_xn,mir_delD_yn)
3 plt.imshow(np.nan_to_num(fluxMap))
4 plt.title('Flux Map')
5 plt.show()

in flux(delD_xn, delD_yn)
88 nonNanPix = np.argwhere(np.invert(np.isnan(delD_xn) | np.isnan(delD_yn)))
89 for pix in nonNanPix:
---> 90 flux_x = Nx * delD_xn[pix[0] - 1:pix[0] + 2, pix[1] - 1:pix[1] + 2]
91 flux_y = Ny * delD_yn[pix[0] - 1:pix[0] + 2, pix[1] - 1:pix[1] + 2]
92 flux_x[1, 1] = np.nan

ValueError: operands could not be broadcast together with shapes (3,3) (0,0)
this is the error , i tried resize it as BW.png image but it gives the same error

It seems that your matrix delD_xn is empty. What is the results of print(mir_delD_yn.shape)?

Same issue.

How to solve it?

Same issue.

It seems that your matrix delD_xn is empty. What is the results of print(mir_delD_yn.shape)?
Check the outputs of this line to be correct and non empty:
D,IDX = morph.distance_transform_edt(BW,return_distances=True, return_indices=True)