Help with segmentation of 3D scans of wood

Hello,

I just began using slicer 3D, it is quite powerfull tool!

I am not using it for medical application, but in material science.
I have 3D scans from wood, that I would like to segment.

when the data has been imported it looks like this:

the data is for a small hexahedral section (cubish like) of the complete scan. using the threshold i was able to differentiate the three main volumes:

nevertheless, i have some issues with the results:

  1. in reality the 3 different regions, the black/red (frist picture/3D image) envelopes the grey/yellow one, and lastly the white/green comes. this images are the result from using threshold, but it can be seen that it is far from perfect:

but i dont know if this is possible to improve while using the threshold filter, I also tried painting and grow from seeds, option but did not gave good results (actually the best results i got where from threshold). any recommendations that someone could give me in this regards?

  1. I would like to have the different regions that the common boundaries are shared, i mean, in the surfaces that the regions are touching each other that the surface is the same, is this possible?

here is the data if anyone wants to play with.

That looks quite promising. You may have a classic case for the Median Image Filter module (implements this), since you are trying to remove noise from within contiguous regions but want to maintain the sharp boundaries. Also some of the small artifacts you see are due to the sampling. Thresholding may still not completely separate the regions due to natural variations in the material,

I suggest you use Crop Volume to get a small region for testing, and you scale the spacing by .5 or even .25 and experiment with different median kernel sizes. You can also specify a higher segmentation resolution.

Regarding the second question, if i understand correctly, you can write a small python script to do this using numpy to select the indices of segmentation voxels that have label A and neighbors of label B. Then you can create a new segment from those locations. You could just brute force iterate or probably there is a way to make this efficient using numpy indexing magic.

1 Like

thanks a lot for taking the time steve!

That looks quite promising. You may have a classic case for the Median Image Filter module (implements this), since you are trying to remove noise from within contiguous regions but want to maintain the sharp boundaries.

so i should use median image filter on the data itself?

Also some of the small artifacts you see are due to the sampling.

should i re sample the data? i saw in one of the tutorial that they use crop volume to divide differently the data but:
a. the parameters on the tutorial 0:39 are quite different to the actual ones. (well it is 7 years old…)
b. this only works in coarsing the data, not refining it

I suggest you use Crop Volume to get a small region for testing, and you scale the spacing by .5 or even .25 and experiment with different median kernel sizes. You can also specify a higher segmentation resolution.

well, this comes with the b. comment on the previous quote, how can a division in spacing can improve anything (if the original one is 1, the data even if i divide it in .5 or .25 it will be the same…) sorry i am trying to understand….

Regarding the second question, if i understand correctly, you can write a small python script to do this using numpy to select the indices of segmentation voxels that have label A and neighbors of label B. Then you can create a new segment from those locations. You could just brute force iterate or probably there is a way to make this efficient using numpy indexing magic.

what i am looking to have is 3 conformal meshes (ie., that share same nodes in the zones where they have contact between one another)

i see that at least the meshes that are generated using the threshold, looks like they are ‘rounded’, for example, the data is a hexagonal shape, but when one looks at the meshes generated they are rounded in the borders…

also, is there any place for more complete tutorials than https://training.slicer.org/ ?

Yes, you should crop and upscale the resolution to get a section you can experiment with quickly and then do the median filter on the that data to make it easier to segment. Effectively you want the pixels to be much smaller than the structures you are trying to extract. For the median filter this will mean you will have more pixels within the homogeneous structures that are reddish brown in your images so you are less likely to have stray pixels leak through in the segmentation.

You will definitely need to experiment to find a good set of steps. I looked at your data and there are also some finer features of internal structure and you’ll need to decide if those are a different material class (segment) or part of one of the others. I don’t know of any tutorials specific to your case.

For the meshing you can look at the segment mesher extension and see if those will work for you. Getting a good mesh depends a lot on your purpose so the available options may or may not work for your case.