go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkComputeDisplacementDistribution.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef __itkComputeDisplacementDistribution_h
19#define __itkComputeDisplacementDistribution_h
20
22
23#include "itkImageGridSampler.h"
26#include "itkImageFullSampler.h"
27#include "itkPlatformMultiThreader.h"
28
29namespace itk
30{
45template< class TFixedImage, class TTransform >
48{
49public:
50
55 typedef SmartPointer< const Self > ConstPointer;
56
58 itkNewMacro( Self );
59
63
65 typedef TFixedImage FixedImageType;
66 typedef typename FixedImageType::PixelType FixedImagePixelType;
67 typedef TTransform TransformType;
68 typedef typename TransformType::Pointer TransformPointer;
69 typedef typename FixedImageType::RegionType FixedImageRegionType;
73
77 itkStaticConstMacro( FixedImageDimension, unsigned int,
78 TFixedImage::ImageDimension );
79 typedef SpatialObject< itkGetStaticConstMacro( FixedImageDimension ) > FixedImageMaskType;
80 typedef typename FixedImageMaskType::Pointer FixedImageMaskPointer;
81 typedef typename FixedImageMaskType::ConstPointer FixedImageMaskConstPointer;
82 typedef typename TransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType;
83
85 itkSetConstObjectMacro( FixedImage, FixedImageType );
86
88 itkSetObjectMacro( Transform, TransformType );
89
91 itkSetObjectMacro( FixedImageMask, FixedImageMaskType );
92 itkSetConstObjectMacro( FixedImageMask, FixedImageMaskType );
93 itkGetConstObjectMacro( FixedImageMask, FixedImageMaskType );
94
96 itkSetMacro( NumberOfJacobianMeasurements, SizeValueType );
97
100 {
101 if( region != this->m_FixedImageRegion )
102 {
103 this->m_FixedImageRegion = region;
104 }
105 }
106
107
109 itkGetConstReferenceMacro( FixedImageRegion, FixedImageRegionType );
110
112 virtual void Compute( const ParametersType & mu,
113 double & jacg, double & maxJJ, std::string method );
114
116 virtual void ComputeSingleThreaded( const ParametersType & mu,
117 double & jacg, double & maxJJ, std::string method );
118
120 double & jacg, double & maxJJ, std::string methods );
121
123 void SetNumberOfWorkUnits( ThreadIdType numberOfThreads )
124 {
125 this->m_Threader->SetNumberOfWorkUnits( numberOfThreads );
126 }
127
128
129 virtual void BeforeThreadedCompute( const ParametersType & mu );
130
131 virtual void AfterThreadedCompute( double & jacg, double & maxJJ );
132
133protected:
134
137
139 typedef itk::PlatformMultiThreader ThreaderType;
140 typedef ThreaderType::WorkUnitInfo ThreadInfoType;
141
142 typename FixedImageType::ConstPointer m_FixedImage;
149 SizeValueType m_NumberOfParameters;
150 ThreaderType::Pointer m_Threader;
151
152 typedef typename FixedImageType::IndexType FixedImageIndexType;
153 typedef typename FixedImageType::PointType FixedImagePointType;
154 typedef typename TransformType::JacobianType JacobianType;
155 typedef typename JacobianType::ValueType JacobianValueType;
156
160
163
166
169 typedef typename ImageGridSamplerType
172
175 typedef typename TransformType::ScalarType CoordinateRepresentationType;
176 typedef typename TransformType::NumberOfParametersType NumberOfParametersType;
177
179 // \todo: note that this is an exact copy of itk::ComputeJacobianTerms
180 // in the future it would be better to refactoring this part of the code
182 ImageSampleContainerPointer & sampleContainer );
183
186
188 static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ComputeThreaderCallback( void * arg );
189
191 virtual inline void ThreadedCompute( ThreadIdType threadID );
192
194 virtual void InitializeThreadingParameters( void );
195
198 {
200 };
202
204 {
206 double st_MaxJJ;
210 };
211 itkPadStruct( ITK_CACHE_LINE_ALIGNMENT, ComputePerThreadStruct,
212 PaddedComputePerThreadStruct );
213 itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedComputePerThreadStruct,
214 AlignedComputePerThreadStruct );
215 mutable AlignedComputePerThreadStruct * m_ComputePerThreadVariables;
217
221
222private:
223
224 ComputeDisplacementDistribution( const Self & ); // purposely not implemented
225 void operator=( const Self & ); // purposely not implemented
226
227};
228
229} // end namespace itk
230
231#ifndef ITK_MANUAL_INSTANTIATION
232#include "itkComputeDisplacementDistribution.hxx"
233#endif
234
235#endif // end #ifndef __itkComputeDisplacementDistribution_h
This is a helper class for the automatic parameter estimation of the ASGD optimizer.
ScaledSingleValuedNonLinearOptimizer Superclass
TransformType::NumberOfParametersType NumberOfParametersType
virtual void Compute(const ParametersType &mu, double &jacg, double &maxJJ, std::string method)
virtual void ComputeSingleThreaded(const ParametersType &mu, double &jacg, double &maxJJ, std::string method)
ImageSampleContainerType::Pointer ImageSampleContainerPointer
AlignedComputePerThreadStruct * m_ComputePerThreadVariables
SpatialObject< itkGetStaticConstMacro(FixedImageDimension) > FixedImageMaskType
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, ComputePerThreadStruct, PaddedComputePerThreadStruct)
virtual void ThreadedCompute(ThreadIdType threadID)
itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension)
virtual void SampleFixedImageForJacobianTerms(ImageSampleContainerPointer &sampleContainer)
virtual void ComputeUsingSearchDirection(const ParametersType &mu, double &jacg, double &maxJJ, std::string methods)
ImageGridSampler< FixedImageType > ImageGridSamplerType
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedComputePerThreadStruct, AlignedComputePerThreadStruct)
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ComputeThreaderCallback(void *arg)
virtual void AfterThreadedCompute(double &jacg, double &maxJJ)
void SetFixedImageRegion(const FixedImageRegionType &region)
ScaledSingleValuedCostFunction::Pointer m_CostFunction
ImageRandomSamplerBaseType::Pointer ImageRandomSamplerBasePointer
ImageFullSampler< FixedImageType > ImageFullSamplerType
void SetNumberOfWorkUnits(ThreadIdType numberOfThreads)
FixedImageMaskType::ConstPointer FixedImageMaskConstPointer
void LaunchComputeThreaderCallback(void) const
ImageGridSamplerType::ImageSampleContainerType ImageSampleContainerType
TransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
ImageSamplerBase< FixedImageType > ImageSamplerBaseType
virtual void BeforeThreadedCompute(const ParametersType &mu)
virtual void InitializeThreadingParameters(void)
ImageRandomSamplerBase< FixedImageType > ImageRandomSamplerBaseType
Samples all voxels in the InputImageRegion.
Samples image voxels on a regular grid.
Superclass::ImageSampleContainerType ImageSampleContainerType
This class is a base class for any image sampler that randomly picks samples.
This class is a base class for any image sampler.


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo