selxDisplacementFieldItkImageFilterSink.h 3.59 KB
Newer Older
Floris Berendsen's avatar
Floris Berendsen committed
1
2
/*=========================================================================
 *
3
 *  Copyright Leiden University Medical Center, Erasmus University Medical
Floris Berendsen's avatar
Floris Berendsen committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 *  Center and contributors
 *
 *  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.
 *
 *=========================================================================*/

20
21
22
#ifndef selxDisplacementFieldItkImageFilterSink_h
#define selxDisplacementFieldItkImageFilterSink_h

23
#include "selxSuperElastixComponent.h"
24
#include "selxItkRegistrationMethodv4Interfaces.h"
25
#include <string.h>
26
#include "selxMacro.h"
27
#include "itkImageFileWriter.h"
28
29
#include "selxAnyFileWriter.h"
#include "selxFileWriterDecorator.h"
30
31
32

namespace selx
{
33
34
35
template< int Dimensionality, class TPixel >
class DisplacementFieldItkImageFilterSinkComponent :
  public SuperElastixComponent<
36
  Accepting< DisplacementFieldItkImageSourceInterface< Dimensionality, TPixel > >,
37
38
39
40
  Providing< SinkInterface >
  >
{
public:
41

42
  selxNewMacro( DisplacementFieldItkImageFilterSinkComponent, ComponentBase );
43

44
  //itkStaticConstMacro(Dimensionality, unsigned int, Dimensionality);
45

46
47
  DisplacementFieldItkImageFilterSinkComponent();
  virtual ~DisplacementFieldItkImageFilterSinkComponent();
48

49
  typedef TPixel PixelType;
50

51
52
53
54
55
  typedef DisplacementFieldItkImageSourceInterface< Dimensionality, TPixel >              AcceptingDisplacementFieldInterfaceType;
  typedef typename itk::Image< itk::Vector< PixelType, Dimensionality >, Dimensionality > DeformationFieldImageType;
  typedef typename DeformationFieldImageType::Pointer                                     DeformationFieldImageTypePointer;
  typedef typename itk::ImageFileWriter< DeformationFieldImageType >                      DeformationFieldImageWriterType;
  typedef FileWriterDecorator< DeformationFieldImageWriterType >                          DecoratedWriterType;
56

57
58
  //Accepting Interfaces:
  virtual int Set( AcceptingDisplacementFieldInterfaceType * ) override;
59

60
61
62
  //Providing Interfaces:
  virtual void SetMiniPipelineOutput( itk::DataObject::Pointer ) override;
  virtual itk::DataObject::Pointer GetMiniPipelineOutput( void ) override;
63

64
  virtual AnyFileWriter::Pointer GetOutputFileWriter( void ) override;
65

66
  virtual itk::DataObject::Pointer GetInitializedOutput( void ) override;
67

68
  virtual bool MeetsCriterion( const ComponentBase::CriterionType & criterion ) override;
69

70
  static const char * GetDescription() { return "DisplacementFieldItkImageFilterSink Component"; }
71

72
private:
73

74
75
  typename DeformationFieldImageType::Pointer m_MiniPipelineOutputImage;
  typename DeformationFieldImageType::Pointer m_OverlordOutputImage;
76

77
protected:
78

79
  // return the class name and the template arguments to uniquely identify this component.
Floris Berendsen's avatar
Floris Berendsen committed
80
  static inline const std::map< std::string, std::string > TemplateProperties()
81
  {
Floris Berendsen's avatar
Floris Berendsen committed
82
    return { { keys::NameOfClass, "DisplacementFieldItkImageFilterSinkComponent" }, { keys::PixelType, PodString< TPixel >::Get() }, { keys::Dimensionality, std::to_string( Dimensionality ) } };
83
  }
84
};
85
86
87
88
} //end namespace selx
#ifndef ITK_MANUAL_INSTANTIATION
#include "selxDisplacementFieldItkImageFilterSink.hxx"
#endif
89
#endif // #define selxDisplacementFieldItkImageFilterSink_h