17 #ifndef mitkDataCollectionImageIterator_CXX
18 #define mitkDataCollectionImageIterator_CXX
23 template <
typename TDataType,
int TImageDimension>
26 m_Collection(collection), m_ImageName(imageName), m_IsAtEnd(false),
27 m_IteratingImages(true), m_CurrentIndex(0),
28 m_CurrentElement(0), m_CurrentCollectionIterator(0)
33 template <
typename TDataType,
int TImageDimension>
39 m_IteratingImages =
false;
44 if (m_Collection->HasElement(m_ImageName))
55 m_Collection->SetData(itkObject, m_ImageName);
58 ImageType * image =
dynamic_cast<ImageType*
>(m_Collection->GetData(m_ImageName).GetPointer());
61 m_IteratingImages =
true;
62 m_CurrentIterator =
ImageIterator(image, image->GetLargestPossibleRegion());
65 if (!m_IteratingImages)
67 if (m_CurrentCollectionIterator != 0)
69 delete m_CurrentCollectionIterator;
70 m_CurrentCollectionIterator = 0;
73 m_CurrentCollectionIterator = GetNextDataCollectionIterator(m_CurrentElement);
74 if (m_CurrentCollectionIterator == 0)
79 m_CurrentIterator = m_CurrentCollectionIterator->GetImageIterator();
84 template <
typename TDataType,
int TImageDimension>
92 template <
typename TDataType,
int TImageDimension>
100 if (m_CurrentIterator.IsAtEnd())
107 template <
typename TDataType,
int TImageDimension>
115 if (m_CurrentIterator.IsAtEnd())
122 template <
typename TDataType,
int TImageDimension>
129 while (index < m_Collection->Size() && iterator == 0)
132 collection =
dynamic_cast<DataCollection*
>(m_Collection->GetData(index).GetPointer());
148 m_CurrentElement = index;
152 template <
typename TDataType,
int TImageDimension>
157 return m_CurrentIterator.Get();
160 template <
typename TDataType,
int TImageDimension>
165 m_CurrentIterator.Set(value);
168 template <
typename TDataType,
int TImageDimension>
173 return m_CurrentIndex;
176 template <
typename TDataType,
int TImageDimension>
181 if (m_IteratingImages)
187 return m_Collection->IndexToName(m_CurrentElement) +
"/" + m_CurrentCollectionIterator->GetFilePrefix();
191 template <
typename TDataType,
int TImageDimension>
194 if (m_IteratingImages)
196 if (m_CurrentCollectionIterator != NULL)
198 delete m_CurrentCollectionIterator;
199 m_CurrentCollectionIterator = 0;
201 m_IteratingImages =
false;
202 m_CurrentElement = 0;
203 m_CurrentCollectionIterator = GetNextDataCollectionIterator(m_CurrentElement);
204 if (m_CurrentCollectionIterator == NULL)
212 m_CurrentCollectionIterator->NextObject();
213 if (m_CurrentCollectionIterator->IsAtEnd())
215 delete m_CurrentCollectionIterator;
216 m_CurrentCollectionIterator = GetNextDataCollectionIterator(m_CurrentElement+1);
218 if (m_CurrentCollectionIterator == NULL)
224 m_CurrentIterator = m_CurrentCollectionIterator->GetImageIterator();
227 template <
typename TDataType,
int TImageDimension>
231 return m_CurrentIterator;
234 #endif // mitkDataCollectionImageIterator_CXX
itk::SmartPointer< Self > Pointer
ImageIterator GetImageIterator()
void SetVoxel(TDataType value)
DataCollectionImageIterator(DataCollection::Pointer collection, std::string imageName)
itk::ImageRegionIterator< ImageType > ImageIterator
Image class for storing images.
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
itk::Image< TDataType, ImageDimension > ImageType
std::string GetFilePrefix()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.