class_docstr: ``nnUNetV2Runner`` provides an interface in MONAI to use `nnU-Net` V2 library to analyze, train, and evaluate
  neural networks for medical image segmentation tasks.
  
  ``nnUNetV2Runner`` can be used in two ways:
  
  #. with one line of code to execute the complete pipeline.
  #. with a series of commands to run each modules in the pipeline.
  
  The output of the interface is a directory that contains:
  
  #. converted dataset met the requirement of nnU-Net V2
  #. data analysis results
  #. checkpoints from the trained U-Net models
  #. validation accuracy in each fold of cross-validation
  #. the predictions on the testing datasets from the final algorithm ensemble and potential post-processing
  
  Args:
      input_config: the configuration dictionary or the file path to the configuration in the form of YAML.
          The keys required in the configuration are:
          - ``"datalist"``: File path to the datalist for the train/testing splits
          - ``"dataroot"``: File path to the dataset
          - ``"modality"``: Imaging modality, e.g. "CT", ["T2", "ADC"]
          Currently, the configuration supports these optional keys:
          - ``"nnunet_raw"``: File path that will be written to env variable for nnU-Net
          - ``"nnunet_preprocessed"``: File path that will be written to env variable for nnU-Net
          - ``"nnunet_results"``: File path that will be written to env variable for nnU-Net
          - ``"nnUNet_trained_models"``
          - ``"dataset_name_or_id"``: Name or Integer ID of the dataset
          If an optional key is not specified, then the pipeline will use the default values.
      trainer_class_name: the trainer class names offered by nnUNetV2 exhibit variations in training duration.
          Default: "nnUNetTrainer". Other options: "nnUNetTrainer_Xepoch". X could be one of 1,5,10,20,50,100,
          250,2000,4000,8000.
      export_validation_probabilities: True to save softmax predictions from final validation as npz
          files (in addition to predicted segmentations). Needed for finding the best ensemble.
          Default: True.
      work_dir: working directory to save the intermediate and final results.
  
  Examples:
      - Use the one-liner to start the nnU-Net workflow
  
      .. code-block:: bash
  
          python -m monai.apps.nnunet nnUNetV2Runner run --input_config ./input.yaml
  
      - Use `convert_dataset` to prepare the data to meet nnU-Net requirements, generate dataset JSON file,
          and copy the dataset to a location specified by ``nnunet_raw`` in the input config file
  
      .. code-block:: bash
  
          python -m monai.apps.nnunet nnUNetV2Runner convert_dataset --input_config="./input.yaml"
  
      - `convert_msd_dataset` is an alternative option to prepare the data if the dataset is MSD.
  
      .. code-block:: bash
  
          python -m monai.apps.nnunet nnUNetV2Runner convert_msd_dataset \
              --input_config "./input.yaml" --data_dir "/path/to/Task09_Spleen"
  
      - experiment planning and data pre-processing
  
      .. code-block:: bash
  
          python -m monai.apps.nnunet nnUNetV2Runner plan_and_process --input_config "./input.yaml"
  
      - training all 20 models using all GPUs available.
          "CUDA_VISIBLE_DEVICES" environment variable is not supported.
  
      .. code-block:: bash
  
          python -m monai.apps.nnunet nnUNetV2Runner train --input_config "./input.yaml"
  
      - training a single model on a single GPU for 5 epochs. Here ``config`` is used to specify the configuration.
  
      .. code-block:: bash
  
          python -m monai.apps.nnunet nnUNetV2Runner train_single_model --input_config "./input.yaml" \
              --config "3d_fullres" \
              --fold 0 \
              --gpu_id 0 \
              --trainer_class_name "nnUNetTrainer_5epochs" \
              --export_validation_probabilities True
  
      - training for all 20 models (4 configurations by 5 folds) on 2 GPUs
  
      .. code-block:: bash
  
          python -m monai.apps.nnunet nnUNetV2Runner train --input_config "./input.yaml" --gpu_id_for_all "0,1"
  
      - 5-fold training for a single model on 2 GPUs. Here ``configs`` is used to specify the configurations.
  
      .. code-block:: bash
  
          python -m monai.apps.nnunet nnUNetV2Runner train --input_config "./input.yaml" \
              --configs "3d_fullres" \
              --trainer_class_name "nnUNetTrainer_5epochs" \
              --export_validation_probabilities True \
              --gpu_id_for_all "0,1"
  
      - find the best configuration
  
      .. code-block:: bash
  
          python -m monai.apps.nnunet nnUNetV2Runner find_best_configuration --input_config "./input.yaml"
  
      - predict, ensemble, and post-process
  
      .. code-block:: bash
  
          python -m monai.apps.nnunet nnUNetV2Runner predict_ensemble_postprocessing --input_config "./input.yaml"
