ITK  6.0.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  * https://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;
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  itkOverrideGetNameOfClassMacro(GenerateImageSource);
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);
88  itkSetMacro(Spacing, SpacingType);
89  itkGetConstReferenceMacro(Spacing, SpacingType);
90  itkSetVectorMacro(Spacing, const float, NDimensions);
97  itkSetMacro(Origin, PointType);
98  itkGetConstReferenceMacro(Origin, PointType);
99  itkSetVectorMacro(Origin, const float, NDimensions);
106  itkSetMacro(Direction, DirectionType);
107  itkGetConstReferenceMacro(Direction, DirectionType);
114  itkSetMacro(StartIndex, IndexType);
115  itkGetConstReferenceMacro(StartIndex, IndexType);
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
144  SpacingType m_Spacing{};
145  PointType m_Origin{};
146  DirectionType m_Direction{};
147  IndexType m_StartIndex{};
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
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::GenerateImageSource::PixelType
typename OutputImageType::PixelType PixelType
Definition: itkGenerateImageSource.h:54
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:114
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::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::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: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
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:86
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90