Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkContourModelToPointSetFilter.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
18 #include <mitkInteractionConst.h>
19 #include <mitkPointOperation.h>
20 
22 {
23  itk::DataObject::Pointer output = this->MakeOutput(0);
24  this->SetNumberOfRequiredInputs(1);
25  this->SetNumberOfRequiredOutputs(1);
26  this->SetNthOutput(0, output.GetPointer());
27 }
29 {
30 }
31 
33 {
34  mitk::ContourModel::Pointer inputContour = static_cast<mitk::ContourModel *>(this->GetInput(0));
35  mitk::ContourModelToPointSetFilter::OutputType *outputPointSet = this->GetOutput();
36 
37  auto it = inputContour->IteratorBegin();
38  auto end = inputContour->IteratorEnd();
39  unsigned int pointId = 0;
40 
41  std::size_t timestep = inputContour->GetTimeSteps();
42 
43  for (std::size_t i = 0; i < timestep; i++)
44  {
45  while (it <= end)
46  {
47  mitk::Point3D p = (*it)->Coordinates;
48  mitk::PointOperation popInsert(
49  mitk::OpINSERT, inputContour->GetTimeGeometry()->TimeStepToTimePoint(timestep), p, pointId++, false);
50 
51  outputPointSet->ExecuteOperation(&popInsert);
52 
53  it++;
54  }
55  }
56 }
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
itk::SmartPointer< Self > Pointer
virtual itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
virtual void ExecuteOperation(Operation *operation) override
executes the given Operation
Constants for most interaction classes, due to the generic StateMachines.
Data structure which stores a set of points. Superclass of mitk::Mesh.
Definition: mitkPointSet.h:79
Operation that handles all actions on one Point.