<jupyter_start><jupyter_text>Notebook to perform preprocessing of images for segmentation* Takes 3D images and performs a 2D projection to obtain 2D png that can be used in the segmentation algorithm.* Requires that `cellpose` and the code of this respository are installed. One way to do this is with a pip install (recommended in a dedicated conda environment as explained in the documentation).   ```   pip install git+https://github.com/muellerflorian/fq-segmentation/ --upgrade   ```<jupyter_code># >>> Imports 
import segwrap
from segwrap import  utils_segmentation
from pathlib import Path  

# Print version and location of package
print(f' * segwrap version: {segwrap.__version__}')
print(f' * utils_segmentation location: {utils_segmentation.__file__}')
# >>> Function call

# Parameters
path_process = Path(r'paste-path-to-data')       # For example data: \example_data\acquisition
path_save = 'acquisition>>analysis'              # If defined with >>, a string replacement will be performed (see https://fq-segmentation--27.org.readthedocs.build/en/27/analysis-general-behavior/#specify-folder-to-save-results)
subbfolder = 'segmentation-input'                # Name of subfolder to store results.
channel_ident = 'dapi'                           # Identifier of channel that should be pre-processed 
img_ext = '.tif'                                 # Extension of images that should be processed
projection_type = 'max'                          # Projection type (mean, max, indiv)
search_recursive = False                         # Search folder recursively for data?

# Call pre-processing function
utils_segmentation.folder_prepare_prediction(
            path_process=path_process,
            channel_ident=channel_ident,
            img_ext=img_ext,
            path_save=path_save,
            projection_type=projection_type,
            subfolder=subbfolder,
            search_recursive=search_recursive)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07766990291262135, 'fraction_numerical': 0.0035769034236075624, 'mean_word_length': 3.1748400852878467, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '364032', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 539, 'n_tokens_neox': 517, 'n_words': 163, 'path': 'notebooks/pre-processing.ipynb', 'repo_name': 'fish-quant/fq-segmentation', 'size': '1957'}