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> RealVectorType;
00154 typedef Image<RealVectorType, ::itk::GetImageDimension<TInputImage>::ImageDimension> RealVectorImageType;
00155
00156
00159 typedef ConstNeighborhoodIterator<RealVectorImageType> ConstNeighborhoodIteratorType;
00160 typedef typename ConstNeighborhoodIteratorType::RadiusType RadiusType;
00161
00163 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00164
00173 virtual void GenerateInputRequestedRegion() throw(InvalidRequestedRegionError);
00174
00178 void SetUseImageSpacingOn()
00179 { this->SetUseImageSpacing(true); }
00180
00184 void SetUseImageSpacingOff()
00185 { this->SetUseImageSpacing(false); }
00186
00189 void SetUseImageSpacing(bool);
00190 itkGetMacro(UseImageSpacing, bool);
00192
00195 void SetDerivativeWeights(TRealType data[]);
00196 itkGetVectorMacro(DerivativeWeights, const TRealType, itk::GetImageDimension<TInputImage>::ImageDimension);
00198
00199 protected:
00200 DisplacementFieldJacobianDeterminantFilter();
00201 virtual ~DisplacementFieldJacobianDeterminantFilter() {}
00202
00206 void BeforeThreadedGenerateData ();
00207
00220 void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
00221 int threadId );
00222
00223 void PrintSelf(std::ostream& os, Indent indent) const;
00224
00225 typedef typename InputImageType::Superclass ImageBaseType;
00226
00228 itkGetConstObjectMacro( RealValuedInputImage, ImageBaseType );
00229
00231 itkGetConstReferenceMacro( NeighborhoodRadius, RadiusType );
00232 itkSetMacro( NeighborhoodRadius, RadiusType );
00234
00235
00236 virtual TRealType EvaluateAtNeighborhood(const ConstNeighborhoodIteratorType &it) const;
00237
00239 TRealType m_DerivativeWeights[itk::GetImageDimension<TInputImage>::ImageDimension];
00240
00242 TRealType m_HalfDerivativeWeights[itk::GetImageDimension<TInputImage>::ImageDimension];
00243
00244 private:
00245 bool m_UseImageSpacing;
00246 int m_RequestedNumberOfThreads;
00247
00248 typename ImageBaseType::ConstPointer m_RealValuedInputImage;
00249
00250 DisplacementFieldJacobianDeterminantFilter(const Self&);
00251 void operator=(const Self&);
00252
00253 RadiusType m_NeighborhoodRadius;
00254 };
00255
00256 }
00257
00258 #ifndef ITK_MANUAL_INSTANTIATION
00259 #include "itkDisplacementFieldJacobianDeterminantFilter.txx"
00260 #endif
00261
00262 #endif
00263