# Copyright (c) MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import copy import json import logging import os import pathlib from typing import Dict, List import numpy as np from monai.apps.utils import tqdm from monai.utils import optional_import loadmat, _ = optional_import("scipy.io", name="loadmat") PILImage, _ = optional_import("PIL.Image") def consep_nuclei_dataset(datalist, output_dir, crop_size, min_area=80, min_distance=20, limit=0) -> List[Dict]: """ Utility to pre-process and create dataset list for Patches per Nuclei for training over ConSeP dataset. Args: datalist: A list of data dictionary. Each entry should at least contain 'image_key': . For example, typical input data can be a list of dictionaries:: [{'image': , 'label':