Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkUnstructuredGridToUnstructuredGridFilter.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 
15 #include <vtkPoints.h>
16 #include <vtkSmartPointer.h>
17 #include <vtkUnstructuredGrid.h>
18 
19 #include <itkImageRegionIterator.h>
20 
21 #include <mitkImageAccessByItk.h>
22 
24 {
25  this->m_UnstructGrid = mitk::UnstructuredGrid::New();
26 }
27 
29 {
30 }
31 
33 {
34  this->ProcessObject::SetNthInput(0, const_cast<mitk::UnstructuredGrid *>(grid));
35 }
36 
38 {
39  this->SetNumberOfIndexedOutputs(this->GetNumberOfIndexedInputs());
40  for (unsigned int idx = 0; idx < this->GetNumberOfIndexedInputs(); ++idx)
41  {
42  if (this->GetOutput(idx) == nullptr)
43  {
45  this->SetNthOutput(idx, newOutputX);
46  }
47  }
48  this->Modified();
49 }
50 
52 {
53  if (this->GetInput(idx) != grid)
54  {
55  this->SetNthInput(idx, const_cast<mitk::UnstructuredGrid *>(grid));
56  this->CreateOutputsForAllInputs(idx);
57  this->Modified();
58  }
59 }
60 
62 {
63  if (this->GetNumberOfInputs() < 1)
64  return nullptr;
65 
66  return static_cast<const mitk::UnstructuredGrid *>(this->ProcessObject::GetInput(0));
67 }
68 
70 {
71  if (this->GetNumberOfInputs() < 1)
72  return nullptr;
73 
74  return static_cast<const mitk::UnstructuredGrid *>(this->ProcessObject::GetInput(idx));
75 }
76 
78 {
80 
81  m_UnstructGrid = this->GetOutput();
82 
83  itkDebugMacro(<< "GenerateOutputInformation()");
84 
85  if (inputImage.IsNull())
86  return;
87 }
OutputType * GetOutput()
static Pointer New()
Class for storing unstructured grids (vtkUnstructuredGrid)