code: def main_nuclei():
      from pathlib import Path
  
      from monailabel.datastore.local import LocalDatastore
  
      logging.basicConfig(
          level=logging.INFO,
          format="[%(asctime)s] [%(process)s] [%(threadName)s] [%(levelname)s] (%(name)s:%(lineno)d) - %(message)s",
          datefmt="%Y-%m-%d %H:%M:%S",
          force=True,
      )
  
      home = str(Path.home())
      for f in ["training", "validation"]:
          studies = f"{home}/Dataset/Pathology/CoNSeP/{f}"
  
          logger.info(f"Generate Nuclei Dataset for: {studies}")
          datastore = LocalDatastore(
              studies, extensions=("*.png", "*.mat")
          )
  
          nuclick = False
          if not nuclick:
              output_dir = (
                  f"{home}/Dataset/Pathology/CoNSeP/{f}Segx256All"
              )
              crop_size = 256  # if f == "training" else 0
              split_dataset(
                  datastore,
                  output_dir,
                  "consep",
                  None,
                  None,
                  limit=0,
                  crop_size=crop_size,
              )
  
              if not crop_size:
                  class_count = {1: 0, 2: 0, 3: 0, 4: 0}
                  ds = datastore.datalist()
                  for d in ds:
                      m = scipy.io.loadmat(d["label"])
                      for class_id in m["inst_type"]:
                          class_id = int(class_id)
                          class_id = (
                              3
                              if class_id in (3, 4)
                              else 4
                              if class_id in (5, 6, 7)
                              else class_id
                          )  # override
                          class_count[class_id] = (
                              class_count.get(class_id, 0) + 1
                          )
                  logger.info(f"{f} => Label Classes: {class_count}")
          else:
              output_dir = f"{home}/Dataset/Pathology/CoNSeP/{f}Class"
              split_dataset(
                  datastore,
                  output_dir,
                  "consep_nuclei",
                  None,
                  None,
                  limit=0,
                  crop_size=96,
              )
  
imports: import copy
  import logging
  import os
  import random
  import shutil
  import xml.etree.ElementTree
  from io import BytesIO
  from math import ceil
  import cv2
  import numpy
  import openslide
  import scipy
  from PIL import Image
  from tqdm import tqdm
  from monailabel.datastore.dsa import DSADatastore
  from monailabel.datastore.local import LocalDatastore
  from monailabel.interfaces.datastore import Datastore
  from monailabel.utils.others.generic import get_basename, get_basename_no_ext, is_openslide_supported
label_desc: Use image node_id 14 for calling a global function with example usage: main_nuclei() without return types