Medical Imaging Interaction Toolkit  2016.11.0
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,
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 
19 #include <vtkPoints.h>
20 #include <vtkSmartPointer.h>
21 #include <vtkUnstructuredGrid.h>
22 
23 #include <itkImageRegionIterator.h>
24 
25 #include <mitkImageAccessByItk.h>
26 
28 {
29  this->m_UnstructGrid = mitk::UnstructuredGrid::New();
30 }
31 
33 {
34 }
35 
37 {
38  this->ProcessObject::SetNthInput(0, const_cast<mitk::UnstructuredGrid *>(grid));
39 }
40 
42 {
43  this->SetNumberOfIndexedOutputs(this->GetNumberOfIndexedInputs());
44  for (unsigned int idx = 0; idx < this->GetNumberOfIndexedInputs(); ++idx)
45  {
46  if (this->GetOutput(idx) == nullptr)
47  {
49  this->SetNthOutput(idx, newOutputX);
50  }
51  }
52  this->Modified();
53 }
54 
56 {
57  if (this->GetInput(idx) != grid)
58  {
59  this->SetNthInput(idx, const_cast<mitk::UnstructuredGrid *>(grid));
60  this->CreateOutputsForAllInputs(idx);
61  this->Modified();
62  }
63 }
64 
66 {
67  if (this->GetNumberOfInputs() < 1)
68  return nullptr;
69 
70  return static_cast<const mitk::UnstructuredGrid *>(this->ProcessObject::GetInput(0));
71 }
72 
74 {
75  if (this->GetNumberOfInputs() < 1)
76  return nullptr;
77 
78  return static_cast<const mitk::UnstructuredGrid *>(this->ProcessObject::GetInput(idx));
79 }
80 
82 {
83  mitk::UnstructuredGrid::ConstPointer inputImage = this->GetInput();
84 
85  m_UnstructGrid = this->GetOutput();
86 
87  itkDebugMacro(<< "GenerateOutputInformation()");
88 
89  if (inputImage.IsNull())
90  return;
91 }
static Pointer New()
Class for storing unstructured grids (vtkUnstructuredGrid)