Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __elxBSplineTransformWithDiffusion_H__
00016 #define __elxBSplineTransformWithDiffusion_H__
00017
00018
00019 #define __VSplineOrder 3
00020
00021 #include "itkAdvancedBSplineDeformableTransform.h"
00022 #include "itkAdvancedCombinationTransform.h"
00023
00024 #include "itkBSplineResampleImageFilterBase.h"
00025 #include "itkBSplineUpsampleImageFilter.h"
00026
00027 #include "itkImageRegionConstIterator.h"
00028
00029 #include "elxIncludes.h"
00030
00032 #include "itkDeformationFieldRegulizer.h"
00033 #include "itkVectorMeanDiffusionImageFilter.h"
00034 #include "itkImageFileReader.h"
00035 #include "itkImageFileWriter.h"
00036 #include "itkResampleImageFilter.h"
00037 #include "itkCastImageFilter.h"
00038 #include "itkMaximumImageFilter.h"
00039 #include "itkImageRegionIterator.h"
00040 #include "itkBSplineInterpolateImageFunction.h"
00041
00042
00043 namespace elastix
00044 {
00045 using namespace itk;
00046
00047
00159 template < class TElastix >
00160 class BSplineTransformWithDiffusion
00161 : public
00162 DeformationFieldRegulizer<
00163 AdvancedCombinationTransform<
00164
00165 ITK_TYPENAME elx::TransformBase<TElastix>::CoordRepType,
00166 elx::TransformBase<TElastix>::FixedImageDimension > >,
00167
00168 public
00169 TransformBase<TElastix>
00170 {
00171 public:
00172
00174 typedef BSplineTransformWithDiffusion Self;
00175 typedef DeformationFieldRegulizer<
00176 AdvancedCombinationTransform<
00177
00178 typename elx::TransformBase<TElastix>::CoordRepType,
00179 elx::TransformBase<TElastix>::FixedImageDimension > >
00180
00181 Superclass1;
00182 typedef elx::TransformBase<TElastix> Superclass2;
00183
00187 typedef AdvancedBSplineDeformableTransform<
00188 typename elx::TransformBase<TElastix>::CoordRepType,
00189 elx::TransformBase<TElastix>::FixedImageDimension,
00190 __VSplineOrder > BSplineTransformType;
00191
00192 typedef SmartPointer<Self> Pointer;
00193 typedef SmartPointer<const Self> ConstPointer;
00194
00196 itkNewMacro( Self );
00197
00199 itkTypeMacro( BSplineTransformWithDiffusion, DeformationFieldRegulizer );
00200
00205 elxClassNameMacro( "BSplineTransformWithDiffusion" );
00206
00208 itkStaticConstMacro( SpaceDimension, unsigned int, Superclass2::FixedImageDimension );
00209
00211 itkStaticConstMacro( SplineOrder, unsigned int, __VSplineOrder );
00212
00214 typedef typename Superclass1::ScalarType ScalarType;
00215 typedef typename Superclass1::ParametersType ParametersType;
00216 typedef typename Superclass1::JacobianType JacobianType;
00217 typedef typename Superclass1::InputVectorType InputVectorType;
00218 typedef typename Superclass1::OutputVectorType OutputVectorType;
00219 typedef typename Superclass1::InputCovariantVectorType InputCovariantVectorType;
00220 typedef typename Superclass1::OutputCovariantVectorType OutputCovariantVectorType;
00221 typedef typename Superclass1::InputVnlVectorType InputVnlVectorType;
00222 typedef typename Superclass1::OutputVnlVectorType OutputVnlVectorType;
00223 typedef typename Superclass1::InputPointType InputPointType;
00224 typedef typename Superclass1::OutputPointType OutputPointType;
00225
00227 typedef typename BSplineTransformType::PixelType PixelType;
00228 typedef typename BSplineTransformType::ImageType ImageType;
00229 typedef typename BSplineTransformType::ImagePointer ImagePointer;
00230 typedef typename BSplineTransformType::RegionType RegionType;
00231 typedef typename BSplineTransformType::IndexType IndexType;
00232 typedef typename BSplineTransformType::SizeType SizeType;
00233 typedef typename BSplineTransformType::SpacingType SpacingType;
00234 typedef typename BSplineTransformType::OriginType OriginType;
00235 typedef typename BSplineTransformType::WeightsFunctionType WeightsFunctionType;
00236 typedef typename BSplineTransformType::WeightsType WeightsType;
00237 typedef typename BSplineTransformType::ContinuousIndexType ContinuousIndexType;
00238 typedef typename BSplineTransformType::ParameterIndexArrayType ParameterIndexArrayType;
00239
00241 typedef typename Superclass2::ElastixType ElastixType;
00242 typedef typename Superclass2::ElastixPointer ElastixPointer;
00243 typedef typename Superclass2::ConfigurationType ConfigurationType;
00244 typedef typename Superclass2::ConfigurationPointer ConfigurationPointer;
00245 typedef typename Superclass2::RegistrationType RegistrationType;
00246 typedef typename Superclass2::RegistrationPointer RegistrationPointer;
00247 typedef typename Superclass2::CoordRepType CoordRepType;
00248 typedef typename Superclass2::FixedImageType FixedImageType;
00249 typedef typename Superclass2::MovingImageType MovingImageType;
00250 typedef typename Superclass2::ITKBaseType ITKBaseType;
00251 typedef typename Superclass2::CombinationTransformType CombinationTransformType;
00252
00254 typedef typename Superclass1::IntermediaryDFTransformType IntermediaryDFTransformType;
00255 typedef typename Superclass1::VectorImageType VectorImageType;
00256
00258 typedef typename ElastixType::FixedImageType FixedImageELXType;
00259 typedef typename ElastixType::MovingImageType MovingImageELXType;
00260
00262 typedef Image< short,
00263 itkGetStaticConstMacro( SpaceDimension ) > DummyImageType;
00264 typedef ImageRegionConstIterator<
00265 DummyImageType > DummyIteratorType;
00266 typedef typename BSplineTransformType::Pointer BSplineTransformPointer;
00267 typedef typename Superclass1::Superclass GenericDeformationFieldRegulizer;
00268
00270 typedef ImageFileReader< VectorImageType > VectorReaderType;
00271 typedef typename VectorImageType::PixelType VectorType;
00272 typedef ImageRegionIterator<
00273 VectorImageType > VectorImageIteratorType;
00274 typedef FixedImageELXType GrayValueImageType;
00275 typedef typename GrayValueImageType::PixelType GrayValuePixelType;
00276 typedef ImageRegionIterator<
00277 GrayValueImageType > GrayValueImageIteratorType;
00278 typedef MaximumImageFilter<
00279 GrayValueImageType, GrayValueImageType,
00280 GrayValueImageType > MaximumImageFilterType;
00281 typedef VectorMeanDiffusionImageFilter<
00282 VectorImageType, GrayValueImageType > DiffusionFilterType;
00283 typedef typename VectorImageType::SizeType RadiusType;
00284 typedef ResampleImageFilter<
00285 MovingImageELXType, GrayValueImageType,
00286 CoordRepType > ResamplerType1;
00287 typedef ResampleImageFilter<
00288 GrayValueImageType, GrayValueImageType,
00289 CoordRepType > ResamplerType2;
00290 typedef BSplineInterpolateImageFunction<
00291 GrayValueImageType > InterpolatorType;
00292 typedef ImageFileReader< GrayValueImageType > GrayValueImageReaderType;
00293 typedef ImageFileWriter< GrayValueImageType > GrayValueImageWriterType;
00294 typedef ImageFileWriter< VectorImageType > DeformationFieldWriterType;
00295
00301 virtual void BeforeRegistration( void );
00302
00306 virtual void BeforeEachResolution( void );
00307
00311 virtual void AfterEachIteration( void );
00312
00316 virtual void AfterRegistration( void );
00317
00319 virtual void SetInitialGrid( bool upsampleGridOption );
00320
00322 virtual void IncreaseScale( void );
00323
00325 virtual void ReadFromFile( void );
00326
00328 virtual void WriteToFile( const ParametersType & param ) const;
00329
00331 void DiffuseDeformationField( void );
00332
00343 virtual OutputPointType TransformPoint( const InputPointType & point ) const;
00344
00356 protected:
00357
00359 BSplineTransformWithDiffusion();
00361 virtual ~BSplineTransformWithDiffusion() {};
00362
00364 SpacingType m_GridSpacingFactor;
00365
00366 private:
00367
00369 BSplineTransformWithDiffusion( const Self& );
00371 void operator=( const Self& );
00372
00374 typename DiffusionFilterType::Pointer m_Diffusion;
00375 typename VectorImageType::Pointer m_DeformationField;
00376 typename VectorImageType::Pointer m_DiffusedField;
00377 typename GrayValueImageType::Pointer m_GrayValueImage1;
00378 typename GrayValueImageType::Pointer m_GrayValueImage2;
00379 typename GrayValueImageType::Pointer m_MovingSegmentationImage;
00380 typename GrayValueImageType::Pointer m_FixedSegmentationImage;
00381 typename GrayValueImageReaderType::Pointer m_MovingSegmentationReader;
00382 typename GrayValueImageReaderType::Pointer m_FixedSegmentationReader;
00383 std::string m_MovingSegmentationFileName;
00384 std::string m_FixedSegmentationFileName;
00385 typename ResamplerType1::Pointer m_Resampler1;
00386 typename ResamplerType2::Pointer m_Resampler2;
00387 typename InterpolatorType::Pointer m_Interpolator;
00388 RegionType m_DeformationRegion;
00389 OriginType m_DeformationOrigin;
00390 SpacingType m_DeformationSpacing;
00391
00393 bool m_WriteDiffusionFiles;
00394 bool m_AlsoFixed;
00395 bool m_ThresholdBool;
00396 GrayValuePixelType m_ThresholdHU;
00397 bool m_UseMovingSegmentation;
00398 bool m_UseFixedSegmentation;
00399
00401 ParametersType m_BSplineParameters;
00402
00406 BSplineTransformPointer m_BSplineTransform;
00407
00408 };
00409
00410
00411 }
00412
00413 #ifndef ITK_MANUAL_INSTANTIATION
00414 #include "elxBSplineTransformWithDiffusion.hxx"
00415 #endif
00416
00417 #endif // end #ifndef __elxBSplineTransformWithDiffusion_H__
00418