Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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,
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 mitkDataCollectionImageIterator_H
19 #define mitkDataCollectionImageIterator_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;
39  typedef itk::ImageRegionIterator<ImageType> ImageIterator;
40 
41  DataCollectionImageIterator(DataCollection::Pointer collection, std::string imageName);
42 
43  void ToBegin();
44 
45  bool IsAtEnd();
46 
47  void operator++();
48 
49  // TODO refactor implementation
50  void operator++(int);
51 
52  TDataType GetVoxel();
53 
54  void SetVoxel(TDataType value);
55 
56  size_t GetIndex();
57  size_t GetImageIndex () { return m_ImageIndex;}
58 
59  std::string GetFilePrefix();
60 
61  void NextObject();
62 
63  ImageIterator GetImageIterator();
64 
65  private:
66  DataCollectionImageIterator<TDataType, ImageDimension>* GetNextDataCollectionIterator(size_t start);
67 
68  // DATA
69  DataCollection::Pointer m_Collection;
70  std::string m_ImageName;
71 
72  bool m_IsAtEnd;
73  bool m_IteratingImages;
74  size_t m_CurrentIndex;
75  size_t m_ImageIndex;
76 
77  size_t m_CurrentElement;
78  DataCollectionImageIterator<TDataType, ImageDimension>* m_CurrentCollectionIterator;
79  ImageIterator m_CurrentIterator;
80  };
81 } // end namespace
82 
84 #endif //mitkDataCollectionImageIterator_H
itk::SmartPointer< Self > Pointer
DataCollection - Class to facilitate loading/accessing structured data.
DataCollectionImageIterator(DataCollection::Pointer collection, std::string imageName)
itk::ImageRegionIterator< ImageType > ImageIterator
itk::Image< TDataType, ImageDimension > ImageType