Skip to content

Commit

Permalink
Revert "Make extraction of the largest connected component optional (#…
Browse files Browse the repository at this point in the history
…305)"

This reverts commit 3ab0655.
  • Loading branch information
eigenvivek committed Jul 15, 2024
1 parent f773567 commit 527ef53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions diffdrr/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ def drr_to_mesh(
subject: Subject, # torchio.Subject with a `volume` attribute
method: str, # Either `surface_nets` or `marching_cubes`
threshold: float = 150, # Min value for marching cubes (Hounsfield units)
extract_largest: bool = True, # Extract the largest connected component from the mesh
verbose: bool = True, # Display progress bars for mesh processing steps
):
"""
Expand All @@ -191,7 +190,7 @@ def drr_to_mesh(
The mesh processing steps are:
1. Keep only largest connected components (optional)
1. Keep only largest connected components
2. Smooth
3. Decimate (if `method=="marching_cubes"`)
4. Fill any holes
Expand Down Expand Up @@ -230,8 +229,7 @@ def drr_to_mesh(
mesh = mesh.transform(subject.volume.affine.squeeze())

# Preprocess the mesh
if extract_largest:
mesh.extract_largest(inplace=True, progress_bar=verbose)
mesh.extract_largest(inplace=True, progress_bar=verbose)
mesh.point_data.clear()
mesh.cell_data.clear()
mesh.smooth_taubin(
Expand Down
6 changes: 2 additions & 4 deletions notebooks/api/04_visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@
" subject: Subject, # torchio.Subject with a `volume` attribute\n",
" method: str, # Either `surface_nets` or `marching_cubes`\n",
" threshold: float = 150, # Min value for marching cubes (Hounsfield units)\n",
" extract_largest: bool = True, # Extract the largest connected component from the mesh\n",
" verbose: bool = True, # Display progress bars for mesh processing steps\n",
"):\n",
" \"\"\"\n",
Expand All @@ -296,7 +295,7 @@
"\n",
" The mesh processing steps are:\n",
"\n",
" 1. Keep only largest connected components (optional)\n",
" 1. Keep only largest connected components\n",
" 2. Smooth\n",
" 3. Decimate (if `method==\"marching_cubes\"`)\n",
" 4. Fill any holes\n",
Expand Down Expand Up @@ -335,8 +334,7 @@
" mesh = mesh.transform(subject.volume.affine.squeeze())\n",
"\n",
" # Preprocess the mesh\n",
" if extract_largest:\n",
" mesh.extract_largest(inplace=True, progress_bar=verbose)\n",
" mesh.extract_largest(inplace=True, progress_bar=verbose)\n",
" mesh.point_data.clear()\n",
" mesh.cell_data.clear()\n",
" mesh.smooth_taubin(\n",
Expand Down

0 comments on commit 527ef53

Please sign in to comment.