Medical Imaging Interaction Toolkit  2018.4.99-87d68d9f
Medical Imaging Interaction Toolkit
mitkDataCollectionImageIterator.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 mitkDataCollectionImageIterator_H
15 #define mitkDataCollectionImageIterator_H
16 
17 #include <mitkImageCast.h>
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 typename ImageType::Pointer ImagePointerType;
35  typedef itk::ImageRegionIterator<ImageType> ImageIterator;
36 
37  DataCollectionImageIterator(DataCollection::Pointer collection, std::string imageName);
38 
39  void ToBegin();
40 
41  bool IsAtEnd();
42 
43  void operator++();
44 
45  // TODO refactor implementation
46  void operator++(int);
47 
48  TDataType GetVoxel();
49 
50  void SetVoxel(TDataType value);
51 
52  size_t GetIndex();
53  size_t GetImageIndex () { return m_ImageIndex;}
54 
55  std::string GetFilePrefix();
56 
57  void NextObject();
58 
59  ImageIterator GetImageIterator();
60 
61  private:
62  DataCollectionImageIterator<TDataType, ImageDimension>* GetNextDataCollectionIterator(size_t start);
63 
64  // DATA
65  DataCollection::Pointer m_Collection;
66  std::string m_ImageName;
67 
68  bool m_IsAtEnd;
69  bool m_IteratingImages;
70  size_t m_CurrentIndex;
71  size_t m_ImageIndex;
72 
73  size_t m_CurrentElement;
74  DataCollectionImageIterator<TDataType, ImageDimension>* m_CurrentCollectionIterator;
75  ImageIterator m_CurrentIterator;
76  };
77 } // end namespace
78 
80 #endif //mitkDataCollectionImageIterator_H
DataCollection - Class to facilitate loading/accessing structured data.
DataCollectionImageIterator(DataCollection::Pointer collection, std::string imageName)
itk::ImageRegionIterator< ImageType > ImageIterator
itk::Image< TDataType, ImageDimension > ImageType