Extract systematic volumes, quantify their and export their stl models

Hi there!

I am currently working on a volume and need to slice it into subvolumes (smaller, i.e., Rubik’s Cube), quantify each subvolume, and export it as a .stl model. I need also to increase/decrease the number of subvolumes each time. Is there any way to do this on 3D Slicer with less time and effort?

Thank you in advance

Abdullah

I managed to slice my volume into 623 stacked tiffs (cubes). I need to know how to automatically segment each file and export it as .obj file. This is going to help in reducing the time and effort. I appreciate any help from you.

I will share everything related to this topic later on.

Thanks in advance
AA

Sure, you can do that if you piece together examples from the Script Repository.

https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#how-to-run-segment-editor-effects-from-a-script

https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#export-model-nodes-from-segmentation-node

Many thanks, @pieper
I think that I have a problem with the scripts. I need to know how to load my multiple-stack tiff files (as a batch) and how to use these scripts :sweat_smile:.

Any advice is highly appreciated!

I think the best advice would be to try some of the programming tutorials. It takes some practice to learn how the scripts work but once you have the hang of it they script repository is a goldmine of useful tricks to automate everything in the application. For tiff stacks you might look at the ImageStacks module and code in the SlicerMorph extension.

https://www.slicer.org/wiki/Documentation/4.10/Training#Tutorials_for_software_developers

Hi @pieper
Thank you so much for your reply.
I tried to go through the documentation before posting this topic, but I realized that is so long way to do. Running the files one by one would be faster than learning without a guide. What I really need is just to repeat the steps giving below on all the samples showing in the picture.

The steps include:
1- segmenting white and black features
2- exploring STL files
3- taking the volume data of each segment.

Do you want really want to split the volume to slices and export each slice into a separate STL file? That does not sound right. What is your end goal? What images are you working with? What analysis would you like to do? What do you plan to do with the hundreds of STL files?

If you just want to compute cross-sectional areas along a vessel then you can find several modules for that in VMTK extension.

Do you want really want to split the volume to slices and export each slice into a separate STL file? That does not sound right.

I have already separated volumes and would like to quantify and export STL files.

What is your end goal? What images are you working with? What analysis would you like to do? What do you plan to do with the hundreds of STL files?

We are conducting qualitative and quantitative analyses of burrows on 632 cubes. Burrows have already been segmented in another software (binary tiff files) and we need to segment and quantify burrows and the surrounding materials in the 3D slicer. For the STL, we need to for qualitative analysis. The whole thing is a part of the research we are doing to investigate burrow quantification.

Thank you

Could you tell a bit more about what kind of burrows are you analyzing? Could you post a few typical images? It is important for us to understand your end goal, because without that we can only offer help to solve small subproblems that you identify, which often end up being irrelevant because it turns out there is a different, better overall approach.

I have already separated volumes and would like to quantify and export STL files.

Do you have many small 3D cubic structures and you want to export each as a separate STL file? Or you want to export slice by slice?

Doing quantitative analysis on surface meshes is generally much more difficult than on labelmaps. What kind of analysis would you like to do? Is there any metric that you need to compute and not already provided by Segment Statistics module? What software do you plan to use for analyzing the segmented structures?

Hi @lassoan

Thank you so much for your reply. Please check the attached image to see what I am talking about.
We know exactly what we are doing, but we need to accelerate the process of volume quantification. In other words, how to repeat the steps given below to be automatically applied on all the other samples? if that is not possible in the 3D slicer, I have to find another software or do it one by one in the 3D slicer


.

The steps include:
1- segmenting white and black features
2- exploring STL files
3- taking the volume data of each segment

Thank you

Is this a picture of one cube? Do you have a large volume that contains 632 of these cubes? Or does this cube contain 632 small islands?

Are the STL files that you want to export flat (each one is created from a single slice) or a 3D blob, or a tree structure?

How do you plan to quantify the STL files? What metrics do you need to compute?

Slicer is designed to be extremely flexible, it bundles a couple of very powerful libraries, and you can install any of the hundreds of thousands of Python packages from PyPI, so it is very likely that you can implement your entire analysis in Slicer/Python.

The picture is for one cube (one sample) after I segmented, and generated it through the 3D slicer. Therefore, it was a tiff stack file and it was generated to STL from each cube (tiff stacked file) after running the Segment Statistics module.

so it is very likely that you can implement your entire analysis in Slicer/Python.

Yes, exactly! This is why I am here.

Although I read many ppt files in the documentation, still I don’t know how to load the stack tiff files, process them and export the data.

  • You can load a TIFF stack the same way as the PNG stack is loaded in this example. If the TIFF stack contains a binary labelmap then set {"singleFile": False, "labelmap": True} options.
  • Set spacing (voxel size) of the volume using SetSpacing
  • Import the labelmap volume to segmentation as shown here.
  • Quantify segmentation as shown here.
  • Export model segmentation to model node should not be necessary because you can do all quantifications in using existing Slicer modules and Python scripting. If you want to export STL files anyway then:
    • Export segmentation to model node as shown in this example.
    • Save model node to file as shown here.