class_docstr: Base class for ANTS interfaces
code: def _num_threads_update(self):
      self._num_threads = self.inputs.num_threads
      # ONLY SET THE ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS if requested
      # by the end user.  The default setting did not allow for
      # overwriting the default values.
      # In ITKv4 (the version used for all ANTS programs), ITK respects
      # the SGE controlled $NSLOTS environmental variable.
      # If user specifies -1, then that indicates that the system
      # default behavior should be the one specified by ITKv4 rules
      # (i.e. respect SGE $NSLOTS or environmental variables of threads, or
      # user environmental settings)
      if self.inputs.num_threads == -1:
          if ALT_ITKv4_THREAD_LIMIT_VARIABLE in self.inputs.environ:
              del self.inputs.environ[ALT_ITKv4_THREAD_LIMIT_VARIABLE]
          if (
              PREFERED_ITKv4_THREAD_LIMIT_VARIABLE
              in self.inputs.environ
          ):
              del self.inputs.environ[
                  PREFERED_ITKv4_THREAD_LIMIT_VARIABLE
              ]
      else:
          self.inputs.environ.update(
              {
                  PREFERED_ITKv4_THREAD_LIMIT_VARIABLE: "%s"
                  % self.inputs.num_threads
              }
          )
  
file_path: nipype/nipype/interfaces/ants/base.py
imports: import os
  from packaging.version import Version, parse
  from ...None import logging
  from ..base import CommandLine, CommandLineInputSpec, traits, isdefined, PackageInfo
label_desc: Use image node_id 2 for calling the ANTSCommand obj's underlying member method code with example usage: obj._num_threads_update() without return types