Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document + examples of functional.py #175

Open
jjjermiah opened this issue Jan 16, 2025 · 1 comment · May be fixed by #190
Open

document + examples of functional.py #175

jjjermiah opened this issue Jan 16, 2025 · 1 comment · May be fixed by #190
Assignees

Comments

@jjjermiah
Copy link
Contributor

this module: https://github.com/bhklab/med-imagetools/blob/main/src/imgtools/ops/functional.py

has a lot of useful functions. very often we just re-implement it in work because we dont know it exists
or what they do.

part of the documentation eventually should describe the functions, and show examples of how they work.

before we start writing the documentation, would be nice to be able to properly verify what its doing. we could use a notebook or two in the docs/ directory that goes through each function and shows what happens.

main ones right now:

  • resample
  • resize
  • zoom
  • rotate
  • clip_intensity
  • window_intensity
  • image_statistics
  • standard_scale
  • min_max_scale

you can ignore the crops and bounding box stuff for now

would be nice to show each in good detail (difference between inputs and outputs) so
its very clear whats going on

@jjjermiah
Copy link
Contributor Author

also have these mypy errors:

src/imgtools/ops/functional.py:101: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, ...], dtype[Any]]", variable has type "float | None")  [assignment]
src/imgtools/ops/functional.py:102: error: Argument 2 to "where" has incompatible type "float | None"; expected "Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]"  [arg-type]
src/imgtools/ops/functional.py:168: error: Argument "output_size" to "resample" has incompatible type "ndarray[tuple[int, ...], dtype[Any]]"; expected "Sequence[float] | None"  [arg-type]
src/imgtools/ops/functional.py:272: error: "float" object is not iterable  [misc]
src/imgtools/ops/functional.py:274: error: Incompatible types in assignment (expression has type "Euler3DTransform", variable has type "Euler2DTransform")  [assignment]
src/imgtools/ops/functional.py:314: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, ...], dtype[float64]]", variable has type "Sequence[float]")  [assignment]
src/imgtools/ops/functional.py:319: error: "bool" has no attribute "any"  [attr-defined]
src/imgtools/ops/functional.py:319: error: Unsupported operand types for > ("int" and "Sequence[float]")  [operator]
src/imgtools/ops/functional.py:471: error: Incompatible types in assignment (expression has type "ndarray[tuple[int, ...], dtype[Any]]", variable has type "tuple[Any, ...]")  [assignment]
src/imgtools/ops/functional.py:472: error: No overload variant of "__add__" of "tuple" matches argument type "int"  [operator]
src/imgtools/ops/functional.py:472: note: Possible overload variants:
src/imgtools/ops/functional.py:472: note:     def __add__(self, tuple[Any, ...], /) -> tuple[Any, ...]
src/imgtools/ops/functional.py:472: note:     def [_T] __add__(self, tuple[_T, ...], /) -> tuple[Any | _T, ...]
src/imgtools/ops/functional.py:472: note: Right operand is of type "int | ndarray[tuple[int, ...], dtype[signedinteger[Any]]]"
src/imgtools/ops/functional.py:473: error: Unsupported operand types for - ("tuple[Any, ...]" and "int")  [operator]
src/imgtools/ops/functional.py:473: note: Right operand is of type "int | ndarray[tuple[int, ...], dtype[Any]] | ndarray[Any, Any]"
src/imgtools/ops/functional.py:478: error: Incompatible return value type (got "tuple[Image, Image, Any]", expected "tuple[Image]")  [return-value]
src/imgtools/ops/functional.py:584: error: Incompatible types in assignment (expression has type "StatisticsImageFilter", variable has type "LabelStatisticsImageFilter")  [assignment]
src/imgtools/ops/functional.py:585: error: Missing positional argument "labelImage" in call to "Execute"  [call-arg]
src/imgtools/ops/functional.py:587: error: Missing positional argument "label" in call to "GetMinimum"  [call-arg]
src/imgtools/ops/functional.py:588: error: Missing positional argument "label" in call to "GetMaximum"  [call-arg]
src/imgtools/ops/functional.py:589: error: Missing positional argument "label" in call to "GetSum"  [call-arg]
src/imgtools/ops/functional.py:590: error: Missing positional argument "label" in call to "GetMean"  [call-arg]
src/imgtools/ops/functional.py:591: error: Missing positional argument "label" in call to "GetVariance"  [call-arg]
src/imgtools/ops/functional.py:592: error: Missing positional argument "label" in call to "GetSigma"  [call-arg]
src/imgtools/ops/functional.py:595: error: Incompatible return value type (got "ImageStatistics@564", expected "float")  [return-value]
src/imgtools/ops/functional.py:645: error: "float" has no attribute "mean"  [attr-defined]
src/imgtools/ops/functional.py:646: error: "float" has no attribute "standard_deviation"  [attr-defined]

@jjjermiah jjjermiah linked a pull request Jan 23, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants