neuro_morpho.model.simple_baseline ================================== .. py:module:: neuro_morpho.model.simple_baseline .. autoapi-nested-parse:: A simple baseline model for testing. Classes ------- .. autoapisummary:: neuro_morpho.model.simple_baseline.SimpleBaseLine Functions --------- .. autoapisummary:: neuro_morpho.model.simple_baseline.make_binary Module Contents --------------- .. py:function:: make_binary(x: numpy.ndarray, percentile: int) -> numpy.ndarray Binarize an image based on a percentile threshold. This function thresholds the input image `x` at the given `percentile` and then skeletonizes the result. :param x: The input image. Should be of shape (n_samples, width, height). :type x: np.ndarray :param percentile: The percentile to use as the threshold. :type percentile: int :returns: The binarized and skeletonized image. :rtype: np.ndarray .. py:class:: SimpleBaseLine(percentile: int = 95, name: str | None = None) Bases: :py:obj:`neuro_morpho.model.base.BaseModel` A simple baseline model for image segmentation. This model binarizes the input image based on a percentile threshold and then skeletonizes the result. .. py:attribute:: percentile :value: 95 .. py:attribute:: name :value: 'simple_base_line' .. py:method:: fit(training_x_dir: pathlib.Path | str, training_y_dir: pathlib.Path | str, testing_x_dir: pathlib.Path | str, testing_y_dir: pathlib.Path | str) -> SimpleBaseLine This model does not require fitting, so this method just returns self. .. py:method:: predict(x: numpy.ndarray) -> numpy.ndarray Predict the segmentation for the input image. .. py:method:: predict_dir(in_dir: str | pathlib.Path, out_dir: str | pathlib.Path, tile_size: int = 512, tile_assembly: str = 'mean') -> None Predict the segmentation for all images in a directory. .. py:method:: save(path: pathlib.Path | str) -> None Save the model's percentile threshold to a file. .. py:method:: load(path: pathlib.Path | str) -> None Load the model's percentile threshold from a file.