00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date: 2010-03-31 16:40:27 +0200 (Mi, 31 Mrz 2010) $ 00006 Version: $Revision: 16011 $ 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 #ifndef MITKNavigationDataReferenceTransformFilter_H_HEADER_INCLUDED_ 00019 #define MITKNavigationDataReferenceTransformFilter_H_HEADER_INCLUDED_ 00020 00021 #include <mitkNavigationDataToNavigationDataFilter.h> 00022 #include <mitkPointSet.h> 00023 #include <itkLandmarkBasedTransformInitializer.h> 00024 #include <itkImage.h> 00025 #include <itkFixedCenterOfRotationAffineTransform.h> 00026 00027 namespace mitk { 00028 00040 class MitkIGT_EXPORT NavigationDataReferenceTransformFilter : public NavigationDataToNavigationDataFilter 00041 { 00042 public: 00043 00044 typedef itk::VersorRigid3DTransform< double > LandmarkTransformType; 00045 typedef std::vector<int> ReferenceInputsType; 00046 typedef itk::Image< signed short, 3> ImageType; // only because itk::LandmarkBasedTransformInitializer must be templated over two imagetypes 00047 typedef itk::QuaternionRigidTransform<double> QuaternionTransformType; 00048 typedef itk::LandmarkBasedTransformInitializer< LandmarkTransformType, ImageType, ImageType > TransformInitializerType; 00049 typedef TransformInitializerType::LandmarkPointContainer LandmarkPointContainer; 00050 00051 mitkClassMacro(NavigationDataReferenceTransformFilter, NavigationDataToNavigationDataFilter); 00052 itkNewMacro(Self); 00053 00054 itkGetMacro(OneSourceRegistration, bool); 00055 itkGetMacro(ReferenceRegistration, bool); 00056 00057 const LandmarkPointContainer GetSourcePoints(); 00058 const LandmarkPointContainer GetTargetPoints(); 00059 const LandmarkPointContainer GetReferencePoints(); 00065 void SetReferenceInputIndexes(const std::vector<int>* indexes); 00066 00071 const std::vector<int> GetReferenceInputIndexes(); 00072 00077 virtual void SetSourceLandmarks(mitk::PointSet::Pointer sourcePointSet); 00078 00083 virtual void SetTargetLandmarks(mitk::PointSet::Pointer targetPointSet); 00084 00090 void GenerateSourceLandmarks(); 00091 00092 /* 00093 *\brief Assigns at least 3 landmarks to the target landmarks container. 00094 * 00095 * Therefor the positions of the reference inputs are used. If there are less than 3 reference inputs 2 landmarks will be calculated in dependency of the first reference input. 00096 */ 00097 void GenerateTargetLandmarks(); 00098 00103 virtual bool IsInitialized() const; 00104 00110 bool InitializeReferenceLandmarks(); 00111 00117 void ResetFilter(); 00118 00119 00120 protected: 00121 00125 NavigationDataReferenceTransformFilter(); 00126 00130 virtual ~NavigationDataReferenceTransformFilter(); 00131 00137 void UpdateLandmarkTransform(const LandmarkPointContainer &sources, const LandmarkPointContainer &targets); 00138 00142 virtual void GenerateData(); 00143 00144 void PrintSelf( std::ostream& os, itk::Indent indent ) const; // print object info to ostream 00145 00151 const LandmarkPointContainer GenerateReferenceLandmarks(); 00152 00153 00154 LandmarkPointContainer m_SourcePoints; 00155 LandmarkPointContainer m_TargetPoints; 00156 LandmarkPointContainer m_ReferencePoints; 00157 00158 TransformInitializerType::Pointer m_LandmarkTransformInitializer; 00159 LandmarkTransformType::Pointer m_LandmarkTransform; 00160 00161 QuaternionTransformType::Pointer m_QuaternionTransform; 00162 QuaternionTransformType::Pointer m_QuaternionLandmarkTransform; 00163 00164 QuaternionTransformType::Pointer m_QuaternionReferenceTransform; 00165 00166 bool m_OneSourceRegistration; 00167 bool m_ReferenceRegistration; 00168 00169 ReferenceInputsType m_ReferenceInputIndexes; 00170 00171 }; 00172 } // namespace mitk 00173 #endif /* MITKNavigationDataReferenceTransformFilter_H_HEADER_INCLUDED_ */ 00174