20 #include <itkImageRegionIterator.h> 22 #include "mitkPixelManipulationTool.xpm" 39 Superclass::Activated();
45 if (m_OriginalImageNode.IsNotNull())
48 if (image.IsNotNull())
62 Superclass::Deactivated();
67 return "pixelmanipulation";
72 return mitkPixelManipulationTool_xpm;
94 filter->SetBoundingObject(boundingObject);
95 filter->SetInput(image);
97 roi = filter->GetOutput();
103 newImage->Initialize(image);
114 template <
typename TPixel,
unsigned int VImageDimension>
120 typedef itk::Image<TPixel, VImageDimension> itkImageType;
121 typedef itk::Image<unsigned char, 3> itkMaskType;
122 typename itkImageType::Pointer itkImage;
123 typename itkMaskType::Pointer itkMask;
127 typedef itk::ImageRegionConstIterator<itkImageType> InputIteratorType;
128 typedef itk::ImageRegionIterator<itkImageType> OutputIteratorType;
129 typedef itk::ImageRegionConstIterator<itkMaskType> MaskIteratorType;
131 MaskIteratorType maskIterator(itkMask, itkMask->GetLargestPossibleRegion());
132 InputIteratorType inputIterator(originalImage, originalImage->GetLargestPossibleRegion());
133 OutputIteratorType outputIterator(itkImage, itkImage->GetLargestPossibleRegion());
135 inputIterator.GoToBegin();
136 outputIterator.GoToBegin();
137 maskIterator.GoToBegin();
139 while (!outputIterator.IsAtEnd())
141 if (maskIterator.Get())
144 outputIterator.Set(newValue);
146 outputIterator.Set(inputIterator.Get() + newValue);
149 outputIterator.Set(inputIterator.Get());
159 if (image.IsNotNull())
163 name.append(
"_modified");
166 node->SetData(image);
#define AccessByItk_3(mitkImage, itkImageTypeFunction, arg1, arg2, arg3)
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
virtual void Add(DataNode *node, const DataStorage::SetOfObjects *parents=nullptr)=0
Adds a DataNode containing a data object to its internal storage.
superclass of all bounding objects (cylinder, cuboid,...)
MITK_TOOL_MACRO(MITKSEGMENTATION_EXPORT, LiveWireTool2D, "LiveWire tool")
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
Image class for storing images.
mitk::Image::Pointer image
void MITKCORE_EXPORT CastToItkImage(const mitk::Image *mitkImage, itk::SmartPointer< ItkOutputImageType > &itkOutputImage)
Cast an mitk::Image to an itk::Image with a specific type.
Class for nodes of the DataTree.