Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkBasicCombinationOpenCVImageFilter.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 
19 #include "cv.h"
20 
21 namespace mitk {
22 
24 {
25  int imageId = this->GetCurrentImageId();
26 
27  // go through the list of all filters
28  for ( auto it
29  = m_FilterList.begin(); it != m_FilterList.end(); ++it )
30  {
31  // apply current filter and return false if the filter returned false
32  if (! (*it)->FilterImage(image, imageId) ) { return false; }
33  }
34 
35  return true;
36 }
37 
39 {
40  m_FilterList.push_back(filter);
41 }
42 
44 {
46  m_FilterList.pop_back();
47  return lastFilter;
48 }
49 
51 {
52  for ( auto it
53  = m_FilterList.begin(); it != m_FilterList.end(); it++ )
54  {
55  if (*it == filter) {
56  m_FilterList.erase(it);
57  return true;
58  }
59  }
60 
61  return false;
62 }
63 
65 {
66  return std::find(m_FilterList.begin(), m_FilterList.end(), filter) != m_FilterList.end();
67 }
68 
70 {
71  return m_FilterList.empty();
72 }
73 } // namespace mitk
bool GetIsEmpty()
Get the information if no filter is on the filter list.
itk::SmartPointer< Self > Pointer
bool OnFilterImage(cv::Mat &image) override
Apply list of filters to the given image.
DataCollection - Class to facilitate loading/accessing structured data.
bool RemoveFilter(AbstractOpenCVImageFilter::Pointer filter)
Remove the given filter from the list of filters.
AbstractOpenCVImageFilter::Pointer PopFilter()
Remove and return the last filter added to the list of filters.
void PushFilter(AbstractOpenCVImageFilter::Pointer filter)
Push an additional filter to the list of filters for applying to an image.
std::vector< AbstractOpenCVImageFilter::Pointer > m_FilterList
All filters applied to the given image during call of mitk::mitkBasicCombinationOpenCVImageFilter::Fi...
bool GetIsFilterOnTheList(AbstractOpenCVImageFilter::Pointer filter)
Get the information if the given filter is on the filter list.