How do isosurface and isocaps affect the size of stlwrite's output?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a volume read from a DICOM, representing a femur. I made this volume binary - 1 bone, 0 background - and I tried to create the corresponding STL with stlwrite (from Exchange). I exported the STL from 3DSlicer too, to ensure the real size of the part, that must be 117.2 mm, with a possible error of about 0.8 mm
If I simply use isosurface, I get a 116.8 mm STL, but with the upper and lower face open.
So I added a background slice (all zeros) under and over my volume, to "close" the stack of slices, but in this way the output STL's size grows to 118.4, just as I have added two slices (they are 0.8 mm thick): is it correct? Shouldn't the dimensions remain the same, since I have added just background and not "material"?
So I tried to use isocaps(), and this closed my volume and leaves the size to 116.8 mm.
Beyond the size discrepancy (that may depend on an approximation done by the software). which solution is the "best" and the "less modifying" the original size?
0 commentaires
Réponses (2)
William Rose
le 26 Oct 2022
Modifié(e) : William Rose
le 26 Oct 2022
[edit : fix spelling errors]
isocaps is the way to go. Adding the background slices, even if they are zeros, still counts as material, and that is why adding the ends with isocaps increases the length by 1.6 mm = 2x0.8 = 2 slice widths. The length of 116.8 mm, which you got with isocaps, is 0.4 mm less than the real length of 117.2, and this length is within the possible error of 0.8 mm. The length with the two added slices is slightly outside the allowable error range. So I recommend isocaps.
William Rose
le 27 Oct 2022
When you say "I get a 116.8 mm STL" and "this closed my volume and leaves the size to 116.8 mm", how exactly did you obtain those lengths?
The length of 116.8 mm is not surprising with 147 slices of width 0.8. If each voxel is represented by its center location, then the distance between (center of) top and bottom voxel is (n-1)*thickness=(147-1)*0.8=116.8.
isocaps() and isosurface() have a variety of options. You can use the output from them in various ways. Therefore I suspect you will need to share some data and code to get exact answers to your questions. If you do share code, please share the simplest possible bit of code that illustrates the problem you are having.
3 commentaires
William Rose
le 27 Oct 2022
@Simone Cotta Ramusino, thank you for posting that nice short example. I'm afraid I do not have time to offer more help at the moment since I am traveling. Is there something about the output from this code which you find unsatisfactory or unexpected?
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!