Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkDataCollectionVectorImageIterator.cxx
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 "itkImageRegionConstIterator.h"
20 
21 #include "itkComposeImageFilter.h"
22 
23 template<typename TDataType, int ImageDimension>
24 inline
26  DataCollection::Pointer collection, std::vector<std::string> featureNames) :
27  m_Collection(collection)
28  {
29  for(std::vector<std::string>::iterator featureNameIterator = featureNames.begin();
30  featureNameIterator != featureNames.end();
31  ++featureNameIterator)
32  {
33  SingleImageIterator featureIterator(collection, *featureNameIterator);
34  m_FeatureIterators.push_back(featureIterator);
35  }
36  }
37 
38 template<typename TDataType, int ImageDimension>
39 inline void
41 {
42  for(typename DataCollectionSingleImageIterators::iterator it = m_FeatureIterators.begin();
43  it != m_FeatureIterators.end();
44  ++it)
45  {
46  it->ToBegin();
47  }
48 }
49 
50 template<typename TDataType, int ImageDimension>
51 inline bool
53 {
54  return m_FeatureIterators.at(0).IsAtEnd();
55 }
56 
57 template<typename TDataType, int ImageDimension>
60 {
61  for(typename DataCollectionSingleImageIterators::iterator it = m_FeatureIterators.begin();
62  it != m_FeatureIterators.end();
63  ++it)
64  {
65  ++(*it);
66  }
67  return *this;
68 }
69 
70 template<typename TDataType, int ImageDimension>
73 {
75  ++result;
76  return result;
77 }
78 
79 
80 
81 template<typename TDataType, int ImageDimension>
84 {
85  typedef typename itk::Image<TDataType, ImageDimension> ImageType;
86 
89 
90  // create image iterators from collection iterators
91  for (unsigned i = 0; i < m_FeatureIterators.size(); i++)
92  {
93  composeImageFilter->SetInput(i, m_FeatureIterators.at(i).GetImage());
94  }
95 
96  composeImageFilter->Update();
97 
98  composeImageFilter->GetOutput()->SetRequestedRegionToLargestPossibleRegion();
99 
100  return composeImageFilter->GetOutput();
101 }
102 
103 template<typename TDataType, int ImageDimension>
104 inline void
106  typename itk::Image<TDataType, ImageDimension>::Pointer image, std::string name)
107  {
108  m_FeatureIterators.at(m_FeatureIterators.size()-1).AddImage(image, name);
109  }
itk::SmartPointer< Self > Pointer
void AddImage(typename itk::Image< TDataType, ImageDimension >::Pointer image, std::string name)
map::core::discrete::Elements< 3 >::InternalImageType ImageType
DataCollectionVectorImageIterator(DataCollection::Pointer collection, std::vector< std::string > featureNames)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.