Hi all!
I have to convert a surface model stl into a voxelized mask, with 1s inside and 0s outside. It is important that the mask has the same dimensions and voxel size as another volume I want to register with. In Matlab the available functions don’t allow to specify voxel size and this is very important for me. Getting inspired by this post: Voxelization of mesh, I follow these steps:
- Import stl and convert into segmentation node by right clicking on the model entry in the data module.
- Import the other volume, and in the volume section specify the voxel size and center it.
- Go to the transform model, and create a new transformation which moves the segmentation so that the crucial parts of it overlap the other volume. This step may not be needed.
- Go to the Segmentation Module, and select export the segmentation as a labelmap, indicating as reference volume the other one, so that the output voxelized mask has the same dimensions and voxel size.
- Then, go to the volume section, select the just created volume, and convert to scalar volume.
I’d like to know if these steps are well or if there is another way to do it better. The stl model sometimes appears to be bigger than the object in the other volume, when it shouldn’t be. And other thing: should the stl model have some basis features (i.g. closed surface, filled inside etc.)?