/usr/include/ITK-4.5/itkMultiResolutionPDEDeformableRegistration.h is in libinsighttoolkit4-dev 4.5.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | /*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef __itkMultiResolutionPDEDeformableRegistration_h
#define __itkMultiResolutionPDEDeformableRegistration_h
#include "itkImage.h"
#include "itkDemonsRegistrationFilter.h"
#include "itkMultiResolutionPyramidImageFilter.h"
#include "itkVectorResampleImageFilter.h"
#include "itkArray.h"
namespace itk
{
/**
* \class MultiResolutionPDEDeformableRegistration
* \brief Framework for performing multi-resolution PDE
* deformable registration.
*
* MultiResolutionPDEDeformableRegistration provides a generic framework
* to peform multi-resolution deformable registration.
*
* At each resolution level a PDEDeformableRegistrationFilter is used
* to register two images by computing the deformation field which will
* map a moving image onto a fixed image.
*
* A deformation field is represented as an image whose pixel type is some
* vector type with at least N elements, where N is the dimension of
* the fixed image. The vector type must support element access via operator
* []. It is assumed that the vector elements behave like floating point
* scalars.
*
* The internal PDEDeformationRegistrationFilter can be set using
* SetRegistrationFilter. By default a DemonsRegistrationFilter is used.
*
* The input fixed and moving images are set via methods SetFixedImage
* and SetMovingImage respectively. An initial deformation field maybe set via
* SetInitialDisplacementField if is matches the characteristics of the coarsest
* pyramid level. If no such assumption can be made (e.g. the deformation field
* has the same characteristics as the input images), an initial deformation
* field can still be set via SetArbitraryInitialDisplacementField or
* SetInput. The filter will then take care of mathching the coarsest level
* characteristics. If no initial field is set a zero field is used as the
* initial condition.
*
* MultiResolutionPyramidImageFilters are used to downsample the fixed
* and moving images. A VectorExpandImageFilter is used to upsample
* the deformation as we move from a coarse to fine solution.
*
* This class is templated over the fixed image type, the moving image type,
* and the Deformation Field type.
*
* \warning This class assumes that the fixed, moving and deformation
* field image types all have the same number of dimensions.
*
* \sa PDEDeformableRegistrationFilter
* \sa DemonsRegistrationFilter
* \sa MultiResolutionPyramidImageFilter
* \sa VectorExpandImageFilter
*
* The current implementation of this class does not support streaming.
*
* \ingroup DeformableImageRegistration
* \ingroup ITKPDEDeformableRegistration
*/
template< typename TFixedImage, typename TMovingImage, typename TDisplacementField, typename TRealType = float >
class MultiResolutionPDEDeformableRegistration:
public ImageToImageFilter< TDisplacementField, TDisplacementField >
{
public:
/** Standard class typedefs */
typedef MultiResolutionPDEDeformableRegistration Self;
typedef ImageToImageFilter< TDisplacementField, TDisplacementField >
Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(MultiResolutionPDEDeformableRegistration,
ImageToImageFilter);
/** Fixed image type. */
typedef TFixedImage FixedImageType;
typedef typename FixedImageType::Pointer FixedImagePointer;
typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
/** Moving image type. */
typedef TMovingImage MovingImageType;
typedef typename MovingImageType::Pointer MovingImagePointer;
typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
/** Deformation field image type. */
typedef TDisplacementField DisplacementFieldType;
typedef typename DisplacementFieldType::Pointer DisplacementFieldPointer;
#ifdef ITKV3_COMPATIBILITY
typedef TDisplacementField DeformationFieldType;
typedef typename DeformationFieldType::Pointer DeformationFieldPointer;
#endif
/** ImageDimension. */
itkStaticConstMacro(ImageDimension, unsigned int, FixedImageType::ImageDimension);
/** Internal float image type. */
typedef Image< TRealType, itkGetStaticConstMacro(ImageDimension) > FloatImageType;
/** The internal registration type. */
typedef PDEDeformableRegistrationFilter< FloatImageType, FloatImageType, DisplacementFieldType > RegistrationType;
typedef typename RegistrationType::Pointer RegistrationPointer;
/** The default registration type. */
typedef DemonsRegistrationFilter< FloatImageType, FloatImageType, DisplacementFieldType > DefaultRegistrationType;
/** The fixed multi-resolution image pyramid type. */
typedef MultiResolutionPyramidImageFilter< FixedImageType, FloatImageType > FixedImagePyramidType;
typedef typename FixedImagePyramidType::Pointer FixedImagePyramidPointer;
/** The moving multi-resolution image pyramid type. */
typedef MultiResolutionPyramidImageFilter< MovingImageType, FloatImageType > MovingImagePyramidType;
typedef typename MovingImagePyramidType::Pointer MovingImagePyramidPointer;
/** The deformation field expander type. */
typedef VectorResampleImageFilter< DisplacementFieldType, DisplacementFieldType > FieldExpanderType;
typedef typename FieldExpanderType::Pointer FieldExpanderPointer;
typedef Array< unsigned int > NumberOfIterationsType;
/** Set the fixed image. */
virtual void SetFixedImage(const FixedImageType *ptr);
/** Get the fixed image. */
const FixedImageType * GetFixedImage(void) const;
/** Set the moving image. */
virtual void SetMovingImage(const MovingImageType *ptr);
/** Get the moving image. */
const MovingImageType * GetMovingImage(void) const;
/** Set initial deformation field to be used as is (no smoothing, no
* subsampling at the coarsest level of the pyramid. */
virtual void SetInitialDisplacementField(DisplacementFieldType *ptr)
{
this->m_InitialDisplacementField = ptr;
}
/** Set initial deformation field. No assumption is made on the
* input. It will therefore be smoothed and resampled to match the
* images characteristics at the coarsest level of the pyramid. */
virtual void SetArbitraryInitialDisplacementField(DisplacementFieldType *ptr)
{
this->SetInput(ptr);
}
/** Get output deformation field. */
const DisplacementFieldType * GetDisplacementField(void)
{ return this->GetOutput(); }
#ifdef ITKV3_COMPATIBILITY
virtual void SetInitialDeformationField(DisplacementFieldType *ptr)
{
this->SetInitialDisplacementField(ptr);
}
virtual void SetArbitraryInitialDeformationField(DisplacementFieldType *ptr)
{
this->SetArbitraryInitialDisplacementField(ptr);
}
/** Get output deformation field. */
const DeformationFieldType * GetDeformationField(void)
{
return itkDynamicCastInDebugMode<DeformationFieldType *> (this->GetDisplacementField());
}
#endif
/** Get the number of valid inputs. For
* MultiResolutionPDEDeformableRegistration, this checks whether the
* fixed and moving images have been set. While
* MultiResolutionPDEDeformableRegistration can take a third input
* as an initial deformation field, this input is not a required input.
*/
virtual std::vector< SmartPointer< DataObject > >::size_type GetNumberOfValidRequiredInputs() const;
/** Get/Set the internal registrator. */
itkSetObjectMacro(RegistrationFilter, RegistrationType);
itkGetModifiableObjectMacro(RegistrationFilter, RegistrationType);
/** Get/Set the fixed image pyramid. */
itkSetObjectMacro(FixedImagePyramid, FixedImagePyramidType);
itkGetModifiableObjectMacro(FixedImagePyramid, FixedImagePyramidType);
/** Get/Set the moving image pyramid. */
itkSetObjectMacro(MovingImagePyramid, MovingImagePyramidType);
itkGetModifiableObjectMacro(MovingImagePyramid, MovingImagePyramidType);
/** Set number of multi-resolution levels. */
virtual void SetNumberOfLevels(unsigned int num);
/** Get number of multi-resolution levels. */
itkGetConstReferenceMacro(NumberOfLevels, unsigned int);
/** Get the current resolution level being processed. */
itkGetConstReferenceMacro(CurrentLevel, unsigned int);
/** Get/Set the moving image pyramid. */
itkSetObjectMacro(FieldExpander, FieldExpanderType);
itkGetModifiableObjectMacro(FieldExpander, FieldExpanderType);
/** Set number of iterations per multi-resolution levels. */
itkSetMacro(NumberOfIterations, NumberOfIterationsType);
itkSetVectorMacro(NumberOfIterations, unsigned int, m_NumberOfLevels);
/** Get number of iterations per multi-resolution levels. */
itkGetConstReferenceMacro(NumberOfIterations, NumberOfIterationsType);
/** Stop the registration after the current iteration. */
virtual void StopRegistration();
protected:
MultiResolutionPDEDeformableRegistration();
// ~MultiResolutionPDEDeformableRegistration() {} default implementation ok
void PrintSelf(std::ostream & os, Indent indent) const;
/** Generate output data by performing the registration
* at each resolution level. */
virtual void GenerateData();
/** The current implementation of this class does not support
* streaming. As such it requires the largest possible region
* for the moving, fixed and input deformation field. */
virtual void GenerateInputRequestedRegion();
/** By default, the output deformation field has the same
* spacing, origin and LargestPossibleRegion as the input/initial
* deformation field.
*
* If the initial deformation field is not set, the output
* information is copied from the fixed image. */
virtual void GenerateOutputInformation();
/** The current implementation of this class does not supprot
* streaming. As such it produces the output for the largest
* possible region. */
virtual void EnlargeOutputRequestedRegion(DataObject *ptr);
/** This method returns true to indicate that the registration should
* terminate at the current resolution level. */
virtual bool Halt();
/** Override VeriyInputInformation() since this filter's inputs do
* not need to occoupy the same physical space.
*
* \sa ProcessObject::VerifyInputInformation
*/
virtual void VerifyInputInformation() {}
private:
MultiResolutionPDEDeformableRegistration(const Self &); //purposely not
// implemented
void operator=(const Self &); //purposely not
// implemented
RegistrationPointer m_RegistrationFilter;
FixedImagePyramidPointer m_FixedImagePyramid;
MovingImagePyramidPointer m_MovingImagePyramid;
FieldExpanderPointer m_FieldExpander;
DisplacementFieldPointer m_InitialDisplacementField;
unsigned int m_NumberOfLevels;
unsigned int m_CurrentLevel;
NumberOfIterationsType m_NumberOfIterations;
/** Flag to indicate user stop registration request. */
bool m_StopRegistrationFlag;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkMultiResolutionPDEDeformableRegistration.hxx"
#endif
#endif
|