4 #include <itkImageIterator.h>
5 #include <itkImageConstIterator.h>
12 if (pixelValue != m_IgnoredPixelValue)
14 m_IgnoredPixelValue = pixelValue;
29 if (IsUpdateRequired())
50 imgTimeSel->UpdateLargestPossibleRegion();
64 template <
typename TPixel,
unsigned int VImageDimension>
67 typedef itk::Image<TPixel, VImageDimension>
ImageType;
68 typedef itk::Image<unsigned short, VImageDimension> MaskType;
71 mask->SetOrigin(image->GetOrigin());
72 mask->SetSpacing(image->GetSpacing());
73 mask->SetLargestPossibleRegion(image->GetLargestPossibleRegion());
74 mask->SetBufferedRegion(image->GetBufferedRegion());
75 mask->SetDirection(image->GetDirection());
76 mask->SetNumberOfComponentsPerPixel(image->GetNumberOfComponentsPerPixel());
81 itk::ImageRegionConstIterator<ImageType> imageIterator(image, image->GetLargestPossibleRegion());
82 itk::ImageRegionIterator<MaskType> maskIterator(mask, mask->GetLargestPossibleRegion());
85 for (imageIterator.GoToBegin(); !imageIterator.IsAtEnd(); ++imageIterator, ++maskIterator)
87 if (imageIterator.Value() ==
static_cast<TPixel
>(m_IgnoredPixelValue))
96 bool IgnorePixelMaskGenerator::IsUpdateRequired()
const
98 unsigned long thisClassTimeStamp = this->GetMTime();
100 unsigned long inputImageTimeStamp =
m_inputImage->GetMTime();
102 if (thisClassTimeStamp > m_InternalMaskUpdateTime)
107 if (m_InternalMaskUpdateTime < inputImageTimeStamp)
112 if (internalMaskTimeStamp > m_InternalMaskUpdateTime)
mitk::Image::Pointer m_inputImage
void SetTimeStep(unsigned int timeStep)
SetTimeStep is used to set the time step for which the mask is to be generated.
itk::SmartPointer< Self > Pointer
mitk::Image::Pointer GetMask()
Computes and returns the mask.
DataCollection - Class to facilitate loading/accessing structured data.
void InternalCalculateMask(typename itk::Image< TPixel, VImageDimension > *image)
Image::Pointer GrabItkImageMemory(itk::SmartPointer< ItkOutputImageType > &itkimage, mitk::Image *mitkImage=nullptr, const BaseGeometry *geometry=nullptr, bool update=true)
Grabs the memory of an itk::Image (with a specific type) and puts it into an mitk::Image.The memory is managed by the mitk::Image after calling this function. The itk::Image remains valid until the mitk::Image decides to free the memory.
map::core::discrete::Elements< 3 >::InternalImageType ImageType
#define AccessByItk(mitkImage, itkImageTypeFunction)
Access a MITK image by an ITK image.
mitk::Image::Pointer m_InternalMask
void SetIgnoredPixelValue(RealType pixelValue)
The mask will be 0 there inputImage==pixelValue and 1 otherwise.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.