Skip to content

Commit a44ed68

Browse files
authored
Merge pull request #189 from rolfverberg/main
update binarization processor
2 parents 3252c9d + 966909d commit a44ed68

File tree

3 files changed

+116
-311
lines changed

3 files changed

+116
-311
lines changed

CHAP/common/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"""
44

55
from CHAP.common.models.common import (
6+
BinarizeProcessorConfig,
67
ImageProcessorConfig,
78
)

CHAP/common/models/common.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,31 @@
2525
from CHAP.models import CHAPBaseModel
2626

2727

28+
class BinarizeProcessorConfig(CHAPBaseModel):
29+
"""Configuration class to binarize a dataset in a 2D or 3D
30+
array-like object or a NeXus NXdata or NXfield object.
31+
32+
:param method: Binarization method, defaults to `'CHAP'`
33+
(CHAP's internal implementation of Otzu's method).
34+
:type method: Literal['CHAP', 'isodata', 'minimum', 'otsu', 'yen']
35+
:param num_bin: The number of bins used to calculate the
36+
histogram in the binarization algorithms, defaults to `256`.
37+
:type num_bin: int, optional
38+
:param nxpath: The path to a specific NeXus NXdata or NXfield
39+
object in the NeXus file tree to read the input data from
40+
(ignored for non-NeXus input objects).
41+
:type nxpath: str, optional
42+
:param remove_original_data: Removes the original data field
43+
(ignored for non-NeXus input objects), defaults to `False`.
44+
:type remove_original_data: bool, optional
45+
"""
46+
method: Optional[Literal[
47+
'CHAP', 'isodata', 'minimum', 'otsu', 'yen']] = 'CHAP'
48+
num_bin: Optional[conint(ge=0)] = 256
49+
nxpath: Optional[str] = None
50+
remove_original_data: Optional[bool] = False
51+
52+
2853
class ImageProcessorConfig(CHAPBaseModel):
2954
"""Class representing the configuration of various image selection
3055
and visualization types of processors.

0 commit comments

Comments
 (0)