kwneuro.util ============ .. py:module:: kwneuro.util .. autoapi-nested-parse:: Common utility functions Attributes ---------- .. autoapisummary:: kwneuro.util.PathLike Functions --------- .. autoapisummary:: kwneuro.util.normalize_path kwneuro.util.create_estimate_volume_resource kwneuro.util.update_volume_metadata kwneuro.util.deep_equal_allclose Module Contents --------------- .. py:data:: PathLike .. py:function:: normalize_path(path_input: PathLike) -> pathlib.Path Accepts a path as a string or Path object, expands the tilde (~), and returns a resolved, absolute Path object. .. py:function:: create_estimate_volume_resource(array: numpy.typing.NDArray[Any], reference_volume: kwneuro.resource.VolumeResource, intent_name: str) -> kwneuro.resource.VolumeResource Creates an InMemoryVolumeResource from a numpy array of scalar estimates, using the affine and metadata of a reference volume. .. py:function:: update_volume_metadata(metadata: dict[str, Any], volume_data_array: numpy.ndarray, intent_code: int | str | None = None, intent_params: Any = (), intent_name: str = '') -> dict[str, Any] Use the convenience of nibabel's header class to update volume metadata. If intent_code is not provided then we don't modify the intent parameters. .. py:function:: deep_equal_allclose(obj1: Any, obj2: Any) -> bool Recursively compares two objects, including nested lists, tuples, and dicts. Uses np.allclose for numpy arrays. NaN's are considered equal.