17 #ifndef __itkOptImageToImageMetric_h
18 #define __itkOptImageToImageMetric_h
57 template <
class TFixedImage,
class TMovingImage>
59 :
public SingleValuedCostFunction
86 itkStaticConstMacro(MovingImageDimension,
88 TMovingImage::ImageDimension);
89 itkStaticConstMacro(FixedImageDimension,
91 TFixedImage::ImageDimension);
95 itkGetStaticConstMacro(MovingImageDimension),
96 itkGetStaticConstMacro(FixedImageDimension)>
123 itkGetStaticConstMacro(MovingImageDimension)>
126 itkGetStaticConstMacro(MovingImageDimension)>
187 unsigned long GetNumberOfMovingImageSamples(
void )
189 return this->GetNumberOfPixelsCounted();
191 itkGetConstReferenceMacro( NumberOfPixelsCounted,
unsigned long );
194 void SetFixedImageRegion(
const FixedImageRegionType reg );
197 itkGetConstReferenceMacro( FixedImageRegion, FixedImageRegionType );
200 itkSetObjectMacro( MovingImageMask, MovingImageMaskType );
201 itkSetConstObjectMacro( MovingImageMask, MovingImageMaskType );
202 itkGetConstObjectMacro( MovingImageMask, MovingImageMaskType );
205 itkSetObjectMacro( FixedImageMask, FixedImageMaskType );
206 itkSetConstObjectMacro( FixedImageMask, FixedImageMaskType );
207 itkGetConstObjectMacro( FixedImageMask, FixedImageMaskType );
211 void SetFixedImageIndexes(
const FixedImageIndexContainer & indexes );
212 void SetUseFixedImageIndexes(
bool useIndex );
213 itkGetConstReferenceMacro( UseFixedImageIndexes,
bool );
216 void SetNumberOfThreads(
unsigned int numberOfThreads );
217 itkGetConstReferenceMacro( NumberOfThreads,
unsigned int );
220 itkSetMacro( ComputeGradient,
bool );
221 itkGetConstReferenceMacro( ComputeGradient,
bool );
222 itkBooleanMacro(ComputeGradient );
225 virtual void ComputeGradient(
void );
228 itkGetConstObjectMacro( GradientImage, GradientImageType );
231 void SetTransformParameters(
const ParametersType & parameters )
const;
234 unsigned int GetNumberOfParameters(
void )
const
236 return m_Transform->GetNumberOfParameters();
244 virtual
void MultiThreadingInitialize(
void ) throw ( ExceptionObject );
248 virtual
void SetNumberOfFixedImageSamples(
unsigned long numSamples );
249 itkGetConstReferenceMacro( NumberOfFixedImageSamples,
unsigned long );
253 void SetNumberOfSpatialSamples(
unsigned long num )
255 this->SetNumberOfFixedImageSamples( num );
257 unsigned long GetNumberOfSpatialSamples(
void )
259 return this->GetNumberOfFixedImageSamples();
264 void SetFixedImageSamplesIntensityThreshold(
const FixedImagePixelType & thresh );
265 itkGetConstReferenceMacro( FixedImageSamplesIntensityThreshold, FixedImagePixelType );
267 void SetUseFixedImageSamplesIntensityThreshold(
bool useThresh );
268 itkGetConstReferenceMacro( UseFixedImageSamplesIntensityThreshold,
bool );
273 void SetUseAllPixels(
bool useAllPixels );
274 void UseAllPixelsOn(
void )
276 this->SetUseAllPixels(
true );
278 void UseAllPixelsOff(
void )
280 this->SetUseAllPixels(
false );
282 itkGetConstReferenceMacro( UseAllPixels,
bool );
288 void SetUseSequentialSampling(
bool sequentialSampling );
289 itkGetConstReferenceMacro( UseSequentialSampling,
bool );
300 void ReinitializeSeed();
301 void ReinitializeSeed(
int seed );
319 itkSetMacro(UseCachingOfBSplineWeights,
bool);
320 itkGetConstReferenceMacro(UseCachingOfBSplineWeights,
bool);
321 itkBooleanMacro(UseCachingOfBSplineWeights);
328 return m_ThreaderTransform;
335 void PrintSelf(std::ostream& os,
Indent indent)
const;
353 FixedImagePointType point;
355 unsigned int valueIndex;
388 mutable unsigned long m_NumberOfPixelsCounted;
401 bool m_ComputeGradient;
429 itkStaticConstMacro(DeformationSplineOrder,
unsigned int, 3 );
462 itkGetStaticConstMacro(MovingImageDimension) >
483 virtual void PreComputeTransformValues(
void );
487 virtual void TransformPoint(
unsigned int sampleNumber,
489 bool& sampleWithinSupportRegion,
490 double& movingImageValue,
491 unsigned int threadID )
const;
493 virtual void TransformPointWithDerivatives(
unsigned int sampleNumber,
495 bool& sampleWithinSupportRegion,
496 double& movingImageValue,
498 unsigned int threadID )
const;
511 unsigned int threadID )
const;
529 void GetValueMultiThreadedPreProcessInitiate(
void )
const;
530 void GetValueMultiThreadedInitiate(
void )
const;
531 void GetValueMultiThreadedPostProcessInitiate(
void )
const;
536 virtual inline void GetValueThread(
unsigned int threadID )
const;
537 virtual inline void GetValueThreadPreProcess(
538 unsigned int itkNotUsed(threadID),
539 bool itkNotUsed(withinSampleThread) )
const
541 virtual inline bool GetValueThreadProcessSample(
542 unsigned int itkNotUsed(threadID),
543 unsigned long itkNotUsed(fixedImageSample),
545 double itkNotUsed(movingImageValue))
const
547 virtual inline void GetValueThreadPostProcess(
548 unsigned int itkNotUsed(threadID),
549 bool itkNotUsed(withinSampleThread) )
const
552 void GetValueAndDerivativeMultiThreadedPreProcessInitiate(
void )
const;
553 void GetValueAndDerivativeMultiThreadedInitiate(
void )
const;
554 void GetValueAndDerivativeMultiThreadedPostProcessInitiate(
void )
const;
559 virtual inline void GetValueAndDerivativeThread(
unsigned int threadID)
const;
560 virtual inline void GetValueAndDerivativeThreadPreProcess(
561 unsigned int itkNotUsed(threadID),
562 bool itkNotUsed(withinSampleThread))
const
564 virtual inline bool GetValueAndDerivativeThreadProcessSample(
565 unsigned int itkNotUsed(threadID),
566 unsigned long itkNotUsed(fixedImageSample),
568 double itkNotUsed(movingImageValue),
571 virtual inline void GetValueAndDerivativeThreadPostProcess(
572 unsigned int itkNotUsed(threadID),
573 bool itkNotUsed(withinSampleThread) )
const
579 virtual void SynchronizeTransforms()
const;
583 void operator=(
const Self&);
585 FixedImageRegionType m_FixedImageRegion;
591 #ifndef ITK_MANUAL_INSTANTIATION