ITK  5.2.0
Insight Toolkit
itkPasteImageFilter.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 #ifndef itkPasteImageFilter_h
19 #define itkPasteImageFilter_h
20 
21 #include "itkInPlaceImageFilter.h"
22 #include "itkSmartPointer.h"
24 #include <numeric>
25 
26 namespace itk
27 {
28 
29 
56 template <typename TInputImage, typename TSourceImage = TInputImage, typename TOutputImage = TInputImage>
57 class ITK_TEMPLATE_EXPORT PasteImageFilter : public InPlaceImageFilter<TInputImage, TOutputImage>
58 {
59 public:
60  ITK_DISALLOW_COPY_AND_MOVE(PasteImageFilter);
61 
67 
69  itkNewMacro(Self);
70 
72  itkTypeMacro(PasteImageFilter, InPlaceImageFilter);
73 
75  using InputImagePointer = typename Superclass::InputImagePointer;
76  using OutputImagePointer = typename Superclass::OutputImagePointer;
77 
79  using InputImageType = TInputImage;
80  using OutputImageType = TOutputImage;
81  using SourceImageType = TSourceImage;
85 
86  using SourceImagePointer = typename SourceImageType::Pointer;
87  using SourceImageConstPointer = typename SourceImageType::ConstPointer;
88 
90  using OutputImagePixelType = typename OutputImageType::PixelType;
91  using InputImagePixelType = typename InputImageType::PixelType;
92  using SourceImagePixelType = typename SourceImageType::PixelType;
93 
102 
104 
105 
107  static constexpr unsigned int InputImageDimension = InputImageType::ImageDimension;
108  static constexpr unsigned int OutputImageDimension = OutputImageType::ImageDimension;
109  static constexpr unsigned int SourceImageDimension = SourceImageType::ImageDimension;
110 
113  itkSetMacro(DestinationIndex, InputImageIndexType);
114  itkGetConstMacro(DestinationIndex, InputImageIndexType);
116 
125  itkSetMacro(DestinationSkipAxes, InputSkipAxesArrayType);
126  itkGetConstMacro(DestinationSkipAxes, InputSkipAxesArrayType);
128 
129 
132  itkSetMacro(SourceRegion, SourceImageRegionType);
133  itkGetConstMacro(SourceRegion, SourceImageRegionType);
135 
138  itkSetInputMacro(DestinationImage, InputImageType);
139  itkGetInputMacro(DestinationImage, InputImageType);
141 
144  itkSetInputMacro(SourceImage, SourceImageType);
145  itkGetInputMacro(SourceImage, SourceImageType);
147 
152  itkSetDecoratedInputMacro(Constant, SourceImagePixelType);
153  itkGetDecoratedInputMacro(Constant, SourceImagePixelType);
155 
156 
166  void
167  GenerateInputRequestedRegion() override;
168 
169 
175  void
176  VerifyInputInformation() ITKv5_CONST override
177  {}
178 
179  void
180  VerifyPreconditions() ITKv5_CONST override;
181 
182  bool
183  CanRunInPlace() const override;
184 
185 protected:
187  ~PasteImageFilter() override = default;
188  void
189  PrintSelf(std::ostream & os, Indent indent) const override;
190 
191  InputImageSizeType
192  GetPresumedDestinationSize() const;
193 
194 
204  void
205  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
206 
207 
208  SourceImageRegionType m_SourceRegion;
209 
210  InputImageIndexType m_DestinationIndex;
211  InputSkipAxesArrayType m_DestinationSkipAxes;
212 
213  static_assert(InputImageDimension >= SourceImageDimension,
214  "The source image dimension is greater than the input image.");
215 };
216 } // end namespace itk
217 
218 #ifndef ITK_MANUAL_INSTANTIATION
219 # include "itkPasteImageFilter.hxx"
220 #endif
221 
222 #endif
itk::SimpleDataObjectDecorator
Decorates any "simple" data type (data types without smart pointers) with a DataObject API.
Definition: itkSimpleDataObjectDecorator.h:66
itk::PasteImageFilter::VerifyInputInformation
void VerifyInputInformation() ITKv5_CONST override
Definition: itkPasteImageFilter.h:176
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itk::InPlaceImageFilter
Base class for filters that take an image as input and overwrite that image as the output.
Definition: itkInPlaceImageFilter.h:77
itk::PasteImageFilter::OutputImageSizeType
typename OutputImageType::SizeType OutputImageSizeType
Definition: itkPasteImageFilter.h:96
itk::PasteImageFilter::SourceImageRegionType
typename SourceImageType::RegionType SourceImageRegionType
Definition: itkPasteImageFilter.h:84
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::PasteImageFilter::InputImageSizeType
typename InputImageType::SizeType InputImageSizeType
Definition: itkPasteImageFilter.h:98
itk::PasteImageFilter::SourceImageIndexType
typename SourceImageType::IndexType SourceImageIndexType
Definition: itkPasteImageFilter.h:99
itk::PasteImageFilter
Paste an image (or a constant value) into another image.
Definition: itkPasteImageFilter.h:57
itk::ImageToImageFilter::InputImagePixelType
typename InputImageType::PixelType InputImagePixelType
Definition: itkImageToImageFilter.h:133
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::PasteImageFilter::SourceImageConstPointer
typename SourceImageType::ConstPointer SourceImageConstPointer
Definition: itkPasteImageFilter.h:87
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::PasteImageFilter::SourceImagePixelType
typename SourceImageType::PixelType SourceImagePixelType
Definition: itkPasteImageFilter.h:92
itk::PasteImageFilter::SourceImageSizeType
typename SourceImageType::SizeType SourceImageSizeType
Definition: itkPasteImageFilter.h:100
itk::PasteImageFilter::OutputImageIndexType
typename OutputImageType::IndexType OutputImageIndexType
Definition: itkPasteImageFilter.h:95
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::PasteImageFilter::SourceImageType
TSourceImage SourceImageType
Definition: itkPasteImageFilter.h:81
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itk::FixedArray< bool, InputImageType::ImageDimension >
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itkInPlaceImageFilter.h
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itk::PasteImageFilter::InputImageIndexType
typename InputImageType::IndexType InputImageIndexType
Definition: itkPasteImageFilter.h:97
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itkSmartPointer.h
itkSimpleDataObjectDecorator.h
itk::PasteImageFilter::SourceImagePointer
typename SourceImageType::Pointer SourceImagePointer
Definition: itkPasteImageFilter.h:86
itk::ImageToImageFilter::InputImageRegionType
typename InputImageType::RegionType InputImageRegionType
Definition: itkImageToImageFilter.h:132
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90