ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkMatchCardinalityImageToImageMetric_h 00019 #define __itkMatchCardinalityImageToImageMetric_h 00020 00026 #include "itkImageToImageMetric.h" 00027 #include "itkPoint.h" 00028 #include <vector> 00029 00030 namespace itk 00031 { 00066 template< class TFixedImage, class TMovingImage > 00067 class ITK_EXPORT MatchCardinalityImageToImageMetric: 00068 public ImageToImageMetric< TFixedImage, TMovingImage > 00069 { 00070 public: 00071 00073 typedef MatchCardinalityImageToImageMetric Self; 00074 typedef ImageToImageMetric< TFixedImage, TMovingImage > Superclass; 00075 typedef SmartPointer< Self > Pointer; 00076 typedef SmartPointer< const Self > ConstPointer; 00077 00079 itkNewMacro(Self); 00080 00082 itkTypeMacro(MatchCardinalityImageToImageMetric, ImageToImageMetric); 00083 00085 typedef typename Superclass::RealType RealType; 00086 typedef typename Superclass::TransformType TransformType; 00087 typedef typename Superclass::TransformPointer TransformPointer; 00088 typedef typename Superclass::TransformParametersType TransformParametersType; 00089 typedef typename Superclass::TransformJacobianType TransformJacobianType; 00090 typedef typename Superclass::GradientPixelType GradientPixelType; 00091 00092 typedef typename Superclass::MeasureType MeasureType; 00093 typedef typename Superclass::DerivativeType DerivativeType; 00094 typedef typename Superclass::FixedImageType FixedImageType; 00095 typedef typename Superclass::MovingImageType MovingImageType; 00096 typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer; 00097 typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer; 00098 typedef typename Superclass::FixedImageRegionType FixedImageRegionType; 00099 00101 void GetDerivative(const TransformParametersType &, 00102 DerivativeType & derivative) const 00103 { 00104 itkWarningMacro(<< "This metric does not provide metric derivatives."); 00105 derivative.Fill(NumericTraits< typename DerivativeType::ValueType >::Zero); 00106 } 00108 00115 MeasureType GetValue(const TransformParametersType & parameters) const; 00116 00123 itkSetMacro(MeasureMatches, bool); 00124 itkBooleanMacro(MeasureMatches); 00125 itkGetConstMacro(MeasureMatches, bool); 00127 00129 MultiThreader * GetMultiThreader() 00130 { return m_Threader; } 00131 protected: 00132 MatchCardinalityImageToImageMetric(); 00133 virtual ~MatchCardinalityImageToImageMetric() {} 00134 void PrintSelf(std::ostream & os, Indent indent) const; 00136 00142 MeasureType GetNonconstValue(const TransformParametersType & parameters); 00143 00148 virtual 00149 void ThreadedGetValue(const FixedImageRegionType & outputRegionForThread, 00150 ThreadIdType threadId); 00151 00157 virtual 00158 ThreadIdType SplitFixedRegion(ThreadIdType i, int num, FixedImageRegionType & splitRegion); 00159 00163 static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg); 00164 00167 struct ThreadStruct { 00168 Pointer Metric; 00169 }; 00170 private: 00171 MatchCardinalityImageToImageMetric(const Self &); //purposely not implemented 00172 void operator=(const Self &); //purposely not implemented 00174 00175 bool m_MeasureMatches; 00176 std::vector< MeasureType > m_ThreadMatches; 00177 std::vector< SizeValueType > m_ThreadCounts; 00178 00181 MultiThreader::Pointer m_Threader; 00182 }; 00183 } // end namespace itk 00184 00185 #ifndef ITK_MANUAL_INSTANTIATION 00186 #include "itkMatchCardinalityImageToImageMetric.hxx" 00187 #endif 00188 00189 #endif 00190