class_docstr_tok: ["``","nnUNetV2Runner","``","provides","an","interface","in","MONAI","to","use","`","nnU-Net","`","V2","library","to","analyze",",","train",",","and","evaluate","neural","networks","for","medical","image","segmentation","tasks",".","``","nnUNetV2Runner","``","can","be","used","in","two","ways",":","#",".","with","one","line","of","code","to","execute","the","complete","pipeline",".","#",".","with","a","series","of","commands","to","run","each","modules","in","the","pipeline",".","The","output","of","the","interface","is","a","directory","that","contains",":","#",".","converted","dataset","met","the","requirement","of","nnU-Net","V2","#",".","data","analysis","results","#",".","checkpoints","from","the","trained","U-Net","models","#",".","validation","accuracy","in","each","fold","of","cross-validation","#",".","the","predictions","on","the","testing","datasets","from","the","final","algorithm","ensemble","and","potential","post-processing","Args",":","input_config",":","the","configuration","dictionary","or","the","file","path","to","the","configuration","in","the","form","of","YAML",".","The","keys","required","in","the","configuration","are",":","-","``","``","datalist","''","``",":","File","path","to","the","datalist","for","the","train\/testing","splits","-","``","``","dataroot","''","``",":","File","path","to","the","dataset","-","``","``","modality","''","``",":","Imaging","modality",",","e.g",".","``","CT","''",",","[","``","T2","''",",","``","ADC","''","]","Currently",",","the","configuration","supports","these","optional","keys",":","-","``","``","nnunet_raw","''","``",":","File","path","that","will","be","written","to","env","variable","for","nnU-Net","-","``","``","nnunet_preprocessed","''","``",":","File","path","that","will","be","written","to","env","variable","for","nnU-Net","-","``","``","nnunet_results","''","``",":","File","path","that","will","be","written","to","env","variable","for","nnU-Net","-","``","``","nnUNet_trained_models","''","``","-","``","``","dataset_name_or_id","''","``",":","Name","or","Integer","ID","of","the","dataset","If","an","optional","key","is","not","specified",",","then","the","pipeline","will","use","the","default","values",".","trainer_class_name",":","the","trainer","class","names","offered","by","nnUNetV2","exhibit","variations","in","training","duration",".","Default",":","``","nnUNetTrainer","''",".","Other","options",":","``","nnUNetTrainer_Xepoch","''",".","X","could","be","one","of","1,5,10,20,50,100",",","250,2000,4000,8000.","export_validation_probabilities",":","True","to","save","softmax","predictions","from","final","validation","as","npz","files","(","in","addition","to","predicted","segmentations",")",".","Needed","for","finding","the","best","ensemble",".","Default",":","True",".","work_dir",":","working","directory","to","save","the","intermediate","and","final","results",".","Examples",":","-","Use","the","one-liner","to","start","the","nnU-Net","workflow","..","code-block",":",":","bash","python","-m","monai.apps.nnunet","nnUNetV2Runner","run","--","input_config",".\/input.yaml","-","Use","`","convert_dataset","`","to","prepare","the","data","to","meet","nnU-Net","requirements",",","generate","dataset","JSON","file",",","and","copy","the","dataset","to","a","location","specified","by","``","nnunet_raw","``","in","the","input","config","file","..","code-block",":",":","bash","python","-m","monai.apps.nnunet","nnUNetV2Runner","convert_dataset","--","input_config=","''",".\/input.yaml","''","-","`","convert_msd_dataset","`","is","an","alternative","option","to","prepare","the","data","if","the","dataset","is","MSD",".","..","code-block",":",":","bash","python","-m","monai.apps.nnunet","nnUNetV2Runner","convert_msd_dataset","\\","--","input_config","``",".\/input.yaml","''","--","data_dir","``","\/path\/to\/Task09_Spleen","''","-","experiment","planning","and","data","pre-processing","..","code-block",":",":","bash","python","-m","monai.apps.nnunet","nnUNetV2Runner","plan_and_process","--","input_config","``",".\/input.yaml","''","-","training","all","20","models","using","all","GPUs","available",".","``","CUDA_VISIBLE_DEVICES","''","environment","variable","is","not","supported",".","..","code-block",":",":","bash","python","-m","monai.apps.nnunet","nnUNetV2Runner","train","--","input_config","``",".\/input.yaml","''","-","training","a","single","model","on","a","single","GPU","for","5","epochs",".","Here","``","config","``","is","used","to","specify","the","configuration",".","..","code-block",":",":","bash","python","-m","monai.apps.nnunet","nnUNetV2Runner","train_single_model","--","input_config","``",".\/input.yaml","''","\\","--","config","``","3d_fullres","''","\\","--","fold","0","\\","--","gpu_id","0","\\","--","trainer_class_name","``","nnUNetTrainer_5epochs","''","\\","--","export_validation_probabilities","True","-","training","for","all","20","models","(","4","configurations","by","5","folds",")","on","2","GPUs","..","code-block",":",":","bash","python","-m","monai.apps.nnunet","nnUNetV2Runner","train","--","input_config","``",".\/input.yaml","''","--","gpu_id_for_all","``","0,1","''","-","5-fold","training","for","a","single","model","on","2","GPUs",".","Here","``","configs","``","is","used","to","specify","the","configurations",".","..","code-block",":",":","bash","python","-m","monai.apps.nnunet","nnUNetV2Runner","train","--","input_config","``",".\/input.yaml","''","\\","--","configs","``","3d_fullres","''","\\","--","trainer_class_name","``","nnUNetTrainer_5epochs","''","\\","--","export_validation_probabilities","True","\\","--","gpu_id_for_all","``","0,1","''","-","find","the","best","configuration","..","code-block",":",":","bash","python","-m","monai.apps.nnunet","nnUNetV2Runner","find_best_configuration","--","input_config","``",".\/input.yaml","''","-","predict",",","ensemble",",","and","post-process","..","code-block",":",":","bash","python","-m","monai.apps.nnunet","nnUNetV2Runner","predict_ensemble_postprocessing","--","input_config","``",".\/input.yaml","''"]
docstr: Extracts the dataset fingerprint used for experiment planning.
  
  Args:
      fpe: [OPTIONAL] Name of the Dataset Fingerprint Extractor class that should be used. Default is
          "DatasetFingerprintExtractor".
      npfp: [OPTIONAL] Number of processes used for fingerprint extraction.
      verify_dataset_integrity: [RECOMMENDED] set this flag to check the dataset integrity. This is
          useful and should be done once for each dataset!
      clean: [OPTIONAL] Set this flag to overwrite existing fingerprints. If this flag is not set and a
          fingerprint already exists, the fingerprint extractor will not run.
      verbose: set this to print a lot of stuff. Useful for debugging. Will disable progress bar!
          Recommended for cluster environments.
