Skip to content

Commit

Permalink
refactor(transforms): fix typo in variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
yzx9 committed Jun 3, 2024
1 parent 7d38ea8 commit 663b0ae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/pytorch/branch_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
save : Union[str, bool], default `True`
Save branch data to file if not False. If `True`, automatically
generate file name.
transfroms : Transfroms[Branch, T], optional
transforms : Transforms[Branch, T], optional
Branch transformations.
See Also
Expand Down
2 changes: 1 addition & 1 deletion examples/pytorch/tree_folder_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(
----------
swc_dir : str
Path of SWC file directory.
transfroms : Transfroms[Tree, T], optional
transforms : Transforms[Tree, T], optional
Branch transformations.
See Also
Expand Down
17 changes: 14 additions & 3 deletions swcgeom/transforms/image_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
SDFObject,
)
from tqdm import tqdm
from typing_extensions import deprecated

from swcgeom.core import Population, Tree
from swcgeom.transforms.base import Transform
Expand Down Expand Up @@ -63,9 +64,9 @@ def __call__(self, x: Tree) -> npt.NDArray[np.uint8]:
ONLY works for small image stacks, use :meth`transform_and_save`
for big image stack.
"""
return np.stack(list(self.transfrom(x, verbose=False)), axis=0)
return np.stack(list(self.transform(x, verbose=False)), axis=0)

def transfrom(
def transform(
self,
x: Tree,
verbose: bool = True,
Expand Down Expand Up @@ -102,10 +103,20 @@ def transfrom(
frame = (255 * voxel[..., 0, 0]).astype(np.uint8)
yield frame

@deprecated("Use transform instead")
def transfrom(
self,
x: Tree,
verbose: bool = True,
*,
ranges: Optional[tuple[npt.ArrayLike, npt.ArrayLike]] = None,
) -> Iterable[npt.NDArray[np.uint8]]:
return self.transform(x, verbose, ranges=ranges)

def transform_and_save(
self, fname: str, x: Tree, verbose: bool = True, **kwargs
) -> None:
self.save_tif(fname, self.transfrom(x, verbose=verbose, **kwargs))
self.save_tif(fname, self.transform(x, verbose=verbose, **kwargs))

def transform_population(
self, population: Population | str, verbose: bool = True
Expand Down

0 comments on commit 663b0ae

Please sign in to comment.