28 #include <itkImageRegionIterator.h>
29 #include <itkImageSliceIteratorWithIndex.h>
32 : m_PlaneGeometry(nullptr),
33 m_ImageGeometry3D(nullptr),
37 m_CreateUndoInformation(false)
39 MITK_WARN <<
"Class is deprecated! Use mitkVtkImageOverwrite instead.";
66 if (input3D.IsNull() || m_SliceImage.IsNull())
69 if (input3D->GetDimension() == 4)
72 timeSelector->SetInput(input3D);
73 timeSelector->SetTimeNr(m_TimeStep);
74 timeSelector->UpdateLargestPossibleRegion();
75 input3D = timeSelector->GetOutput();
78 m_ImageGeometry3D = input3D->GetGeometry();
126 template <
typename TPixel,
unsigned int VImageDimension>
129 typedef itk::Image<TPixel, VImageDimension - 1> SliceImageType;
130 typedef itk::Image<TPixel, VImageDimension> VolumeImageType;
132 typedef itk::ImageSliceIteratorWithIndex<VolumeImageType> OutputSliceIteratorType;
133 typedef itk::ImageRegionConstIterator<SliceImageType> SliceIteratorType;
138 SliceIteratorType sliceIterator(sliceImage, sliceImage->GetLargestPossibleRegion());
140 sliceIterator.GoToBegin();
147 while (!sliceIterator.IsAtEnd())
149 currentPointIn2D[0] = sliceIterator.GetIndex()[0] + 0.5;
150 currentPointIn2D[1] = sliceIterator.GetIndex()[1] + 0.5;
151 currentPointIn2D[2] = 0;
153 m_PlaneGeometry->IndexToWorld(currentPointIn2D, worldPointIn3D);
155 typename itk::Image<TPixel, VImageDimension>::IndexType outputIndex;
156 m_ImageGeometry3D->WorldToIndex(worldPointIn3D, outputIndex);
159 if (m_ImageGeometry3D->IsIndexInside(outputIndex))
161 input3D->SetPixel(outputIndex, (TPixel)sliceIterator.Get());
itk::SmartPointer< Self > Pointer
#define AccessFixedDimensionByItk(mitkImage, itkImageTypeFunction, dimension)
Access a mitk-image with known dimension by an itk-image.
Constants for most interaction classes, due to the generic StateMachines.
void ItkSliceOverwriting(itk::Image< TPixel, VImageDimension > *input3D)
virtual void GenerateData() override
A version of GenerateData() specific for image processing filters.
OverwriteDirectedPlaneImageFilter()
InputImageType * GetInput(void)
virtual ~OverwriteDirectedPlaneImageFilter()
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.