Medical Imaging Interaction Toolkit  2018.4.99-87d68d9f
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef mitkDataCollectionSingleImageIterator_H
15 #define mitkDataCollectionSingleImageIterator_H
16 
17 
18 #include <mitkDataCollection.h>
19 #include <itkImageRegionIterator.h>
20 
27 namespace mitk
28 {
29  template <typename TDataType, int ImageDimension>
31  {
32  public:
33  typedef itk::Image<TDataType, ImageDimension> ImageType;
34  typedef itk::ImageRegionIterator<ImageType> ImageIterator;
35 
36  DataCollectionSingleImageIterator(mitk::DataCollection * collection, std::string imageName);
37 
38  void ToBegin();
39 
40  bool IsAtEnd();
41 
42  void operator++();
43 
44  // TODO refactor implementation
45  void operator++(int);
46 
47  size_t GetIndex();
48 
49  std::string GetFilePrefix();
50 
51  void NextObject();
52 
53  ImageType * GetImage();
54 
55  void AddImage(ImageType * image, std::string name);
56 
57  private:
58  // Variables
59  DataCollection * m_Collection;
60  std::string m_ImageName;
61  bool m_IsAtEnd;
62  bool m_IteratingImages;
63  size_t m_CurrentIndex;
64  size_t m_CurrentElement;
65  ImageType * m_Image;
66  DataCollectionSingleImageIterator<TDataType, ImageDimension>* m_CurrentSingleCollectionIterator;
67 
68  // Methods
69  DataCollectionSingleImageIterator<TDataType, ImageDimension>* GetNextDataCollectionIterator(size_t start);
70 
71  };
72 } // end namespace
73 
75 #endif //mitkDataCollectionSingleImageIterator_H
DataCollectionSingleImageIterator(mitk::DataCollection *collection, std::string imageName)
DataCollection - Class to facilitate loading/accessing structured data.
mitk::Image::Pointer image