diff --git a/Modules/Classification/CLActiveLearning/include/mitkPredictionConfidenceFilter.h b/Modules/Classification/CLActiveLearning/include/mitkPredictionConfidenceFilter.h new file mode 100644 index 0000000000..4878aad901 --- /dev/null +++ b/Modules/Classification/CLActiveLearning/include/mitkPredictionConfidenceFilter.h @@ -0,0 +1,48 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#ifndef mitkPredictionConfidenceFilter_h +#define mitkPredictionConfidenceFilter_h + +#include + +#include +#include + +namespace mitk +{ + + template + class MITKCLACTIVELEARNING_EXPORT PredictionConfidenceFilter : public mitk::PredictionUncertaintyFilter + { + + public: + + typedef mitk::PredictionUncertaintyFilter SuperClassName; + mitkClassMacro(PredictionConfidenceFilter, SuperClassName) + itkNewMacro(Self) + + protected: + +// PredictionConfidenceFilter(){} +// ~PredictionConfidenceFilter(){} + + OutputPixelType CalculateUncertainty(const InputPixelType& inputVector) override; + + }; + +} + +#endif diff --git a/Modules/Classification/CLActiveLearning/include/mitkPredictionEntropyFilter.h b/Modules/Classification/CLActiveLearning/include/mitkPredictionEntropyFilter.h new file mode 100644 index 0000000000..02ba2f94a5 --- /dev/null +++ b/Modules/Classification/CLActiveLearning/include/mitkPredictionEntropyFilter.h @@ -0,0 +1,48 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#ifndef mitkPredictionEntropyFilter_h +#define mitkPredictionEntropyFilter_h + +#include + +#include +#include + +namespace mitk +{ + + template + class MITKCLACTIVELEARNING_EXPORT PredictionEntropyFilter : public mitk::PredictionUncertaintyFilter + { + + public: + + typedef mitk::PredictionUncertaintyFilter SuperClassName; + mitkClassMacro(PredictionEntropyFilter, SuperClassName) + itkNewMacro(Self) + + protected: + +// PredictionEntropyFilter(){} +// ~PredictionEntropyFilter(){} + + OutputPixelType CalculateUncertainty(const InputPixelType& inputVector) override; + + }; + +} + +#endif diff --git a/Modules/Classification/CLActiveLearning/include/mitkPredictionMarginFilter.h b/Modules/Classification/CLActiveLearning/include/mitkPredictionMarginFilter.h new file mode 100644 index 0000000000..841e11b681 --- /dev/null +++ b/Modules/Classification/CLActiveLearning/include/mitkPredictionMarginFilter.h @@ -0,0 +1,48 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#ifndef mitkPredictionMarginFilter_h +#define mitkPredictionMarginFilter_h + +#include + +#include +#include + +namespace mitk +{ + + template + class MITKCLACTIVELEARNING_EXPORT PredictionMarginFilter : public mitk::PredictionUncertaintyFilter + { + + public: + + typedef mitk::PredictionUncertaintyFilter SuperClassName; + mitkClassMacro(PredictionMarginFilter, SuperClassName) + itkNewMacro(Self) + + protected: + +// PredictionMarginFilter(){} +// ~PredictionMarginFilter(){} + + OutputPixelType CalculateUncertainty(const InputPixelType& inputVector) override; + + }; + +} + +#endif diff --git a/Modules/Classification/CLActiveLearning/src/mitkPredictionConfidenceFilter.cpp b/Modules/Classification/CLActiveLearning/src/mitkPredictionConfidenceFilter.cpp new file mode 100644 index 0000000000..431b86b7e0 --- /dev/null +++ b/Modules/Classification/CLActiveLearning/src/mitkPredictionConfidenceFilter.cpp @@ -0,0 +1,34 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#include +#include + +namespace mitk +{ + + template + OutputPixelType PredictionConfidenceFilter::CalculateUncertainty(const InputPixelType& inputVector) + { + InputPixelType maxValue(0); + // Is there a better way to find the maximum of a itk::VariableLengthVector? + for (int i=0; i maxValue) maxValue = inputVector[i]; + } + return static_cast(1 - maxValue); + } + +} diff --git a/Modules/Classification/CLActiveLearning/src/mitkPredictionEntropyFilter.cpp b/Modules/Classification/CLActiveLearning/src/mitkPredictionEntropyFilter.cpp new file mode 100644 index 0000000000..de4687a1f6 --- /dev/null +++ b/Modules/Classification/CLActiveLearning/src/mitkPredictionEntropyFilter.cpp @@ -0,0 +1,33 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#include +#include + +namespace mitk +{ + + template + OutputPixelType PredictionEntropyFilter::CalculateUncertainty(const InputPixelType& inputVector) + { + InputPixelType result(0); + for (int i=0; iresult; + } + +} diff --git a/Modules/Classification/CLActiveLearning/src/mitkPredictionMarginFilter.cpp b/Modules/Classification/CLActiveLearning/src/mitkPredictionMarginFilter.cpp new file mode 100644 index 0000000000..88eb12ff81 --- /dev/null +++ b/Modules/Classification/CLActiveLearning/src/mitkPredictionMarginFilter.cpp @@ -0,0 +1,42 @@ +/*=================================================================== + +The Medical Imaging Interaction Toolkit (MITK) +Copyright (c) German Cancer Research Center, +Division of Medical and Biological Informatics. +All rights reserved. + +This software is distributed WITHOUT ANY WARRANTY; without +even the implied warranty of MERCHANTABILITY or FITNESS FOR +A PARTICULAR PURPOSE. + +See LICENSE.txt or http://www.mitk.org for details. + +===================================================================*/ + +#include +#include + +namespace mitk +{ + + template + OutputPixelType PredictionMarginFilter::CalculateUncertainty(const InputPixelType& inputVector) + { + InputPixelType firstMax(0); + InputPixelType secondMax(0); + for (int i=0; i firstMax) + { + secondMax = firstMax; + firstMax = inputVector[i]; + } + else if (inputVector[i] > secondMax) + { + secondMax = inputVector[i]; + } + return static_cast(firstMax - secondMax); + } + } + +}