docstr_tok: ["Extracts","the","dataset","fingerprint","used","for","experiment","planning",".","Args",":","fpe",":","[","OPTIONAL","]","Name","of","the","Dataset","Fingerprint","Extractor","class","that","should","be","used",".","Default","is","``","DatasetFingerprintExtractor","''",".","npfp",":","[","OPTIONAL","]","Number","of","processes","used","for","fingerprint","extraction",".","verify_dataset_integrity",":","[","RECOMMENDED","]","set","this","flag","to","check","the","dataset","integrity",".","This","is","useful","and","should","be","done","once","for","each","dataset","!","clean",":","[","OPTIONAL","]","Set","this","flag","to","overwrite","existing","fingerprints",".","If","this","flag","is","not","set","and","a","fingerprint","already","exists",",","the","fingerprint","extractor","will","not","run",".","verbose",":","set","this","to","print","a","lot","of","stuff",".","Useful","for","debugging",".","Will","disable","progress","bar","!","Recommended","for","cluster","environments","."]
code: def extract_fingerprints(
      self,
      fpe: str = "DatasetFingerprintExtractor",
      npfp: int = -1,
      verify_dataset_integrity: bool = False,
      clean: bool = False,
      verbose: bool = False,
  ) -> None:
      """
      Extracts the dataset fingerprint used for experiment planning.
  
      Args:
          fpe: [OPTIONAL] Name of the Dataset Fingerprint Extractor class that should be used. Default is
              "DatasetFingerprintExtractor".
          npfp: [OPTIONAL] Number of processes used for fingerprint extraction.
          verify_dataset_integrity: [RECOMMENDED] set this flag to check the dataset integrity. This is
              useful and should be done once for each dataset!
          clean: [OPTIONAL] Set this flag to overwrite existing fingerprints. If this flag is not set and a
              fingerprint already exists, the fingerprint extractor will not run.
          verbose: set this to print a lot of stuff. Useful for debugging. Will disable progress bar!
              Recommended for cluster environments.
      """
      from nnunetv2.experiment_planning.plan_and_preprocess_api import (
          extract_fingerprints,
      )
  
      npfp = self.default_num_processes if npfp < 0 else npfp
  
      logger.info("Fingerprint extraction...")
      extract_fingerprints(
          [int(self.dataset_name_or_id)],
          fpe,
          npfp,
          verify_dataset_integrity,
          clean,
          verbose,
      )
  
imports: from __future__ import annotations
  import glob
  import os
  import subprocess
  from typing import Any
  import monai
  from monai.apps.nnunet.utils import NNUNETMode
  from monai.apps.nnunet.utils import analyze_data, create_new_data_copy, create_new_dataset_json
  from monai.bundle import ConfigParser
  from monai.utils import ensure_tuple, optional_import
label_desc: Use image node_id 4 for calling the nnUNetV2Runner obj's underlying member method code with example usage: obj.extract_fingerprints(fpe, npfp, verify_dataset_integrity, clean, verbose) without return types