34 #include <itkConnectedThresholdImageFilter.h>
72 m_PointSet->RemoveObserver(m_PointSetAddObserverTag);
94 Superclass::Activated();
97 m_WorkingData = this->GetWorkingData();
100 if (!dataStorage->
Exists(m_PointSetNode))
101 dataStorage->
Add(m_PointSetNode, m_WorkingData);
104 dataStorage->
Add(m_ResultNode, m_WorkingData);
114 Superclass::Deactivated();
119 return this->m_ToolManager->GetReferenceData(0);
124 return this->m_ToolManager->GetDataStorage();
129 return this->m_ToolManager->GetWorkingData(0);
134 return m_PointSetNode;
139 if (m_WorkingData != this->GetWorkingData())
143 if (dataStorage->
Exists(m_PointSetNode))
145 dataStorage->
Remove(m_PointSetNode);
146 dataStorage->
Add(m_PointSetNode, this->GetWorkingData());
149 if (dataStorage->
Exists(m_ResultNode))
151 dataStorage->
Remove(m_ResultNode);
152 dataStorage->
Add(m_ResultNode, this->GetWorkingData());
155 m_WorkingData = this->GetWorkingData();
168 if (orgImage.IsNotNull())
170 if (orgImage->GetDimension() == 4)
173 timeSelector->SetInput(orgImage);
174 timeSelector->SetTimeNr(timeStep);
175 timeSelector->UpdateLargestPossibleRegion();
176 mitk::Image *timedImage = timeSelector->GetOutput();
180 else if (orgImage->GetDimension() == 3)
182 AccessByItk_2(orgImage, StartRegionGrowing, orgImage->GetGeometry(), seedPoint);
184 this->m_PointSet->Clear();
188 template <
typename TPixel,
unsigned int VImageDimension>
194 typedef typename InputImageType::IndexType IndexType;
195 typedef itk::ConnectedThresholdImageFilter<InputImageType, InputImageType> RegionGrowingFilterType;
203 regionGrower->SetInput(itkImage);
204 regionGrower->AddSeed(seedIndex);
206 regionGrower->SetLower(1);
207 regionGrower->SetUpper(255);
211 regionGrower->Update();
213 catch (
const itk::ExceptionObject &)
225 resultLabelSetImage->InitializeByLabeledImage(resultImage);
227 m_ResultNode->SetData(resultLabelSetImage);
237 float rgb[3] = {1.0f, 0.0f, 0.0f};
238 m_WorkingData->GetColor(rgb);
241 float opacity = 1.0f;
242 m_WorkingData->GetOpacity(opacity, NULL);
245 newNode->SetData(m_ResultNode->GetData());
248 m_WorkingData->SetVisibility(
false);
250 m_ResultNode->SetData(NULL);
virtual void Add(mitk::DataNode *node, const mitk::DataStorage::SetOfObjects *parents=nullptr)=0
Adds a DataNode containing a data object to its internal storage.
Data management class that handles 'was created by' relations.
itk::SmartPointer< Self > Pointer
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
static vtkRenderWindow * GetRenderWindowByName(const std::string &name)
#define MITKSEGMENTATION_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
static mitk::DataStorage::Pointer GetDataStorage()
Image::Pointer ImportItkImage(const itk::SmartPointer< ItkOutputImageType > &itkimage, const BaseGeometry *geometry=nullptr, bool update=true)
Imports an itk::Image (with a specific type) as an mitk::Image.Instantiates instance of ITKImageImpor...
itk::Image< double, 3 > InputImageType
static RenderingManager * GetInstance()
Module * GetModule() const
Image class for storing images.
virtual unsigned int GetTimeStep() const
virtual bool Exists(const mitk::DataNode *node) const =0
Checks if a node exists in the DataStorage.
#define AccessByItk_2(mitkImage, itkImageTypeFunction, arg1, arg2)
virtual void Remove(const mitk::DataNode *node)=0
Removes node from the DataStorage.
ModuleResource GetResource(const std::string &path) const
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the geometry, which is a TimeGeometry, of the data as non-const pointer.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
BaseGeometry Describes the geometry of a data object.
Class for nodes of the DataTree.
void WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const
Convert world coordinates (in mm) of a point to (continuous!) index coordinates.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.