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::BulkTransformType BulkTransformType;
00236 typedef typename BSplineTransformType::BulkTransformPointer BulkTransformPointer;
00237 typedef typename BSplineTransformType::WeightsFunctionType WeightsFunctionType;
00238 typedef typename BSplineTransformType::WeightsType WeightsType;
00239 typedef typename BSplineTransformType::ContinuousIndexType ContinuousIndexType;
00240 typedef typename BSplineTransformType::ParameterIndexArrayType ParameterIndexArrayType;
00241
00243 typedef typename Superclass2::ElastixType ElastixType;
00244 typedef typename Superclass2::ElastixPointer ElastixPointer;
00245 typedef typename Superclass2::ConfigurationType ConfigurationType;
00246 typedef typename Superclass2::ConfigurationPointer ConfigurationPointer;
00247 typedef typename Superclass2::RegistrationType RegistrationType;
00248 typedef typename Superclass2::RegistrationPointer RegistrationPointer;
00249 typedef typename Superclass2::CoordRepType CoordRepType;
00250 typedef typename Superclass2::FixedImageType FixedImageType;
00251 typedef typename Superclass2::MovingImageType MovingImageType;
00252 typedef typename Superclass2::ITKBaseType ITKBaseType;
00253 typedef typename Superclass2::CombinationTransformType CombinationTransformType;
00254
00256 typedef typename Superclass1::IntermediaryDFTransformType IntermediaryDFTransformType;
00257 typedef typename Superclass1::VectorImageType VectorImageType;
00258
00260 typedef typename ElastixType::FixedImageType FixedImageELXType;
00261 typedef typename ElastixType::MovingImageType MovingImageELXType;
00262
00264 typedef Image< short,
00265 itkGetStaticConstMacro( SpaceDimension ) > DummyImageType;
00266 typedef ImageRegionConstIterator<
00267 DummyImageType > DummyIteratorType;
00268 typedef typename BSplineTransformType::Pointer BSplineTransformPointer;
00269 typedef typename Superclass1::Superclass GenericDeformationFieldRegulizer;
00270
00272 typedef ImageFileReader< VectorImageType > VectorReaderType;
00273 typedef typename VectorImageType::PixelType VectorType;
00274 typedef ImageRegionIterator<
00275 VectorImageType > VectorImageIteratorType;
00276 typedef FixedImageELXType GrayValueImageType;
00277 typedef typename GrayValueImageType::PixelType GrayValuePixelType;
00278 typedef ImageRegionIterator<
00279 GrayValueImageType > GrayValueImageIteratorType;
00280 typedef MaximumImageFilter<
00281 GrayValueImageType, GrayValueImageType,
00282 GrayValueImageType > MaximumImageFilterType;
00283 typedef VectorMeanDiffusionImageFilter<
00284 VectorImageType, GrayValueImageType > DiffusionFilterType;
00285 typedef typename VectorImageType::SizeType RadiusType;
00286 typedef ResampleImageFilter<
00287 MovingImageELXType, GrayValueImageType,
00288 CoordRepType > ResamplerType1;
00289 typedef ResampleImageFilter<
00290 GrayValueImageType, GrayValueImageType,
00291 CoordRepType > ResamplerType2;
00292 typedef BSplineInterpolateImageFunction<
00293 GrayValueImageType > InterpolatorType;
00294 typedef ImageFileReader< GrayValueImageType > GrayValueImageReaderType;
00295 typedef ImageFileWriter< GrayValueImageType > GrayValueImageWriterType;
00296 typedef ImageFileWriter< VectorImageType > DeformationFieldWriterType;
00297
00303 virtual void BeforeRegistration( void );
00304
00308 virtual void BeforeEachResolution( void );
00309
00313 virtual void AfterEachIteration( void );
00314
00318 virtual void AfterRegistration( void );
00319
00321 virtual void SetInitialGrid( bool upsampleGridOption );
00322
00324 virtual void IncreaseScale( void );
00325
00327 virtual void ReadFromFile( void );
00328
00330 virtual void WriteToFile( const ParametersType & param ) const;
00331
00333 void DiffuseDeformationField( void );
00334
00345 virtual OutputPointType TransformPoint( const InputPointType & point ) const;
00346
00358 protected:
00359
00361 BSplineTransformWithDiffusion();
00363 virtual ~BSplineTransformWithDiffusion() {};
00364
00366 SpacingType m_GridSpacingFactor;
00367
00368 private:
00369
00371 BSplineTransformWithDiffusion( const Self& );
00373 void operator=( const Self& );
00374
00376 typename DiffusionFilterType::Pointer m_Diffusion;
00377 typename VectorImageType::Pointer m_DeformationField;
00378 typename VectorImageType::Pointer m_DiffusedField;
00379 typename GrayValueImageType::Pointer m_GrayValueImage1;
00380 typename GrayValueImageType::Pointer m_GrayValueImage2;
00381 typename GrayValueImageType::Pointer m_MovingSegmentationImage;
00382 typename GrayValueImageType::Pointer m_FixedSegmentationImage;
00383 typename GrayValueImageReaderType::Pointer m_MovingSegmentationReader;
00384 typename GrayValueImageReaderType::Pointer m_FixedSegmentationReader;
00385 std::string m_MovingSegmentationFileName;
00386 std::string m_FixedSegmentationFileName;
00387 typename ResamplerType1::Pointer m_Resampler1;
00388 typename ResamplerType2::Pointer m_Resampler2;
00389 typename InterpolatorType::Pointer m_Interpolator;
00390 RegionType m_DeformationRegion;
00391 OriginType m_DeformationOrigin;
00392 SpacingType m_DeformationSpacing;
00393
00395 bool m_WriteDiffusionFiles;
00396 bool m_AlsoFixed;
00397 bool m_ThresholdBool;
00398 GrayValuePixelType m_ThresholdHU;
00399 bool m_UseMovingSegmentation;
00400 bool m_UseFixedSegmentation;
00401
00403 ParametersType m_BSplineParameters;
00404
00408 BSplineTransformPointer m_BSplineTransform;
00409
00410 };
00411
00412
00413 }
00414
00415 #ifndef ITK_MANUAL_INSTANTIATION
00416 #include "elxBSplineTransformWithDiffusion.hxx"
00417 #endif
00418
00419 #endif // end #ifndef __elxBSplineTransformWithDiffusion_H__
00420