RTK  1.4.0
Reconstruction Toolkit
rtkImportImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright RTK Consortium
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 rtkImportImageFilter_h
20 #define rtkImportImageFilter_h
21 
22 #include "itkImageSource.h"
23 #include "rtkMacro.h"
24 
25 namespace rtk
26 {
43 template< typename TImage >
44 class ImportImageFilter : public itk::ImageSource<TImage>
45 {
46 public:
48  typedef typename TImage::Pointer OutputImagePointer;
49  typedef typename TImage::SpacingType SpacingType;
50  typedef typename TImage::PointType OriginType;
51 
57 
59  itkNewMacro(Self);
60 
63 
66 
70 
74 
76  typedef typename TImage::PixelType PixelType;
77 
79  PixelType * GetImportPointer();
80 
88  void SetImportPointer(PixelType *ptr, SizeValueType num,
89  bool LetFilterManageMemory);
90 
95  void SetRegion(const RegionType & region)
96  { if ( m_Region != region ) { m_Region = region; this->Modified(); } }
97 
102  const RegionType & GetRegion() const
103  { return m_Region; }
104 
107  itkSetMacro(Spacing, SpacingType);
108  itkGetConstReferenceMacro(Spacing, SpacingType);
109  itkSetVectorMacro(Spacing, const float, TImage::ImageDimension);
111 
114  itkSetMacro(Origin, OriginType);
115  itkGetConstReferenceMacro(Origin, OriginType);
116  itkSetVectorMacro(Origin, const float, TImage::ImageDimension);
118 
120 
123  virtual void SetDirection(const DirectionType & direction);
124 
127  itkGetConstReferenceMacro(Direction, DirectionType);
128 
129 protected:
132  void PrintSelf(std::ostream & os, itk::Indent indent) const ITK_OVERRIDE;
133 
136  void GenerateData() ITK_OVERRIDE;
137 
141  void GenerateOutputInformation() ITK_OVERRIDE;
142 
150  void EnlargeOutputRequestedRegion(itk::DataObject *output) ITK_OVERRIDE;
151 
152 private:
153  ImportImageFilter(const ImportImageFilter &); //purposely not implemented
154  void operator=(const ImportImageFilter &); //purposely not implemented
155 
156  RegionType m_Region;
157  SpacingType m_Spacing;
158  OriginType m_Origin;
159  DirectionType m_Direction;
160 
161  PixelType * m_ImportPointer;
162  bool m_FilterManageMemory;
163  SizeValueType m_Size;
164 };
165 } // end namespace itk
166 
167 #ifndef ITK_MANUAL_INSTANTIATION
168 #include "rtkImportImageFilter.hxx"
169 #endif
170 
171 #endif
TPixel * GetImportPointer()
itk::Size< TImage::ImageDimension > SizeType
DirectionType m_Direction
void SetRegion(const RegionType &region)
void PrintSelf(std::ostream &os, Indent indent) const override
SizeType::SizeValueType SizeValueType
TImage::Pointer OutputImagePointer
itk::Index< TImage::ImageDimension > IndexType
void EnlargeOutputRequestedRegion(DataObject *output) override
itk::ImageSource< TImage > Superclass
TImage::PixelType PixelType
void GenerateOutputInformation() override
itk::SmartPointer< Self > Pointer
itk::ImageRegion< TImage::ImageDimension > RegionType
virtual void SetDirection(const DirectionType &direction)
TImage::SpacingType SpacingType
TImage::PointType OriginType
void SetImportPointer(TPixel *ptr, SizeValueType num, bool LetImageContainerManageMemory)
void GenerateData() override
itk::Matrix< double, TImage::ImageDimension, TImage::ImageDimension > DirectionType
const RegionType & GetRegion() const
SizeValueType m_Size
::itk::SizeValueType SizeValueType
~ImportImageFilter() override
#define itkSetMacro(name, type)
itk::SmartPointer< const Self > ConstPointer