Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dmtools/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def _continuous(image: np.ndarray, k: int) -> np.ndarray:
Returns:
np.ndarray: Continuous image with values in [0,1].
"""
# TODO: Consider changing to
# (image / (k+1)) + (1 / (2 * (k+1)))
return image / k


Expand All @@ -137,7 +139,8 @@ def _discretize(image: np.ndarray, k: int) -> np.ndarray:
Returns:
np.ndarray: Discrete image with values in [0,k].
"""
# TODO: Is this the right way to discretize?
# TODO: Consider changing to
# np.ceil(image * (k+1)).astype(int) + 1
return np.ceil(k*image - 0.5).astype(int)


Expand Down