GithubHelp home page GithubHelp logo

sebastianandress / slicer-surfacewrapsolidify Goto Github PK

View Code? Open in Web Editor NEW
25.0 1.0 6.0 32.74 MB

3D Slicer extension which contains a Segment Editor Effect that solidifies and extracts the surface of a segmentation

License: Other

CMake 4.29% Python 95.71%
3d-slicer-extension

slicer-surfacewrapsolidify's Introduction

Header

Surface Wrap Solidify

This module for 3D Slicer that can fill in internal holes in a segmented image region or retrieve the largest cavity inside a segmentation.

Copyright © 2020, Sebastian Andreß
All rights reserved. Please find the license here.

Please cite the corresponding paper when using this filter for publications:

@article{3DPrintWrapSolidify,
    author      = {Weidert, Simon and Andress, Sebastian and Linhart, Christoph and Suero, Eduardo M. and Greiner, Axel and Böcker, Wolfgang and Kammerlander, Christian and Becker, Christopher A.},
    title       = {3D printing method for next-day acetabular fracture surgery using a surface filtering pipeline: feasibility and 1-year clinical results},
    journal     = {International Journal of Computer Assisted Radiology and Surgery},
    publisher   = {Springer},
    date        = {2020-01-02},
}

Introduction

This segmentation tool was designed for creating fractured bone models for fast 3D printing. Especially in orthopedic trauma surgery, the editing time, as well as the printing time should be as short as possible. Using this effect helps to fulfil both features. Also, by removing inner cancellous structures, it is possible to achieve a fracture reduction on the printed model.

In our use-case, we used this effect after applying a simple threshold operation and separating the bone with simple brushing and island techniques. See the workflow example videos. The effect was tested on more than 30 acetabular fracture models, it reduced the printing time about 70%.

While the segmentation tool was originally designed for 3D printing fractured bone models, it has proven to be effective in a wide range of other applications that require removing or segmenting internal holes in a segment.

Screenshot

How to install

How to use

  • Load an image. Example images are available in Sample data module.
  • Use Segment Editor module to create an initial segmentation.
    • For example use Threshold effect, set the level between 300 and the maximal Hounsfield Unit. By using the sphere brush, first erase the femoral head, and subsequently connecting parts in the sacroiliac joint. Using the Islands effect, the exempted hemipelvis was added to a separate segment.

Threshold Video Preview Image

  • Go to Wrap Solidify effect and adjust options as needed.
    • For example, to create fast printable bones, preserving surface cracks: enable Carve holes, enable Create shell (to save material in 3D printing and be able to preserve surface cracks), select model for output to preserve maximum details (and to be able to save the output directly as a 3D-printable STL file).
  • Click Apply. Processing should be completed within about a minute.
    • For example, for the inputs described above, the processing time was 1:46 min on a Apple MacBook Pro 2017 (3.1 GHz Intel Core i7 CPU, 16 GB RAM).
  • Use menu: File / Save Data (or go to Data module, right-click the output model, and choose Export to file...) to save the output model to 3D-printable STL file

Processing Video Preview Image

Example processing result:

Results Image

Processing parameters

  • Region
    • Outer surface: Fill internal holes in a segment.
      • Carve holes can be enabled to preserve surface concavities. Concavities that have smaller opening than the specified diameter value are filled in the output segment. Opening refers to the diameter of the narrowest region that separates the cavity from the region outside the segment.
        • Example: Internal holes that have no connection to outside the segment (A) are always filled. Cavities that have a narrow connection to outside (B and C) are filled if the opening is smaller than the specified diameter value. B has smaller opening (about 5mm) then C (about 30mm), therefore B is filled when a smaller diameter value (10mm) is specified.

  • Largest cavity: return the largest internal cavity within a segment.
    • Split cavities can be enabled to ignore small cavities connected to the main one. Cavities that have smaller opening than the specified diameter value are removed from the output segment. Opening refers to the diameter of the narrowest region that separates the cavity from the main one.
      • Example: Largest cavity is the connected A+B+C cavity. Region B is connected to A with a narrowing of about 10mm. Region C is connected to A with a narrowing of about 7mm.

  • Custom: Specify a custom initial shape for the surface wrapping. In masking section Modify other segments must be set to Allow overlap to allow the initial segment to overlap with the input segment.
    • In the segment list at the top: select the segment that the resulting segmentation will be snapped to. (green in the example below)
    • In the segment selector next to the "custom" option, select the initial shape that will be warped. (yellow in the example below)

  • Create shell: If enabled then a thin shell is created from the segment.
    • Preserve surface cracks makes surface cracks in the input segment preserved in the output.
    • Offset direction determines if the original surface should be used as inner or outer surface of the created shell.
    • Output shell thickness specifies the distance between the inner and outer wall of the shell.
  • Output: Selects where to store the created new surface or segment. If the model option is chosen then the surface mesh is not rasterized into a binary labelmap, therefore more details may be preserved.
  • Advanced options
    • Smoothing factor: Specifies smoothing between iterations. Higher value makes the output smoother, removing small surface irregularities and sharp edges.
    • Oversampling: Specifies resolution during internal remeshing. Higher value results in higher accuracy but longer computation time. Increase this value up to 2-4x if output does not follow the input segmentation accurately enough.
    • Number of iterations specifies nunber of internal iterations to converge the initial surface to the final surface. Increase the number of iterations to 10-15 if artifacts appear in the output or output is not accurate enough even though a high oversampling value is used. Increasing the value increases the computation time.
    • Save intermediate results: Saves all intermediate results during processing. It can be useful for troubleshooting (understanding why the results are not as expected) or understanding what the algorithm does internally.

