ITK  5.2.0
Insight Toolkit
itkGenerateImageSource.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 
19 #ifndef itkGenerateImageSource_h
20 #define itkGenerateImageSource_h
21 
22 #include "itkImageSource.h"
23 
24 namespace itk
25 {
26 
40 template <typename TOutputImage>
41 class ITK_TEMPLATE_EXPORT GenerateImageSource : public ImageSource<TOutputImage>
42 {
43 public:
44  ITK_DISALLOW_COPY_AND_MOVE(GenerateImageSource);
45 
50 
52  using OutputImageType = TOutputImage;
53  using OutputImagePointer = typename OutputImageType::Pointer;
54  using PixelType = typename OutputImageType::PixelType;
56  using SpacingType = typename OutputImageType::SpacingType;
60 
63 
64  using SizeType = typename TOutputImage::SizeType;
66 
68  static constexpr unsigned int NDimensions = TOutputImage::ImageDimension;
69 
71  itkTypeMacro(GenerateImageSource, ImageSource);
72 
73  itkSetMacro(UseReferenceImage, bool);
74  itkBooleanMacro(UseReferenceImage);
75  itkGetConstMacro(UseReferenceImage, bool);
76 
80  itkSetMacro(Size, SizeType);
81  itkGetConstReferenceMacro(Size, SizeType);
82  itkSetVectorMacro(Size, SizeValueType, NDimensions);
84 
88  itkSetMacro(Spacing, SpacingType);
89  itkGetConstReferenceMacro(Spacing, SpacingType);
90  itkSetVectorMacro(Spacing, const float, NDimensions);
92 
93 
97  itkSetMacro(Origin, PointType);
98  itkGetConstReferenceMacro(Origin, PointType);
99  itkSetVectorMacro(Origin, const float, NDimensions);
101 
106  itkSetMacro(Direction, DirectionType);
107  itkGetConstReferenceMacro(Direction, DirectionType);
109 
114  itkSetMacro(StartIndex, IndexType);
115  itkGetConstReferenceMacro(StartIndex, IndexType);
117 
119  void
120  SetOutputParametersFromImage(const ReferenceImageBaseType * image);
121 
128  itkSetInputMacro(ReferenceImage, ReferenceImageBaseType);
129 
131  itkGetInputMacro(ReferenceImage, ReferenceImageBaseType);
132 
133 protected:
135  ~GenerateImageSource() override = default;
136  void
137  PrintSelf(std::ostream & os, Indent indent) const override;
138 
139  void
140  GenerateOutputInformation() override;
141 
142 private:
143  SizeType m_Size; // size of the output image
148  bool m_UseReferenceImage{ false };
149 };
150 
151 } // namespace itk
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 # include "itkGenerateImageSource.hxx"
155 #endif
156 
157 #endif // itkGenerateImageSource_h
itk::GenerateImageSource::PixelType
typename OutputImageType::PixelType PixelType
Definition: itkGenerateImageSource.h:54
itk::GenerateImageSource::m_Origin
PointType m_Origin
Definition: itkGenerateImageSource.h:145
itk::GTest::TypedefsAndConstructors::Dimension2::DirectionType
ImageBaseType::DirectionType DirectionType
Definition: itkGTestTypedefsAndConstructors.h:52
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itkImageSource.h
itk::GenerateImageSource
a Base class for image sources which need to have image size, and other meta-data set.
Definition: itkGenerateImageSource.h:41
itk::Size
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:69
itk::ImageBase
Base class for templated image classes.
Definition: itkImageBase.h:105
itk::GenerateImageSource::m_Spacing
SpacingType m_Spacing
Definition: itkGenerateImageSource.h:144
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::GenerateImageSource::RegionType
typename OutputImageType::RegionType RegionType
Definition: itkGenerateImageSource.h:55
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::GenerateImageSource::m_Size
SizeType m_Size
Definition: itkGenerateImageSource.h:143
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::GenerateImageSource::SizeValueType
typename TOutputImage::SizeValueType SizeValueType
Definition: itkGenerateImageSource.h:65
itk::GenerateImageSource::m_Direction
DirectionType m_Direction
Definition: itkGenerateImageSource.h:146
itk::GenerateImageSource::SizeType
typename TOutputImage::SizeType SizeType
Definition: itkGenerateImageSource.h:64
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::GenerateImageSource::PointType
typename OutputImageType::PointType PointType
Definition: itkGenerateImageSource.h:57
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::GenerateImageSource::m_StartIndex
IndexType m_StartIndex
Definition: itkGenerateImageSource.h:147
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::GenerateImageSource::IndexType
typename OutputImageType::IndexType IndexType
Definition: itkGenerateImageSource.h:59
itk::GenerateImageSource::SpacingType
typename OutputImageType::SpacingType SpacingType
Definition: itkGenerateImageSource.h:56
itk::GenerateImageSource::DirectionType
typename OutputImageType::DirectionType DirectionType
Definition: itkGenerateImageSource.h:58
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:83
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90