Medical Imaging Interaction Toolkit  2018.4.99-dcb22cd7
Medical Imaging Interaction Toolkit
mitkPlanarFigureToPlanarFigureFilter.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 
16 {
17  this->SetNumberOfRequiredInputs(1);
18 }
19 
21 {
22 }
23 
25 {
26  this->SetInput(0, figure);
27 }
28 
29 void mitk::PlanarFigureToPlanarFigureFilter::SetInput(unsigned int idx, const InputType *figure)
30 {
31  if (this->GetInput(idx) != figure)
32  {
33  this->SetNthInput(idx, const_cast<InputType *>(figure));
34  // this->CreateOutputsForAllInputs();
35  this->Modified();
36  }
37 }
38 
40 {
41  if (this->GetNumberOfInputs() < 1)
42  return nullptr;
43 
44  return static_cast<const InputType *>(this->ProcessObject::GetInput(0));
45 }
46 
48  unsigned int idx)
49 {
50  if (this->GetNumberOfInputs() < idx)
51  return nullptr;
52 
53  return static_cast<const InputType *>(this->ProcessObject::GetInput(idx));
54 }
55 
57 {
58  this->SetNumberOfIndexedOutputs(this->GetNumberOfInputs()); // create outputs for all inputs
59  for (unsigned int idx = 0; idx < this->GetNumberOfOutputs(); ++idx)
60  {
61  if (this->GetOutput(idx) == nullptr)
62  {
63  DataObjectPointer newOutput = this->MakeOutput(idx);
64  this->SetNthOutput(idx, newOutput);
65  }
66  this->Modified();
67  }
68 }
mitkBaseDataSourceGetOutputDeclarations itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
OutputType * GetOutput()
DataCollection - Class to facilitate loading/accessing structured data.
Base class for all filters which have an object of type mitk::PlanarFigure as output.
itk::DataObject::Pointer DataObjectPointer
Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons...