17 #ifndef mitkDataCollectionSingleImageIterator_CXX
18 #define mitkDataCollectionSingleImageIterator_CXX
23 template <
typename TDataType,
int TImageDimension>
26 m_Collection(collection),
27 m_ImageName(imageName),
29 m_IteratingImages(true),
32 m_CurrentSingleCollectionIterator(NULL)
37 template <
typename TDataType,
int TImageDimension>
44 m_IteratingImages =
false;
48 if (m_Collection->HasElement(m_ImageName))
57 m_Collection->SetData(itkObject, m_ImageName);
60 ImageType * image =
dynamic_cast<ImageType*
>(m_Collection->GetData(m_ImageName).GetPointer());
66 if (m_Image ==
nullptr)
69 m_CurrentSingleCollectionIterator = GetNextDataCollectionIterator(m_CurrentElement);
70 if (m_Image ==
nullptr)
75 m_Image = m_CurrentSingleCollectionIterator->GetImage();
80 template <
typename TDataType,
int TImageDimension>
88 template <
typename TDataType,
int TImageDimension>
97 template <
typename TDataType,
int TImageDimension>
106 template <
typename TDataType,
int TImageDimension>
111 return m_CurrentIndex;
114 template <
typename TDataType,
int TImageDimension>
119 if (m_IteratingImages)
125 return m_Collection->IndexToName(m_CurrentElement) +
"/" + m_CurrentSingleCollectionIterator->GetFilePrefix();
129 template <
typename TDataType,
int TImageDimension>
133 if (m_Collection->HasElement(m_ImageName))
135 if (m_CurrentSingleCollectionIterator != NULL)
137 delete m_CurrentSingleCollectionIterator;
138 m_CurrentSingleCollectionIterator = 0;
140 m_CurrentElement = 0;
142 m_CurrentSingleCollectionIterator = GetNextDataCollectionIterator(m_CurrentElement);
143 if (m_CurrentSingleCollectionIterator == NULL)
151 m_CurrentSingleCollectionIterator->NextObject();
152 if (m_CurrentSingleCollectionIterator->IsAtEnd())
154 delete m_CurrentSingleCollectionIterator;
155 m_CurrentSingleCollectionIterator = GetNextDataCollectionIterator(m_CurrentElement+1);
157 if (m_CurrentSingleCollectionIterator == NULL)
165 template <
typename TDataType,
int TImageDimension>
173 template <
typename TDataType,
int TImageDimension>
178 if (m_Collection->HasElement(m_ImageName))
181 m_Collection->AddData(dataObject, name);
184 m_CurrentSingleCollectionIterator->AddImage(image, name);
188 template <
typename TDataType,
int TImageDimension>
195 while (index < m_Collection->Size() && iterator == 0)
198 collection =
dynamic_cast<DataCollection*
>(m_Collection->GetData(index).GetPointer());
214 m_CurrentElement = index;
itk::SmartPointer< Self > Pointer
DataCollectionSingleImageIterator(mitk::DataCollection *collection, std::string imageName)
itk::Image< TDataType, ImageDimension > ImageType
void AddImage(ImageType *image, std::string name)
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.
std::string GetFilePrefix()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.