# Calculate middle values between two layers of voxels

This topic is 4744 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, ok the topic is maybe confusing... i have several layers with pixels (voxel) however - my layers have a pretty large gap inbetween.. Now i wanted to calculate theoretical layers between each real one. lets say layer 1 :
------
|    |
|    |
------

layer 2 :

-----------
|         |
|         |
|         |
-----------

now - the theoretical layer between 1 and 2 would be like this :

---------
|       |
|       |
|       |
---------

As you can imagine - my layers are not made of simple blocks they can have any form (shape) - i actually refering to layers of human organs - imagine a slice through an organ multiple times - but the thickness between each layer is to wide therefor my visualisation has a lot of "stairs" between each layer.. As of know - i thought getting the the maxX and maxY value from each layer but that doesnt really help me - the algorithm has to work like a circle - i.e. from the middle point give me the coord most far away where still a pixel value is (non 0) anyone could help me ?

##### Share on other sites
I've read your post 4-5 times over, and still can't quite make out what you're trying to do. :)

If you need a middle between two values, just take the average by adding and dividing by two. This works with anything -- boxes, circles, whatever. It's just how you apply it.

For example, if you need something circle based, just get the midpoint for both, determine the maximum distance from the midpoint (the radius) for both of your layers, then average the radii to create your new layer.

If you could explain again in a bit more detail, I might be able to help more.

##### Share on other sites
Hehe ok, i try to explain it in more detail.

Imagine you slice multiple times through a human organ - from top to bottom.
Now you have multiple 2D pictures, each from a different layer of the organ.
If you combine these pictures from top to bottom again - you have the whole 3D organ. (see http://www.impactscan.org/images/heart.jpg)

Now the more pictures (slices) you make (read : less gap between each slice) the more cleaner your reconstructed 3D image would be.

Here comes the problem, imagine the gab is pretty wide i.e. every second image is missing. When you put together all the images now, it looks like alot of information is missing.

Now lets go back to my problem - lets say for the sake of simplicy the slice through a heart will result in a circle or eclipse like shape (like this http://www.integrisheart.com/heart/images/contentPhotos/multiSliceCT.jpg).

The shape has a different size for each layer of the heart (at the bottom its small, in the middle highest, at the top small again).

Now, i need to find out for each layer the outa most pixels (i.e. the border pixels) - that means only the edge of my eclipse/circle - all (x,y) coordinates for each layer.

Since a slice through a human heart is not really the shape of an eclipse, i do not know how a scan algorithm could tell me the exact outmost points of the heart for each layer.

If i would have the edge pixel coordinates - i could simulate the missing layers and create middle values between the lower and upper layer

i.e. (lets say for example its just a circle).

layer 1 - the circle has the radius of 5
layer 2 is missing
layer 3 - the circle has the radius of 10

layer 2 would have the radius of 7,5 - with that i could calculate each X,Y coord from the middle point.

But - again, thats easy math for circle/eclipse values - i do not have such a shape..

I hope i made myself clear now =)

##### Share on other sites
You need to interpolate the values to generate "middle layers". It would also probably help to have a normal per voxel (this can be calculated, search for voxel normal generation or something). Using the normals you can have a better interpolation (which can also be acomplished by getting more samples for interpolation). I recommend you search for interpolation and also filtering might help out. Hope this helps,

JVFF

##### Share on other sites

Im already using normals, im using the Marching Cubes Algorithm to calculate a surface for my layers - however it looks pretty ugly if i do not have enough slices =(

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 13
• 9
• 9
• 15
• ### Forum Statistics

• Total Topics
634077
• Total Posts
3015360
×