phenotypic.tools.funcs_#
- phenotypic.tools.funcs_.is_binary_mask(arr: numpy.ndarray)[source]#
- Parameters:
arr (numpy.ndarray)
- phenotypic.tools.funcs_.is_static_method(owner_cls: type, method_name: str) bool[source]#
Return True if method_name is defined on owner_cls (or an ancestor in its MRO) as a staticmethod.
- phenotypic.tools.funcs_.murmur3_array_signature(arr: numpy.ndarray) bytes[source]#
Return a 128‑bit MurmurHash3 digest of arr.
The rgb is converted to a C‑contiguous view so that
memoryviewcan safely expose its buffer. If the rgb is already contiguous this is a zero‑copy operation.- Parameters:
arr (numpy.ndarray)
- Return type:
- phenotypic.tools.funcs_.normalize_rgb_bitdepth(image: numpy.ndarray) numpy.ndarray[source]#
Normalize an RGB rgb to [0,1] using bit-depth inference.
Rules: - If dtype is integer: use dtype max (e.g. 255 for uint8, 65535 for uint16). - If dtype is float:
If max <= 1 → assume already normalized, return as-is.
If 255 < max <= 65535 → assume 16-bit, divide by 65535.
Else → assume 8-bit, divide by 255.
- Parameters:
image (numpy.ndarray) – RGB rgb.
- Returns:
float64 normalized image in [0,1].
- Return type:
np.ndarray
- phenotypic.tools.funcs_.timed_execution(func)[source]#
Decorator to measure and print the execution time of a function.
- phenotypic.tools.funcs_.validate_measure_integrity(*targets: str)[source]#
Decorator to ensure that key NumPy arrays on the ‘image’ argument are not mutated by an MeasureFeatures.measure() call.
- If you pass explicit targets, it will honor those—for example:
@validate_member_integrity(‘image.rgb’)
- Otherwise it defaults to checking:
image.rgb, image.gray, image.enh_gray, image.objmap
- Parameters:
targets (str)
- phenotypic.tools.funcs_.validate_operation_integrity(*targets: str)[source]#
Decorator to ensure that key NumPy arrays on the ‘image’ argument remain unchanged by an ImageOperation.apply() call. If no targets are specified, defaults to checking:
image.rgb, image.gray, image.enh_gray, image.objmap
- Example Usage:
@validate_member_integrity(‘image.rgb’, ‘image.objmap’) def func(image: Image,…):
…
- Parameters:
targets (str)