Medical Imaging Interaction Toolkit  2018.4.99-4c24e3cb
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 #include <mitkInteractionConst.h>
15 #include <mitkPointOperation.h>
16 
18 {
19  itk::DataObject::Pointer output = this->MakeOutput(0);
20  this->SetNumberOfRequiredInputs(1);
21  this->SetNumberOfRequiredOutputs(1);
22  this->SetNthOutput(0, output.GetPointer());
23 }
25 {
26 }
27 
29 {
30  mitk::ContourModel::Pointer inputContour = static_cast<mitk::ContourModel *>(this->GetInput(0));
32 
33  auto it = inputContour->IteratorBegin();
34  auto end = inputContour->IteratorEnd();
35  unsigned int pointId = 0;
36 
37  std::size_t timestep = inputContour->GetTimeSteps();
38 
39  for (std::size_t i = 0; i < timestep; i++)
40  {
41  while (it <= end)
42  {
43  mitk::Point3D p = (*it)->Coordinates;
44  mitk::PointOperation popInsert(
45  mitk::OpINSERT, inputContour->GetTimeGeometry()->TimeStepToTimePoint(timestep), p, pointId++, false);
46 
47  outputPointSet->ExecuteOperation(&popInsert);
48 
49  it++;
50  }
51  }
52 }
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
void ExecuteOperation(Operation *operation) override
executes the given Operation
OutputType * GetOutput()
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:75
Operation that handles all actions on one Point.