Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkRegistrationWrapperMapper2D.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 
17 
18 #include <vtkPropAssembly.h>
19 #include <vtkPointData.h>
20 #include <vtkProperty.h>
21 #include <vtkCellArray.h>
22 
23 #include <mitkProperties.h>
24 #include <mitkExceptionMacro.h>
25 #include <mitkException.h>
26 
29 #include "mitkRegVisHelper.h"
30 
32 {
33 
34 }
35 
36 
38 {
39 
40 }
41 
43 {
44  return (time < renderer->GetCurrentWorldGeometry2DUpdateTime()) //was the geometry modified?
45  || (time < renderer->GetCurrentWorldGeometry2D()->GetMTime());
46 }
47 
49 {
51 
52  if( ( worldGeometry.IsNull() ) || ( !worldGeometry->IsValid() ) || ( !worldGeometry->HasReferenceGeometry() ))
53  {
54  return false;
55  }
56 
57  mitk::PlaneGeometry::Pointer newDesc = worldGeometry->Clone();
58 
59  mitk::Geometry3D::Pointer dummyDesc;
60  mitk::GetGridGeometryFromNode(this->GetDataNode(), dummyDesc, gridFrequ);
61 
62  mitk::Vector3D spacing = worldGeometry->GetSpacing();
63  spacing[0] = dummyDesc->GetSpacing()[0];
64  spacing[1] = dummyDesc->GetSpacing()[1];
65 
66  mitk::Geometry3D::BoundsArrayType bounds = newDesc->GetBounds();
67  bounds[1] *= (newDesc->GetSpacing()[0]/spacing[0]);
68  bounds[3] *= (newDesc->GetSpacing()[1]/spacing[1]);
69  newDesc->SetBounds(bounds);
70  newDesc->SetSpacing(spacing);
71 
72 
73  gridDesc = newDesc;
74 
75  return true;
76 };
77 
void GetGridGeometryFromNode(const mitk::DataNode *regNode, mitk::Geometry3D::Pointer &gridDesc, unsigned int &gridFrequ)
BoundingBoxType::BoundsArrayType BoundsArrayType
Organizes the rendering process.
virtual const PlaneGeometry * GetCurrentWorldPlaneGeometry()
Get the current 2D-worldgeometry (m_CurrentWorldPlaneGeometry) used for 2D-rendering.
const PlaneGeometry * GetCurrentWorldGeometry2D()
virtual bool RendererGeometryIsOutdated(mitk::BaseRenderer *renderer, const itk::TimeStamp &time) const
virtual bool GetGeometryDescription(mitk::BaseRenderer *renderer, mitk::BaseGeometry::ConstPointer &gridDesc, unsigned int &gridFrequ) const