go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkStackTransform.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 __itkStackTransform_h
19#define __itkStackTransform_h
20
22#include "itkIndex.h"
23
24namespace itk
25{
26
37template< class TScalarType,
38unsigned int NInputDimensions = 3,
39unsigned int NOutputDimensions = 3 >
41 public AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions >
42{
43public:
44
48 NInputDimensions,
49 NOutputDimensions > Superclass;
51 typedef SmartPointer< const Self > ConstPointer;
52
54 itkNewMacro( Self );
55
58
60 itkStaticConstMacro( InputSpaceDimension, unsigned int, NInputDimensions );
61 itkStaticConstMacro( OutputSpaceDimension, unsigned int, NOutputDimensions );
62 itkStaticConstMacro( ReducedInputSpaceDimension, unsigned int, NInputDimensions - 1 );
63 itkStaticConstMacro( ReducedOutputSpaceDimension, unsigned int, NOutputDimensions - 1 );
64
78 typedef typename
90 typedef typename Superclass::OutputVectorPixelType OutputVectorPixelType;
91 typedef typename Superclass::InputVectorPixelType InputVectorPixelType;
92
95 itkGetStaticConstMacro( ReducedInputSpaceDimension ),
96 itkGetStaticConstMacro( ReducedOutputSpaceDimension ) > SubTransformType;
98 typedef std::vector< SubTransformPointer > SubTransformContainerType;
100
104
106 typedef typename ParametersType::ArrayType ParametersArrayType;
107
109 OutputPointType TransformPoint( const InputPointType & ipp ) const override;
110
113 {
114 itkExceptionMacro(
115 << "TransformVector(const InputVectorType &) is not implemented "
116 << "for StackTransform" );
117 }
118
119
121 {
122 itkExceptionMacro(
123 << "TransformVector(const InputVnlVectorType &) is not implemented "
124 << "for StackTransform" );
125 }
126
127
129 {
130 itkExceptionMacro(
131 << "TransformCovariantVector(const InputCovariantVectorType &) is not implemented "
132 << "for StackTransform" );
133 }
134
135
142 const InputPointType & ipp,
143 JacobianType & jac,
144 NonZeroJacobianIndicesType & nzji ) const override;
145
148 void SetParameters( const ParametersType & param ) override;
149
152 const ParametersType & GetParameters( void ) const override;
153
155 void SetFixedParameters( const ParametersType & ) override
156 {
157 // \todo: to be implemented by Coert
158 }
159
160
162 const ParametersType & GetFixedParameters( void ) const override
163 {
164 // \todo: to be implemented by Coert: check this:
165 return this->m_FixedParameters;
166 }
167
168
171 {
172 if( this->m_SubTransformContainer.size() == 0 )
173 {
174 return 0;
175 }
176 else
177 {
178 return this->m_SubTransformContainer.size() * m_SubTransformContainer[ 0 ]->GetNumberOfParameters();
179 }
180 }
181
182
184 virtual void SetNumberOfSubTransforms( const unsigned int num )
185 {
186 if( this->m_NumberOfSubTransforms != num )
187 {
188 this->m_NumberOfSubTransforms = num;
189 this->m_SubTransformContainer.clear();
190 this->m_SubTransformContainer.resize( num );
191 this->Modified();
192 }
193 }
194
195
196 itkGetConstMacro( NumberOfSubTransforms, unsigned int );
197
199 itkSetMacro( StackSpacing, TScalarType );
200 itkGetConstMacro( StackSpacing, TScalarType );
201 itkSetMacro( StackOrigin, TScalarType );
202 itkGetConstMacro( StackOrigin, TScalarType );
203
205 virtual void SetSubTransform( unsigned int i, SubTransformType * transform )
206 {
207 this->m_SubTransformContainer[ i ] = transform;
208 this->Modified();
209 }
210
211
213 virtual void SetAllSubTransforms( SubTransformType * transform )
214 {
215 for( unsigned int t = 0; t < this->m_NumberOfSubTransforms; ++t )
216 {
217 // Copy transform
218 SubTransformPointer transformcopy = dynamic_cast< SubTransformType * >( transform->CreateAnother().GetPointer() );
219 transformcopy->SetFixedParameters( transform->GetFixedParameters() );
220 transformcopy->SetParameters( transform->GetParameters() );
221 // Set sub transform
222 this->m_SubTransformContainer[ t ] = transformcopy;
223 }
224 }
225
226
228 virtual SubTransformPointer GetSubTransform( unsigned int i )
229 {
230 return this->m_SubTransformContainer[ i ];
231 }
232
233
236
239 const InputPointType & ipp, SpatialJacobianType & sj ) const override
240 {
241 itkExceptionMacro( << "Not implemented for StackTransform" );
242 }
243
244
246 const InputPointType & ipp, SpatialHessianType & sh ) const override
247 {
248 itkExceptionMacro( << "Not implemented for StackTransform" );
249 }
250
251
254 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override
255 {
256 itkExceptionMacro( << "Not implemented for StackTransform" );
257 }
258
259
261 const InputPointType & ipp, SpatialJacobianType & sj,
263 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override
264 {
265 itkExceptionMacro( << "Not implemented for StackTransform" );
266 }
267
268
271 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override
272 {
273 itkExceptionMacro( << "Not implemented for StackTransform" );
274 }
275
276
278 const InputPointType & ipp, SpatialHessianType & sh,
280 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override
281 {
282 itkExceptionMacro( << "Not implemented for StackTransform" );
283 }
284
285
286protected:
287
289 ~StackTransform() override {}
290
291private:
292
293 StackTransform( const Self & ); // purposely not implemented
294 void operator=( const Self & ); // purposely not implemented
295
296 // Number of transforms and transform container
299
300 // Stack spacing and origin of last dimension
302
303};
304
305} // end namespace itk
306
307#ifndef ITK_MANUAL_INSTANTIATION
308#include "itkStackTransform.hxx"
309#endif
310
311#endif
Transform maps points, vectors and covariant vectors from an input space to an output space.
Superclass::OutputCovariantVectorType OutputCovariantVectorType
Superclass::ParametersValueType ParametersValueType
Superclass::OutputVectorType OutputVectorType
Superclass::ParametersType ParametersType
Superclass::InputCovariantVectorType InputCovariantVectorType
std::vector< SpatialHessianType > JacobianOfSpatialHessianType
Superclass::OutputVnlVectorType OutputVnlVectorType
Superclass::NumberOfParametersType NumberOfParametersType
Superclass::InputVectorType InputVectorType
std::vector< SpatialJacobianType > JacobianOfSpatialJacobianType
Superclass::OutputPointType OutputPointType
Superclass::JacobianType JacobianType
Superclass::InputPointType InputPointType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Superclass::ScalarType ScalarType
Superclass::InputVnlVectorType InputVnlVectorType
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
std::vector< unsigned long > NonZeroJacobianIndicesType
Implements stack of transforms: one for every last dimension index.
virtual void SetAllSubTransforms(SubTransformType *transform)
unsigned int m_NumberOfSubTransforms
virtual void SetSubTransform(unsigned int i, SubTransformType *transform)
itkStaticConstMacro(ReducedOutputSpaceDimension, unsigned int, NOutputDimensions - 1)
itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions)
Superclass::ParametersType ParametersType
Superclass::SpatialJacobianType SpatialJacobianType
Superclass::OutputPointType OutputPointType
virtual void SetNumberOfSubTransforms(const unsigned int num)
itkStaticConstMacro(ReducedInputSpaceDimension, unsigned int, NInputDimensions - 1)
SubTransformType::InputPointType SubTransformInputPointType
ParametersType::ArrayType ParametersArrayType
Superclass::InputVectorPixelType InputVectorPixelType
SubTransformContainerType m_SubTransformContainer
void GetJacobianOfSpatialJacobian(const InputPointType &ipp, SpatialJacobianType &sj, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
Superclass::ParametersValueType ParametersValueType
const ParametersType & GetFixedParameters(void) const override
std::vector< SubTransformPointer > SubTransformContainerType
Superclass::OutputVnlVectorType OutputVnlVectorType
void GetSpatialJacobian(const InputPointType &ipp, SpatialJacobianType &sj) const override
Superclass::NumberOfParametersType NumberOfParametersType
SubTransformType::OutputPointType SubTransformOutputPointType
Superclass::OutputVectorPixelType OutputVectorPixelType
Superclass::JacobianType JacobianType
Superclass::InputCovariantVectorType InputCovariantVectorType
OutputPointType TransformPoint(const InputPointType &ipp) const override
void GetJacobianOfSpatialJacobian(const InputPointType &ipp, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
Superclass::InputPointType InputPointType
SubTransformType::JacobianType SubTransformJacobianType
Superclass::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
NumberOfParametersType GetNumberOfParameters(void) const override
StackTransform(const Self &)
void GetJacobianOfSpatialHessian(const InputPointType &ipp, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
void SetFixedParameters(const ParametersType &) override
Superclass::OutputCovariantVectorType OutputCovariantVectorType
void GetSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh) const override
void operator=(const Self &)
AdvancedTransform< TScalarType, itkGetStaticConstMacro(ReducedInputSpaceDimension), itkGetStaticConstMacro(ReducedOutputSpaceDimension) > SubTransformType
SubTransformType::Pointer SubTransformPointer
Superclass::SpatialHessianType SpatialHessianType
Superclass::InputVectorType InputVectorType
OutputVectorType TransformVector(const InputVectorType &) const override
Superclass::OutputVectorType OutputVectorType
Superclass::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
const ParametersType & GetParameters(void) const override
SmartPointer< Self > Pointer
NumberOfParametersType GetNumberOfNonZeroJacobianIndices(void) const override
AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
Superclass::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
Superclass::ScalarType ScalarType
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions)
void GetJacobianOfSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
SmartPointer< const Self > ConstPointer
Superclass::InputVnlVectorType InputVnlVectorType
virtual SubTransformPointer GetSubTransform(unsigned int i)
void SetParameters(const ParametersType &param) override
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
void GetJacobian(const InputPointType &ipp, JacobianType &jac, NonZeroJacobianIndicesType &nzji) const override


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo