Skip to content

Commit

Permalink
Added docstrings for several functions
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewHerzing committed Jun 28, 2024
1 parent 27bfbcf commit 0b535df
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
5 changes: 1 addition & 4 deletions tomotools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,7 @@ class TomoStack(CommonStack):
"""

def plot_sinos(self, *args, **kwargs):
"""
Plot the TomoStack in sinogram orientation.
"""
"""Plot the TomoStack in sinogram orientation."""
self.swap_axes(1, 0).swap_axes(1, 2).plot(navigator='slider', *args, **kwargs)
return

Expand Down
32 changes: 32 additions & 0 deletions tomotools/recon.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,44 @@ def run(stack, method, niterations=20, constrain=None, thresh=0, cuda=None, thic


def dart_segment(rec, thresholds, gray_vals):
"""
Segmentation step for DART Reconstruction.
Args
----------
rec : NumPy array
Tomographic reconstruction.
thresholds : list or NumPy array
Threshold values for segmentation.
gray_vals : list or NumPy array
Grayscale values to assign the segmented regions.
Returns
----------
segmented : NumPy array
Segmented version of the reconstruction.
"""
bins = np.digitize(rec, bins=thresholds, right=False)
segmented = np.array(gray_vals)[bins]
return segmented


def get_dart_boundaries(segmented):
"""
Boundary step for DART Reconstruction.
Args
----------
segmented : NumPy array
Segmented reconstruction.
Returns
----------
boundaries : NumPy array
Boundaries of the segmented reconstruction.
"""
kernel = np.array([[1, 1, 1],
[1, -8, 1],
[1, 1, 1]])
Expand Down

0 comments on commit 0b535df

Please sign in to comment.