diff --git a/Modules/Classification/CLActiveLearning/include/mitkPredictionConfidenceFilter.h b/Modules/Classification/CLActiveLearning/include/mitkPredictionConfidenceFilter.h index 4878aad901..26c265ba0b 100644 --- a/Modules/Classification/CLActiveLearning/include/mitkPredictionConfidenceFilter.h +++ b/Modules/Classification/CLActiveLearning/include/mitkPredictionConfidenceFilter.h @@ -1,48 +1,51 @@ /*=================================================================== 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; + private: + + // ITK examples do this... + PredictionConfidenceFilter(const Self&); + void operator=(const Self&); + }; } #endif diff --git a/Modules/Classification/CLActiveLearning/include/mitkPredictionEntropyFilter.h b/Modules/Classification/CLActiveLearning/include/mitkPredictionEntropyFilter.h index 02ba2f94a5..b500499809 100644 --- a/Modules/Classification/CLActiveLearning/include/mitkPredictionEntropyFilter.h +++ b/Modules/Classification/CLActiveLearning/include/mitkPredictionEntropyFilter.h @@ -1,48 +1,51 @@ /*=================================================================== 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; + private: + + // ITK examples do this... + PredictionEntropyFilter(const Self&); + void operator=(const Self&); + }; } #endif diff --git a/Modules/Classification/CLActiveLearning/include/mitkPredictionMarginFilter.h b/Modules/Classification/CLActiveLearning/include/mitkPredictionMarginFilter.h index 841e11b681..4120da6081 100644 --- a/Modules/Classification/CLActiveLearning/include/mitkPredictionMarginFilter.h +++ b/Modules/Classification/CLActiveLearning/include/mitkPredictionMarginFilter.h @@ -1,48 +1,51 @@ /*=================================================================== 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; + private: + + // ITK examples do this... + PredictionMarginFilter(const Self&); + void operator=(const Self&); + }; } #endif diff --git a/Modules/Classification/CLActiveLearning/include/mitkPredictionUncertaintyFilter.h b/Modules/Classification/CLActiveLearning/include/mitkPredictionUncertaintyFilter.h index 21e832c99f..b114ad9c6a 100644 --- a/Modules/Classification/CLActiveLearning/include/mitkPredictionUncertaintyFilter.h +++ b/Modules/Classification/CLActiveLearning/include/mitkPredictionUncertaintyFilter.h @@ -1,68 +1,75 @@ /*=================================================================== 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 mitkPredictionUncertaintyFilter_h #define mitkPredictionUncertaintyFilter_h #include #include // ITK #include #include #include namespace mitk { - + /** \class PredictionUncertaintyFilter + * \brief Base class for filters that calculate an uncertainty measure on a vector image + * + * The input image should be a vector image. For each vector, the entries represent class + * probabilities. From these an uncertainty is calculated, so that one vector of probabilities + * will result in a scalar uncertainty. + * Derivative classes will need to implement CalculateUncertainty. + */ template class MITKCLACTIVELEARNING_EXPORT PredictionUncertaintyFilter : public itk::ImageToImageFilter { public: typedef itk::ImageToImageFilter SuperClassName; mitkClassMacro(PredictionUncertaintyFilter, SuperClassName) itkNewMacro(Self) -// itkFactorylessNewMacro(Self) + // For some reason the typedefs from the ImageToImageFilter are not passed on typedef typename Superclass::InputImageDimension InputDimension; typedef typename Superclass::InputImagePixelType InputPixelType; typedef typename Superclass::InputImageRegionType InputRegionType; typedef typename Superclass::OutputImageDimension OutputDimension; typedef typename Superclass::OutputImagePixelType OutputPixelType; typedef typename Superclass::OutputImageRegionType OutputRegionType; protected: PredictionUncertaintyFilter(){} ~PredictionUncertaintyFilter(){} - virtual OutputPixelType CalculateUncertainty(const InputPixelType& inputVector); + virtual OutputPixelType CalculateUncertainty(const InputPixelType& inputVector) = 0; virtual void ThreadedGenerateData(const OutputRegionType& outputRegionForThread, itk::ThreadIdType threadId); private: // ITK examples do this... PredictionUncertaintyFilter(const Self&); void operator=(const Self&); }; } #endif diff --git a/Modules/Classification/CLActiveLearning/include/mitkSelectHighestUncertaintyRegionFilter.h b/Modules/Classification/CLActiveLearning/include/mitkSelectHighestUncertaintyRegionFilter.h new file mode 100644 index 0000000000..86edfcf809 --- /dev/null +++ b/Modules/Classification/CLActiveLearning/include/mitkSelectHighestUncertaintyRegionFilter.h @@ -0,0 +1,66 @@ +/*=================================================================== + +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 mitkSelectHighestUncertaintyRegionFilter_h +#define mitkSelectHighestUncertaintyRegionFilter_h + +#include + +#include + +// ITK +#include + +namespace mitk +{ + /** \class SelectHighestUncertaintyRegionFilter + * \brief This class will black out everything that is not part of the region with the highest uncertainty + * + * Expects an already thresholded image (i.e. values smaller threshold = 0). Will black out everything that does + * not belong to the region with the highest sum of uncertainties. + */ + + template + class MITKCLACTIVELEARNING_EXPORT SelectHighestUncertaintyRegionFilter : public itk::LabelShapeKeepNObjectsImageFilter + { + + public: + + typedef itk::LabelShapeKeepNObjectsImageFilter SuperClassName; + mitkClassMacro(SelectHighestUncertaintyRegionFilter, SuperClassName) + itkNewMacro(Self) + + // We want the attribute to be fixed + void SetAttribute(AttributeType) override = 0; + void SetAttribute(const std::string&) override = 0; + + protected: + + SelectHighestUncertaintyRegionFilter(); + ~SelectHighestUncertaintyRegionFilter(){} + + private: + + // ITK examples do this... + SelectHighestUncertaintyRegionFilter(const Self&); + void operator=(const Self&); + + AttributeType m_Attribute; + + }; + +} + +#endif diff --git a/Modules/Classification/CLActiveLearning/src/mitkSelectHighestUncertaintyRegionFilter.cpp b/Modules/Classification/CLActiveLearning/src/mitkSelectHighestUncertaintyRegionFilter.cpp new file mode 100644 index 0000000000..fba2fd9b35 --- /dev/null +++ b/Modules/Classification/CLActiveLearning/src/mitkSelectHighestUncertaintyRegionFilter.cpp @@ -0,0 +1,31 @@ +/*=================================================================== + +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. + +===================================================================*/ + +// MITK +#include + +namespace mitk +{ + + template + SelectHighestUncertaintyRegionFilter::SelectHighestUncertaintyRegionFilter() + { + m_Attribute = LabelObjectType::PHYSICAL_SIZE; + SetBackgroundValue(0); + SetNumberOfObjects(1); + SetReverseOrdering(false); + } + +}