MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkBasicCombinationOpenCVImageFilter.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
14
15#include <algorithm>
16
17namespace mitk {
18
20{
21 int imageId = this->GetCurrentImageId();
22
23 // go through the list of all filters
24 for ( auto it
25 = m_FilterList.begin(); it != m_FilterList.end(); ++it )
26 {
27 // apply current filter and return false if the filter returned false
28 if (! (*it)->FilterImage(image, imageId) ) { return false; }
29 }
30
31 return true;
32}
33
34void BasicCombinationOpenCVImageFilter::PushFilter( AbstractOpenCVImageFilter::Pointer filter )
35{
36 m_FilterList.push_back(filter);
37}
38
39AbstractOpenCVImageFilter::Pointer BasicCombinationOpenCVImageFilter::PopFilter( )
40{
41 AbstractOpenCVImageFilter::Pointer lastFilter = m_FilterList.at(m_FilterList.size()-1);
42 m_FilterList.pop_back();
43 return lastFilter;
44}
45
46bool BasicCombinationOpenCVImageFilter::RemoveFilter( AbstractOpenCVImageFilter::Pointer filter )
47{
48 for ( auto it
49 = m_FilterList.begin(); it != m_FilterList.end(); it++ )
50 {
51 if (*it == filter) {
52 m_FilterList.erase(it);
53 return true;
54 }
55 }
56
57 return false;
58}
59
60bool BasicCombinationOpenCVImageFilter::GetIsFilterOnTheList( AbstractOpenCVImageFilter::Pointer filter )
61{
62 return std::find(m_FilterList.begin(), m_FilterList.end(), filter) != m_FilterList.end();
63}
64
69} // namespace mitk
AbstractOpenCVImageFilter::Pointer PopFilter()
Remove and return the last filter added to the list of filters.
bool OnFilterImage(cv::Mat &image) override
Apply list of filters to the given image.
std::vector< AbstractOpenCVImageFilter::Pointer > m_FilterList
All filters applied to the given image during call of mitk::mitkBasicCombinationOpenCVImageFilter::Fi...
bool RemoveFilter(AbstractOpenCVImageFilter::Pointer filter)
Remove the given filter from the list of filters.
bool GetIsFilterOnTheList(AbstractOpenCVImageFilter::Pointer filter)
Get the information if the given filter is on the filter list.
bool GetIsEmpty()
Get the information if no filter is on the filter list.
void PushFilter(AbstractOpenCVImageFilter::Pointer filter)
Push an additional filter to the list of filters for applying to an image.
IGT Exceptions.