itkDisplacementFieldJacobianDeterminantFilter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkDisplacementFieldJacobianDeterminantFilter_h
00018 #define __itkDisplacementFieldJacobianDeterminantFilter_h
00019
00020 #include "itkConstNeighborhoodIterator.h"
00021 #include "itkNeighborhoodIterator.h"
00022 #include "itkImageToImageFilter.h"
00023 #include "itkImage.h"
00024 #include "itkVector.h"
00025 #include "vnl/vnl_matrix.h"
00026 #include "vnl/vnl_det.h"
00027
00028 namespace itk
00029 {
00111 template < typename TInputImage,
00112 typename TRealType = float,
00113 typename TOutputImage = Image< TRealType,
00114 ::itk::GetImageDimension<TInputImage>::ImageDimension >
00115 >
00116 class ITK_EXPORT DisplacementFieldJacobianDeterminantFilter :
00117 public ImageToImageFilter< TInputImage, TOutputImage >
00118 {
00119 public:
00121 typedef DisplacementFieldJacobianDeterminantFilter Self;
00122 typedef ImageToImageFilter< TInputImage, TOutputImage > Superclass;
00123 typedef SmartPointer<Self> Pointer;
00124 typedef SmartPointer<const Self> ConstPointer;
00125
00127 itkNewMacro(Self);
00128
00130 itkTypeMacro(DisplacementFieldJacobianDeterminantFilter, ImageToImageFilter);
00131
00134 typedef typename TOutputImage::PixelType OutputPixelType;
00135 typedef typename TInputImage::PixelType InputPixelType;
00136
00138 typedef TInputImage InputImageType;
00139 typedef TOutputImage OutputImageType;
00140 typedef typename InputImageType::Pointer InputImagePointer;
00141 typedef typename OutputImageType::Pointer OutputImagePointer;
00142
00144 itkStaticConstMacro(ImageDimension, unsigned int,
00145 TOutputImage::ImageDimension);
00146
00148 itkStaticConstMacro(VectorDimension, unsigned int,
00149 InputPixelType::Dimension);
00150
00152 typedef TRealType RealType;
00153 typedef Vector<TRealType, ::itk::GetVectorDimension<InputPixelType>::VectorDimension>
00154 RealVectorType;
00155 typedef Image<RealVectorType, ::itk::GetImageDimension<TInputImage>::ImageDimension>
00156 RealVectorImageType;
00157
00158
00161 typedef ConstNeighborhoodIterator<RealVectorImageType> ConstNeighborhoodIteratorType;
00162 typedef typename ConstNeighborhoodIteratorType::RadiusType RadiusType;
00163
00165 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00166
00175 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00176
00180 void SetUseImageSpacingOn()
00181 { this->SetUseImageSpacing(true); }
00182
00186 void SetUseImageSpacingOff()
00187 { this->SetUseImageSpacing(false); }
00188
00191 void SetUseImageSpacing(bool);
00192 itkGetConstMacro(UseImageSpacing, bool);
00194
00197 void SetDerivativeWeights(TRealType data[]);
00198 itkGetVectorMacro(DerivativeWeights, const TRealType, itk::GetImageDimension<TInputImage>::ImageDimension);
00200
00201 protected:
00202 DisplacementFieldJacobianDeterminantFilter();
00203 virtual ~DisplacementFieldJacobianDeterminantFilter() {}
00204
00208 void BeforeThreadedGenerateData ();
00209
00222 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00223 int threadId );
00224
00225 void PrintSelf(std::ostream& os, Indent indent) const;
00226
00227 typedef typename InputImageType::Superclass ImageBaseType;
00228
00230 itkGetConstObjectMacro( RealValuedInputImage, ImageBaseType );
00231
00233 itkGetConstReferenceMacro( NeighborhoodRadius, RadiusType );
00234 itkSetMacro( NeighborhoodRadius, RadiusType );
00236
00237
00238 virtual TRealType EvaluateAtNeighborhood(const ConstNeighborhoodIteratorType &it) const;
00239
00241 TRealType m_DerivativeWeights[itk::GetImageDimension<TInputImage>::ImageDimension];
00242
00244 TRealType m_HalfDerivativeWeights[itk::GetImageDimension<TInputImage>::ImageDimension];
00245
00246 private:
00247 bool m_UseImageSpacing;
00248 int m_RequestedNumberOfThreads;
00249
00250 typename ImageBaseType::ConstPointer m_RealValuedInputImage;
00251
00252 DisplacementFieldJacobianDeterminantFilter(const Self&);
00253 void operator=(const Self&);
00254
00255 RadiusType m_NeighborhoodRadius;
00256 };
00257
00258 }
00259
00260 #ifndef ITK_MANUAL_INSTANTIATION
00261 #include "itkDisplacementFieldJacobianDeterminantFilter.txx"
00262 #endif
00263
00264 #endif
00265