# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.4.1
#
# Do not make changes to this file unless you know what you are doing - modify
# the SWIG interface file instead.


import collections

from sys import version_info as _version_info
if _version_info < (3, 7, 0):
    raise RuntimeError("Python 3.7 or later required")

from . import _ITKCommonPython


from . import _ITKOptimizersPython



from sys import version_info as _swig_python_version_info
# Import the low-level C/C++ module
if getattr(globals().get("__spec__"), "parent", None) or __package__ or "." in __name__:
    from . import _ITKCostFunctionsPython
else:
    import _ITKCostFunctionsPython

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "this":
            set(self, name, value)
        elif name == "thisown":
            self.this.own(value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


if _swig_python_version_info[0:2] >= (3, 3):
    import collections.abc
else:
    import collections

import itk.ITKCommonBasePython
import itk.itkMatrixPython
import itk.itkVectorPython
import itk.itkFixedArrayPython
import itk.pyBasePython
import itk.vnl_vector_refPython
import itk.stdcomplexPython
import itk.vnl_vectorPython
import itk.vnl_matrixPython
import itk.itkCovariantVectorPython
import itk.itkPointPython
import itk.vnl_matrix_fixedPython
import itk.itkCostFunctionPython
import itk.vnl_cost_functionPython
import itk.vnl_unary_functionPython
import itk.vnl_least_squares_functionPython
import itk.itkOptimizerParametersPython
import itk.itkArrayPython
import itk.itkArray2DPython
class itkMultipleValuedCostFunction(itk.itkCostFunctionPython.itkCostFunctionTemplateD):
    r"""Proxy of C++ itkMultipleValuedCostFunction class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined - class is abstract")
    __repr__ = _swig_repr

    def GetValue(self, parameters):
        r"""
        GetValue(self, parameters) -> itkArrayD

        Parameters
        ----------
        parameters: itkOptimizerParametersD const &

        """
        return _ITKCostFunctionsPython.itkMultipleValuedCostFunction_GetValue(self, parameters)

    def GetNumberOfValues(self):
        r"""GetNumberOfValues(self) -> unsigned int"""
        return _ITKCostFunctionsPython.itkMultipleValuedCostFunction_GetNumberOfValues(self)

    def GetDerivative(self, parameters, derivative):
        r"""
        GetDerivative(self, parameters, derivative)

        Parameters
        ----------
        parameters: itkOptimizerParametersD const &
        derivative: itkArray2DD &

        """
        return _ITKCostFunctionsPython.itkMultipleValuedCostFunction_GetDerivative(self, parameters, derivative)
    __swig_destroy__ = _ITKCostFunctionsPython.delete_itkMultipleValuedCostFunction

    @staticmethod
    def cast(obj):
        r"""
        cast(obj) -> itkMultipleValuedCostFunction

        Parameters
        ----------
        obj: itkLightObject *

        """
        return _ITKCostFunctionsPython.itkMultipleValuedCostFunction_cast(obj)

# Register itkMultipleValuedCostFunction in _ITKCostFunctionsPython:
_ITKCostFunctionsPython.itkMultipleValuedCostFunction_swigregister(itkMultipleValuedCostFunction)
class itkMultipleValuedVnlCostFunctionAdaptor(itk.vnl_least_squares_functionPython.vnl_least_squares_function):
    r"""Proxy of C++ itkMultipleValuedVnlCostFunctionAdaptor class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def SetCostFunction(self, costFunction):
        r"""
        SetCostFunction(self, costFunction)

        Parameters
        ----------
        costFunction: itkMultipleValuedCostFunction *

        """
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_SetCostFunction(self, costFunction)

    def GetCostFunction(self):
        r"""GetCostFunction(self) -> itkMultipleValuedCostFunction"""
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_GetCostFunction(self)

    def compute(self, x, ff, g):
        r"""
        compute(self, x, ff, g)

        Parameters
        ----------
        x: vnl_vectorD const &
        ff: vnl_vectorD *
        g: vnl_matrixD *

        """
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_compute(self, x, ff, g)

    def ConvertExternalToInternalGradient(self, input, output):
        r"""
        ConvertExternalToInternalGradient(self, input, output)

        Parameters
        ----------
        input: itkArray2DD const &
        output: vnl_matrixD &

        """
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_ConvertExternalToInternalGradient(self, input, output)

    def ConvertExternalToInternalMeasures(self, input, output):
        r"""
        ConvertExternalToInternalMeasures(self, input, output)

        Parameters
        ----------
        input: itkArrayD const &
        output: vnl_vectorD &

        """
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_ConvertExternalToInternalMeasures(self, input, output)

    def SetUseGradient(self, arg0):
        r"""
        SetUseGradient(self, arg0)

        Parameters
        ----------
        arg0: bool

        """
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_SetUseGradient(self, arg0)

    def UseGradientOn(self):
        r"""UseGradientOn(self)"""
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_UseGradientOn(self)

    def UseGradientOff(self):
        r"""UseGradientOff(self)"""
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_UseGradientOff(self)

    def GetUseGradient(self):
        r"""GetUseGradient(self) -> bool"""
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_GetUseGradient(self)

    def SetScales(self, scales):
        r"""
        SetScales(self, scales)

        Parameters
        ----------
        scales: itkArrayD const &

        """
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_SetScales(self, scales)

    def AddObserver(self, event, arg1):
        r"""
        AddObserver(self, event, arg1) -> unsigned long

        Parameters
        ----------
        event: itkEventObject const &
        arg1: itkCommand *

        """
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_AddObserver(self, event, arg1)

    def GetCachedValue(self):
        r"""GetCachedValue(self) -> itkArrayD"""
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_GetCachedValue(self)

    def GetCachedDerivative(self):
        r"""GetCachedDerivative(self) -> itkArray2DD"""
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_GetCachedDerivative(self)

    def GetCachedCurrentParameters(self):
        r"""GetCachedCurrentParameters(self) -> itkOptimizerParametersD"""
        return _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_GetCachedCurrentParameters(self)

    def __init__(self, *args):
        r"""
        __init__(self, spaceDimension, numberOfValues) -> itkMultipleValuedVnlCostFunctionAdaptor

        Parameters
        ----------
        spaceDimension: unsigned int
        numberOfValues: unsigned int

        __init__(self, arg0) -> itkMultipleValuedVnlCostFunctionAdaptor

        Parameters
        ----------
        arg0: itkMultipleValuedVnlCostFunctionAdaptor const &

        """
        _ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_swiginit(self, _ITKCostFunctionsPython.new_itkMultipleValuedVnlCostFunctionAdaptor(*args))
    __swig_destroy__ = _ITKCostFunctionsPython.delete_itkMultipleValuedVnlCostFunctionAdaptor

# Register itkMultipleValuedVnlCostFunctionAdaptor in _ITKCostFunctionsPython:
_ITKCostFunctionsPython.itkMultipleValuedVnlCostFunctionAdaptor_swigregister(itkMultipleValuedVnlCostFunctionAdaptor)
class itkSingleValuedCostFunction(itk.itkCostFunctionPython.itkCostFunctionTemplateD):
    r"""Proxy of C++ itkSingleValuedCostFunction class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined - class is abstract")
    __repr__ = _swig_repr

    def GetValue(self, parameters):
        r"""
        GetValue(self, parameters) -> double

        Parameters
        ----------
        parameters: itkOptimizerParametersD const &

        """
        return _ITKCostFunctionsPython.itkSingleValuedCostFunction_GetValue(self, parameters)

    def GetDerivative(self, parameters, derivative):
        r"""
        GetDerivative(self, parameters, derivative)

        Parameters
        ----------
        parameters: itkOptimizerParametersD const &
        derivative: itkArrayD &

        """
        return _ITKCostFunctionsPython.itkSingleValuedCostFunction_GetDerivative(self, parameters, derivative)

    def GetValueAndDerivative(self, parameters, value, derivative):
        r"""
        GetValueAndDerivative(self, parameters, value, derivative)

        Parameters
        ----------
        parameters: itkOptimizerParametersD const &
        value: double &
        derivative: itkArrayD &

        """
        return _ITKCostFunctionsPython.itkSingleValuedCostFunction_GetValueAndDerivative(self, parameters, value, derivative)
    __swig_destroy__ = _ITKCostFunctionsPython.delete_itkSingleValuedCostFunction

    @staticmethod
    def cast(obj):
        r"""
        cast(obj) -> itkSingleValuedCostFunction

        Parameters
        ----------
        obj: itkLightObject *

        """
        return _ITKCostFunctionsPython.itkSingleValuedCostFunction_cast(obj)

# Register itkSingleValuedCostFunction in _ITKCostFunctionsPython:
_ITKCostFunctionsPython.itkSingleValuedCostFunction_swigregister(itkSingleValuedCostFunction)
class itkSingleValuedVnlCostFunctionAdaptor(itk.vnl_cost_functionPython.vnl_cost_function):
    r"""Proxy of C++ itkSingleValuedVnlCostFunctionAdaptor class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
    __repr__ = _swig_repr

    def SetCostFunction(self, costFunction):
        r"""
        SetCostFunction(self, costFunction)

        Parameters
        ----------
        costFunction: itkSingleValuedCostFunction *

        """
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_SetCostFunction(self, costFunction)

    def GetCostFunction(self):
        r"""GetCostFunction(self) -> itkSingleValuedCostFunction"""
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_GetCostFunction(self)

    def ConvertExternalToInternalGradient(self, input, output):
        r"""
        ConvertExternalToInternalGradient(self, input, output)

        Parameters
        ----------
        input: itkArrayD const &
        output: vnl_vectorD &

        """
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_ConvertExternalToInternalGradient(self, input, output)

    def SetScales(self, scales):
        r"""
        SetScales(self, scales)

        Parameters
        ----------
        scales: itkArrayD const &

        """
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_SetScales(self, scales)

    def SetNegateCostFunction(self, flag):
        r"""
        SetNegateCostFunction(self, flag)

        Parameters
        ----------
        flag: bool

        """
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_SetNegateCostFunction(self, flag)

    def GetNegateCostFunction(self):
        r"""GetNegateCostFunction(self) -> bool"""
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_GetNegateCostFunction(self)

    def NegateCostFunctionOn(self):
        r"""NegateCostFunctionOn(self)"""
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_NegateCostFunctionOn(self)

    def NegateCostFunctionOff(self):
        r"""NegateCostFunctionOff(self)"""
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_NegateCostFunctionOff(self)

    def AddObserver(self, event, arg1):
        r"""
        AddObserver(self, event, arg1) -> unsigned long

        Parameters
        ----------
        event: itkEventObject const &
        arg1: itkCommand *

        """
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_AddObserver(self, event, arg1)

    def GetCachedValue(self):
        r"""GetCachedValue(self) -> double const &"""
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_GetCachedValue(self)

    def GetCachedDerivative(self):
        r"""GetCachedDerivative(self) -> itkArrayD"""
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_GetCachedDerivative(self)

    def GetCachedCurrentParameters(self):
        r"""GetCachedCurrentParameters(self) -> itkOptimizerParametersD"""
        return _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_GetCachedCurrentParameters(self)

    def __init__(self, *args):
        r"""
        __init__(self, spaceDimension) -> itkSingleValuedVnlCostFunctionAdaptor

        Parameters
        ----------
        spaceDimension: unsigned int

        __init__(self, arg0) -> itkSingleValuedVnlCostFunctionAdaptor

        Parameters
        ----------
        arg0: itkSingleValuedVnlCostFunctionAdaptor const &

        """
        _ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_swiginit(self, _ITKCostFunctionsPython.new_itkSingleValuedVnlCostFunctionAdaptor(*args))
    __swig_destroy__ = _ITKCostFunctionsPython.delete_itkSingleValuedVnlCostFunctionAdaptor

# Register itkSingleValuedVnlCostFunctionAdaptor in _ITKCostFunctionsPython:
_ITKCostFunctionsPython.itkSingleValuedVnlCostFunctionAdaptor_swigregister(itkSingleValuedVnlCostFunctionAdaptor)

def itkCumulativeGaussianCostFunction_New():
    return itkCumulativeGaussianCostFunction.New()

class itkCumulativeGaussianCostFunction(itkMultipleValuedCostFunction):
    r"""Proxy of C++ itkCumulativeGaussianCostFunction class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined")
    __repr__ = _swig_repr

    @staticmethod
    def __New_orig__():
        r"""__New_orig__() -> itkCumulativeGaussianCostFunction_Pointer"""
        return _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction___New_orig__()

    def Clone(self):
        r"""Clone(self) -> itkCumulativeGaussianCostFunction_Pointer"""
        return _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_Clone(self)
    SpaceDimension = _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_SpaceDimension
    

    def GetValuePointer(self, parameters):
        r"""
        GetValuePointer(self, parameters) -> itkArrayD

        Parameters
        ----------
        parameters: itkOptimizerParametersD &

        """
        return _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_GetValuePointer(self, parameters)

    def CalculateFitError(self, setTestArray):
        r"""
        CalculateFitError(self, setTestArray) -> double

        Parameters
        ----------
        setTestArray: itkArrayD *

        """
        return _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_CalculateFitError(self, setTestArray)

    def EvaluateCumulativeGaussian(self, argument):
        r"""
        EvaluateCumulativeGaussian(self, argument) -> double

        Parameters
        ----------
        argument: double

        """
        return _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_EvaluateCumulativeGaussian(self, argument)

    def Initialize(self, rangeDimension):
        r"""
        Initialize(self, rangeDimension)

        Parameters
        ----------
        rangeDimension: unsigned int

        """
        return _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_Initialize(self, rangeDimension)

    def SetOriginalDataArray(self, setOriginalDataArray):
        r"""
        SetOriginalDataArray(self, setOriginalDataArray)

        Parameters
        ----------
        setOriginalDataArray: itkArrayD *

        """
        return _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_SetOriginalDataArray(self, setOriginalDataArray)
    __swig_destroy__ = _ITKCostFunctionsPython.delete_itkCumulativeGaussianCostFunction

    @staticmethod
    def cast(obj):
        r"""
        cast(obj) -> itkCumulativeGaussianCostFunction

        Parameters
        ----------
        obj: itkLightObject *

        """
        return _ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_cast(obj)

    def New(*args, **kargs):
        """New() -> itkCumulativeGaussianCostFunction

        Create a new object of the class itkCumulativeGaussianCostFunction and set the input and the parameters if some
        named or non-named arguments are passed to that method.

        New() tries to assign all the non named parameters to the input of the new objects - the
        first non named parameter in the first input, etc.

        The named parameters are used by calling the method with the same name prefixed by 'Set'.

        Ex:

          itkCumulativeGaussianCostFunction.New(reader, threshold=10)

        is (most of the time) equivalent to:

          obj = itkCumulativeGaussianCostFunction.New()
          obj.SetInput(0, reader.GetOutput())
          obj.SetThreshold(10)
        """
        obj = itkCumulativeGaussianCostFunction.__New_orig__()
        from itk.support import template_class
        template_class.New(obj, *args, **kargs)
        return obj
    New = staticmethod(New)


# Register itkCumulativeGaussianCostFunction in _ITKCostFunctionsPython:
_ITKCostFunctionsPython.itkCumulativeGaussianCostFunction_swigregister(itkCumulativeGaussianCostFunction)

