Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkDataCollectionSingleImageIterator.h
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 
17 
18 #ifndef mitkDataCollectionSingleImageIterator_H
19 #define mitkDataCollectionSingleImageIterator_H
20 
21 
22 #include <mitkDataCollection.h>
23 #include <itkImageRegionIterator.h>
24 
31 namespace mitk
32 {
33  template <typename TDataType, int ImageDimension>
35  {
36  public:
37  typedef itk::Image<TDataType, ImageDimension> ImageType;
38  typedef itk::ImageRegionIterator<ImageType> ImageIterator;
39 
40  DataCollectionSingleImageIterator(mitk::DataCollection * collection, std::string imageName);
41 
42  void ToBegin();
43 
44  bool IsAtEnd();
45 
46  void operator++();
47 
48  // TODO refactor implementation
49  void operator++(int);
50 
51  size_t GetIndex();
52 
53  std::string GetFilePrefix();
54 
55  void NextObject();
56 
57  ImageType * GetImage();
58 
59  void AddImage(ImageType * image, std::string name);
60 
61  private:
62  // Variables
63  DataCollection * m_Collection;
64  std::string m_ImageName;
65  bool m_IsAtEnd;
66  bool m_IteratingImages;
67  size_t m_CurrentIndex;
68  size_t m_CurrentElement;
69  ImageType * m_Image;
70  DataCollectionSingleImageIterator<TDataType, ImageDimension>* m_CurrentSingleCollectionIterator;
71 
72  // Methods
73  DataCollectionSingleImageIterator<TDataType, ImageDimension>* GetNextDataCollectionIterator(size_t start);
74 
75  };
76 } // end namespace
77 
79 #endif //mitkDataCollectionSingleImageIterator_H
DataCollectionSingleImageIterator(mitk::DataCollection *collection, std::string imageName)
DataCollection - Class to facilitate loading/accessing structured data.