| 334 | /** Supports either TransformToDeterminantOfSpatialJacobianSource or TransformToSpatialJacobianSource as TSource. */ |
| 335 | template <template <typename, typename> class TSource, typename TOutputImage> |
| 336 | auto |
| 337 | CreateJacobianSource() const |
| 338 | { |
| 339 | const auto & resampleImageFilter = *(this->m_Elastix->GetElxResamplerBase()->GetAsITKBaseType()); |
| 340 | |
| 341 | /** Create an setup Jacobian generator. */ |
| 342 | const auto jacGenerator = TSource<TOutputImage, CoordinateType>::New(); |
| 343 | |
| 344 | jacGenerator->SetTransform(this->GetAsITKBaseType()); |
| 345 | jacGenerator->SetOutputSize(resampleImageFilter.GetSize()); |
| 346 | jacGenerator->SetOutputSpacing(resampleImageFilter.GetOutputSpacing()); |
| 347 | jacGenerator->SetOutputOrigin(resampleImageFilter.GetOutputOrigin()); |
| 348 | jacGenerator->SetOutputIndex(resampleImageFilter.GetOutputStartIndex()); |
| 349 | jacGenerator->SetOutputDirection(resampleImageFilter.GetOutputDirection()); |
| 350 | // NOTE: We can not use the following, since the fixed image does not exist in transformix |
| 351 | // jacGenerator->SetOutputParametersFromImage( |
| 352 | // this->GetRegistration()->GetAsITKBaseType()->GetFixedImage() ); |
| 353 | |
| 354 | return jacGenerator; |
| 355 | } |
| 356 | |
| 357 | |
| 358 | /** Creates an info changer that may change the direction of the image to the original value. */ |