How it works

The algorithm was modified compared to the originally published method, to make it more robust, faster, and reduce the number of parameters that users must specify. The algorithm was also extended to be able to get cavities (internal surfaces) in a segmentation.

The Wrap Solidify Effect internally performs the following operations:

  1. A surface representation of the selected segment is created (segmented model).
    • Smoothing Factor defines smoothing of the input surface representation
  2. Initial surface is generated:
    • For outer surface extraction: A larger model is created around the input segmentation. The model is a large enclosing sphere if carve holes is disabled, otherwise a margin growing result.
    • For largest cavity extraction: A larger model is created around the input segmentation, it is inverted, shrunk by the value specified in split cavities, and the largest segment is preserved.
  3. Shrinkwrapping (iteratively shrinking and uniformly remeshing the sphere model to the segmented model) is used for surface definition.
    • Number of iterations is used to define the number of iterations. The algorithm is more robust but it takes longer if many small iterations are performed.
    • Smoothing Factor specifies strength of the filter that performs surface smoothing constrained to the original input surface.
    • Oversampling is used to define resolution of remesh. Higher value results in higher accuracy but longer computation time.
  4. If create shell is enabled then a thin shell is created from the segment by extruding the surface in normal direction by Output shell thickness. If preserve surface cracks option is enabled: all vertices of the surface model that are not touching the segmented model are deleted before extruding.
  5. If output is segmentation: The resulting surface model is converted into a segmentation by rasterizing the closed surface into a binary labelmap.

Acknowledgments

Thanks a lot to Andras Lasso for also contributing and improving the module.

Contact information

For further collaborations, patient studies or any help, do not hesitate to contact Sebastian Andreß.

slicer-surfacewrapsolidify's People

Contributors

lassoan avatar mauigna06 avatar sebastianandress avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

slicer-surfacewrapsolidify's Issues

Previous Git history availability

Do you happen to have the previous history available ?

If yes, could you push it in a different repo ? We could then clean it up by removing the large file with the help of git filtering.

Rational: Working on integrating the effect in a custom application, this would be help to address potential issues.

Cc: @allemangD @lassoan

Python API

Hi
Thank you for this great extension.
I am using this extension on 3d slicer for CT brain extraction. I am using the same parameters for each data. I want to use the same functionality on python so I can loop over all the samples in the data. Is it possible to use this extension on python like API?

Correct radius for starting sphere?

The multiplier is currently 1.5:

# to make sure the volume is fully included in the sphere, radius must be sqrt(2) times larger
sphereSource.SetRadius(maxRadius*1.5)

But according to this link:
https://math.stackexchange.com/questions/2423669/sphere-and-inscribed-cube

I'm thinking the multiplier should be larger than sqrt(3), for example:

 # to make sure the volume is fully included in the sphere, radius must be sqrt(3) times larger 
 sphereSource.SetRadius(maxRadius*1.75) 

[Feature request] Apply to all segments

Hi,

It would be great if an operation (e.g. outer surface) could be applied to all visible segments by having a checkbox named "Apply to all segments" (the same as Smoothing).

Slicer 3D plugin error

Hello,I would like to congratulate you on your great work! I installed the plugin at my slicer 3d, however, I have a problem during segmentation it throws me this error when try to send Image:

[FD] INFO: Started server process [15196]
[FD] INFO: Waiting for application startup.
[FD] INFO: Application startup complete.
[FD] ERROR: [Errno 10048] error while attempting to bind on address ('0.0.0.0', 5555): only one usage of e
ach socket address (protocol/network address/port) is normally permitted
[FD] INFO: Waiting for application shutdown.
[FD] INFO: Application shutdown complete.

how can it be solved ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.