Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkNavigationDataDisplacementFilter.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 #include "mitkPropertyList.h"
19 #include "mitkProperties.h"
20 
23 {
24  m_Offset[0] = 0.0;
25  m_Offset[1] = 0.0;
26  m_Offset[2] = 0.0;
27 }
28 
29 
31 {
32 }
33 
34 
36 {
37  /* update outputs with tracking data from tools */
38  for (unsigned int i = 0; i < this->GetNumberOfOutputs() ; ++i)
39  {
40  mitk::NavigationData* output = this->GetOutput(i);
41  assert(output);
42  const mitk::NavigationData* input = this->GetInput(i);
43  assert(input);
44 
45  if (input->IsDataValid() == false)
46  {
47  output->SetDataValid(false);
48  continue;
49  }
50  output->Graft(input); // First, copy all information from input to output
51  output->SetPosition(input->GetPosition() + m_Offset); // Then change the member(s): add offset to position of navigation data
52  output->SetDataValid(true); // operation was successful, therefore data of output is valid.
53  // don't change anything else here
54  }
55 }
56 
57 
59 {
60  if (p == NULL)
61  return;
63  if (p->GetPropertyValue<mitk::Vector3D>("NavigationDataDisplacementFilter_Offset", v) == true) // search for Offset parameter
64  this->SetOffset(v); // apply if found;
65 }
66 
67 
69 {
71  p->SetProperty("NavigationDataDisplacementFilter_Offset", mitk::Vector3DProperty::New(this->GetOffset())); // store Offset parameter
73 }
static Pointer New()
NavigationDataToNavigationDataFilter is the base class of all filters that receive NavigationDatas as...
virtual void GenerateData() override
filter execute method
Navigation Data.
DataCollection - Class to facilitate loading/accessing structured data.
virtual void SetDataValid(bool _arg)
sets the dataValid flag of the NavigationData object indicating if the object contains valid data ...
Key-value list holding instances of BaseProperty.
static Pointer New()
mitk::PropertyList::ConstPointer GetParameters() const override
Get all filter parameters (offset) as a PropertyList.
itk::SmartPointer< const Self > ConstPointer
bool GetPropertyValue(const char *propertyKey, T &value) const
Convenience access method for GenericProperty properties (T being the type of the second parameter...
virtual bool IsDataValid() const
returns true if the object contains valid data
virtual void SetPosition(PositionType _arg)
sets the position of the NavigationData object
virtual PositionType GetPosition() const
returns position of the NavigationData object
virtual void SetParameters(const mitk::PropertyList *p) override
Set all filter parameters (Offset) as the PropertyList p.
virtual void Graft(const DataObject *data) override
Graft the data and information from one NavigationData to another.
mitk::Vector3D m_Offset
offset that is added to all inputs