Medical Imaging Interaction Toolkit  2016.11.0
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,
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 
20 {
21  this->SetNumberOfRequiredInputs(1);
22 }
23 
25 {
26 }
27 
29 {
30  this->SetInput(0, figure);
31 }
32 
33 void mitk::PlanarFigureToPlanarFigureFilter::SetInput(unsigned int idx, const InputType *figure)
34 {
35  if (this->GetInput(idx) != figure)
36  {
37  this->SetNthInput(idx, const_cast<InputType *>(figure));
38  // this->CreateOutputsForAllInputs();
39  this->Modified();
40  }
41 }
42 
44 {
45  if (this->GetNumberOfInputs() < 1)
46  return nullptr;
47 
48  return static_cast<const InputType *>(this->ProcessObject::GetInput(0));
49 }
50 
52  unsigned int idx)
53 {
54  if (this->GetNumberOfInputs() < idx)
55  return nullptr;
56 
57  return static_cast<const InputType *>(this->ProcessObject::GetInput(idx));
58 }
59 
61 {
62  this->SetNumberOfIndexedOutputs(this->GetNumberOfInputs()); // create outputs for all inputs
63  for (unsigned int idx = 0; idx < this->GetNumberOfOutputs(); ++idx)
64  {
65  if (this->GetOutput(idx) == nullptr)
66  {
67  DataObjectPointer newOutput = this->MakeOutput(idx);
68  this->SetNthOutput(idx, newOutput);
69  }
70  this->Modified();
71  }
72 }
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...