00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 00019 #include "mitkLandmarkProjectorBasedCurvedGeometry.h" 00020 #include <vtkAbstractTransform.h> 00021 00022 mitk::LandmarkProjectorBasedCurvedGeometry::LandmarkProjectorBasedCurvedGeometry() 00023 : m_LandmarkProjector(NULL), m_InterpolatingAbstractTransform(NULL) 00024 { 00025 } 00026 00027 mitk::LandmarkProjectorBasedCurvedGeometry::~LandmarkProjectorBasedCurvedGeometry() 00028 { 00029 if(m_InterpolatingAbstractTransform!=NULL) 00030 m_InterpolatingAbstractTransform->Delete(); 00031 } 00032 00033 void mitk::LandmarkProjectorBasedCurvedGeometry::SetLandmarkProjector(mitk::LandmarkProjector* aLandmarkProjector) 00034 { 00035 itkDebugMacro("setting LandmarkProjector to " << aLandmarkProjector ); 00036 if(m_LandmarkProjector != aLandmarkProjector) 00037 { 00038 m_LandmarkProjector = aLandmarkProjector; 00039 if(m_LandmarkProjector.IsNotNull()) 00040 { 00041 if(m_FrameGeometry.IsNotNull()) 00042 m_LandmarkProjector->SetFrameGeometry(m_FrameGeometry); 00043 00044 if(m_InterpolatingAbstractTransform == NULL) 00045 { 00046 itkWarningMacro(<<"m_InterpolatingAbstractTransform not set."); 00047 } 00048 m_LandmarkProjector->SetInterpolatingAbstractTransform(GetInterpolatingAbstractTransform()); 00049 00050 SetVtkAbstractTransform(m_LandmarkProjector->GetCompleteAbstractTransform()); 00051 } 00052 Modified(); 00053 } 00054 } 00055 00056 void mitk::LandmarkProjectorBasedCurvedGeometry::SetFrameGeometry(const mitk::Geometry3D* frameGeometry) 00057 { 00058 Superclass::SetFrameGeometry(frameGeometry); 00059 if(m_LandmarkProjector.IsNotNull()) 00060 m_LandmarkProjector->SetFrameGeometry(frameGeometry); 00061 } 00062 00063 void mitk::LandmarkProjectorBasedCurvedGeometry::ComputeGeometry() 00064 { 00065 if(m_LandmarkProjector.IsNull()) 00066 { 00067 itkExceptionMacro(<< "m_LandmarkProjector is not set."); 00068 } 00069 m_LandmarkProjector->ProjectLandmarks(m_TargetLandmarks); 00070 SetPlane(m_LandmarkProjector->GetParameterPlane()); 00071 } 00072 00073 void mitk::LandmarkProjectorBasedCurvedGeometry::InitializeGeometry(Self * newGeometry) const 00074 { 00075 Superclass::InitializeGeometry(newGeometry); 00076 newGeometry->SetLandmarkProjector(m_LandmarkProjector); 00077 newGeometry->ComputeGeometry(); 00078 }