0

So I have a 3d tif pixel image and want to draw a 3d drape over the non_zero non_null pixels

At first I worked in a 2d manner and passed on every slice and tried to draw a shape around and then plot them to form a 3d shape but it doesnt seem to work out

I tried the 3d suite in fiji using 3D drawing ROIs but it only drew a fixed 2d circle on every slice

Ali_Nass
  • 838
  • 1
  • 9
  • 27
  • Can you clarify what you you mean by a 3d tif pixel image? Can you link to an example? When you say draw a 3D drape, do you mean [spatial interpolation?](https://www.joesadow.com/interestingmath/2018/6/9/spatial-interpolation-kriging-and-radial-basis-functions) – Allan Cameron Aug 17 '23 at 15:14
  • @AllanCameron the positive pixels represent the existence of a cell, https://imgur.com/a/eWPmTf0 this is a 3d representation (i plotted it using mayavi). Basically I want to draw a 3D drape so later on I run some clustering algos, because if I run it now it will look clustered for sure – Ali_Nass Aug 18 '23 at 11:19
  • @AllanCameron I answered the question in case you have some comments about that – Ali_Nass Aug 25 '23 at 21:27

1 Answers1

0

I built a convexHull with the help of this answer which fit what I was looking for

hull = ConvexHull(data)

fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")

# Plot defining corner points
ax.plot(data.T[0], data.T[1], data.T[2], "ko")

# 12 = 2 * 6 faces are the simplices (2 simplices per square face)
for s in hull.simplices:
    s = np.append(s, s[0])  # Here we cycle back to the first coordinate
    ax.plot(data[s, 0], data[s, 1], data[s, 2], "r-")

# Make axis label
for i in ["x", "y", "z"]:
    eval("ax.set_{:s}label('{:s}')".format(i, i))

plt.show()
Ali_Nass
  • 838
  • 1
  • 9
  • 27