RTK  1.4.0
Reconstruction Toolkit
rtkProjectionsReader.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 rtkProjectionsReader_h
20 #define rtkProjectionsReader_h
21 
22 // ITK
23 #include <itkImageSource.h>
24 #include <itkImageIOFactory.h>
26 
27 // RTK
30 
31 // Standard lib
32 #include <vector>
33 #include <string>
34 
35 namespace rtk
36 {
37 
119 template <class TOutputImage>
120 class ITK_EXPORT ProjectionsReader : public itk::ImageSource<TOutputImage>
121 {
122 public:
127 
129  itkNewMacro(Self);
130 
133 
135  typedef TOutputImage OutputImageType;
136  typedef typename OutputImageType::Pointer OutputImagePointer;
137  typedef typename OutputImageType::RegionType OutputImageRegionType;
138  typedef typename OutputImageType::PixelType OutputImagePixelType;
139  typedef typename OutputImageType::DirectionType OutputImageDirectionType;
140  typedef typename OutputImageType::SpacingType OutputImageSpacingType;
141  typedef typename OutputImageType::PointType OutputImagePointType;
142  typedef typename OutputImageType::SizeType OutputImageSizeType;
143 
144  typedef std::vector<std::string> FileNamesContainer;
147  typedef std::vector< double > WaterPrecorrectionVectorType;
148 
153 
155  itkStaticConstMacro(OutputImageDimension, unsigned int,
156  TOutputImage::ImageDimension);
157 
160  void SetFileNames (const FileNamesContainer &name)
161  {
162  if ( m_FileNames != name)
163  {
164  m_FileNames = name;
165  this->Modified();
166  }
167  }
168  const FileNamesContainer & GetFileNames() const
169  {
170  return m_FileNames;
171  }
173 
175  itkSetMacro(Origin, OutputImagePointType);
176  itkGetConstMacro(Origin, OutputImagePointType);
178 
179  itkSetMacro(Spacing, OutputImageSpacingType);
180  itkGetConstMacro(Spacing, OutputImageSpacingType);
181 
182  itkSetMacro(Direction, OutputImageDirectionType);
183  itkGetConstMacro(Direction, OutputImageDirectionType);
184 
186  itkSetMacro(UpperBoundaryCropSize, OutputImageSizeType);
187  itkGetConstMacro(UpperBoundaryCropSize, OutputImageSizeType);
188  itkSetMacro(LowerBoundaryCropSize, OutputImageSizeType);
189  itkGetConstMacro(LowerBoundaryCropSize, OutputImageSizeType);
191 
193  itkSetMacro(ShrinkFactors, ShrinkFactorsType);
194  itkGetConstReferenceMacro(ShrinkFactors, ShrinkFactorsType);
196 
198  itkSetMacro(MedianRadius, MedianRadiusType);
199  itkGetConstReferenceMacro(MedianRadius, MedianRadiusType);
200  itkGetMacro(ConditionalMedianThresholdMultiplier, double);
201  itkSetMacro(ConditionalMedianThresholdMultiplier, double);
203 
205  itkGetMacro(AirThreshold, double);
206  itkSetMacro(AirThreshold, double);
208 
209  itkGetMacro(ScatterToPrimaryRatio, double);
210  itkSetMacro(ScatterToPrimaryRatio, double);
211 
212  itkGetMacro(NonNegativityConstraintThreshold, double);
213  itkSetMacro(NonNegativityConstraintThreshold, double);
214 
219  itkGetMacro(I0, double);
220  itkSetMacro(I0, double);
222 
226  itkGetMacro(IDark, double);
227  itkSetMacro(IDark, double);
229 
231  itkGetMacro(WaterPrecorrectionCoefficients, WaterPrecorrectionVectorType);
232  virtual void SetWaterPrecorrectionCoefficients(const WaterPrecorrectionVectorType _arg)
233  {
234  if (this->m_WaterPrecorrectionCoefficients != _arg)
235  {
236  this->m_WaterPrecorrectionCoefficients = _arg;
237  this->Modified();
238  }
239  }
241 
244  itkSetMacro(ComputeLineIntegral, bool);
245  itkGetConstMacro(ComputeLineIntegral, bool);
246  itkBooleanMacro(ComputeLineIntegral);
248 
251  itkGetMacro(VectorComponent, unsigned int)
252  itkSetMacro(VectorComponent, unsigned int)
253 
254 
255  itkGetMacro(ImageIO, itk::ImageIOBase::Pointer);
256 
259  void GenerateOutputInformation(void) ITK_OVERRIDE;
260 
261 protected:
263  virtual ~ProjectionsReader() ITK_OVERRIDE {}
264  void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
265 
267  void GenerateData() ITK_OVERRIDE;
268 
270  FileNamesContainer m_FileNames;
271 
272 private:
273  ProjectionsReader(const Self&); //purposely not implemented
274  void operator=(const Self&); //purposely not implemented
275 
279  template<class TInputImage> void PropagateParametersToMiniPipeline();
280  void ConnectElektaRawFilter(itk::ImageBase<OutputImageDimension> **nextInputBase);
281  void PropagateI0(itk::ImageBase<OutputImageDimension> **nextInputBase);
283 
287  itk::ProcessObject::Pointer m_RawDataReader;
288 
290  itk::ProcessObject::Pointer m_VectorComponentSelectionFilter;
291  itk::ProcessObject::Pointer m_ChangeInformationFilter;
292  itk::ProcessObject::Pointer m_ElektaRawFilter;
293  itk::ProcessObject::Pointer m_CropFilter;
294  itk::ProcessObject::Pointer m_ConditionalMedianFilter;
295  itk::ProcessObject::Pointer m_BinningFilter;
296  itk::ProcessObject::Pointer m_ScatterFilter;
297  itk::ProcessObject::Pointer m_I0EstimationFilter;
298 
302 
306 
310 
312  itk::ImageIOBase::Pointer m_ImageIO;
313 
317  OutputImagePointType m_Origin;
318  OutputImageSpacingType m_Spacing;
319  OutputImageDirectionType m_Direction;
320  OutputImageSizeType m_LowerBoundaryCropSize;
321  OutputImageSizeType m_UpperBoundaryCropSize;
322  ShrinkFactorsType m_ShrinkFactors;
323  MedianRadiusType m_MedianRadius;
327  double m_I0;
328  double m_IDark;
330  WaterPrecorrectionVectorType m_WaterPrecorrectionCoefficients;
332  unsigned int m_VectorComponent;
333 };
334 
335 } //namespace rtk
336 
337 #ifndef ITK_MANUAL_INSTANTIATION
338 #include "rtkProjectionsReader.hxx"
339 #endif
340 
341 #endif // rtkProjectionsReader_h
rtk::ConditionalMedianImageFilter< TOutputImage >::MedianRadiusType MedianRadiusType
itk::StreamingImageFilter< TOutputImage, TOutputImage > StreamingType
OutputImageDirectionType m_Direction
OutputImageType::RegionType OutputImageRegionType
std::vector< double > WaterPrecorrectionVectorType
Performs the classical water precorrection for beam hardening (Kachelriess, Med. Phys. 2006)
OutputImagePointType m_Origin
itk::ProcessObject::Pointer m_VectorComponentSelectionFilter
std::vector< std::string > FileNamesContainer
virtual ~ProjectionsReader() override
OutputImageType::SizeType OutputImageSizeType
itk::ProcessObject::Pointer m_ScatterFilter
OutputImageSpacingType m_Spacing
OutputImageSizeType m_UpperBoundaryCropSize
itk::ImageSource< TOutputImage > Superclass
itk::ConstNeighborhoodIterator< TInputImage >::RadiusType MedianRadiusType
WaterPrecorrectionVectorType m_WaterPrecorrectionCoefficients
itk::ImageSource< TOutputImage >::Pointer m_RawCastFilter
OutputImageType::Pointer OutputImagePointer
const FileNamesContainer & GetFileNames() const
OutputImageType::DirectionType OutputImageDirectionType
FileNamesContainer m_FileNames
itk::ProcessObject::Pointer m_I0EstimationFilter
itk::ProcessObject::Pointer m_BinningFilter
StreamingType::Pointer m_StreamingFilter
MedianRadiusType m_MedianRadius
itk::FixedArray< unsigned int, TOutputImage::ImageDimension > ShrinkFactorsType
itk::ImageIOBase::Pointer m_ImageIO
itk::ProcessObject::Pointer m_ChangeInformationFilter
itk::ImageSource< TOutputImage >::Pointer m_RawToAttenuationFilter
OutputImageSizeType m_LowerBoundaryCropSize
OutputImageType::SpacingType OutputImageSpacingType
itk::ProcessObject::Pointer m_CropFilter
void SetFileNames(const FileNamesContainer &name)
OutputImageType::PixelType OutputImagePixelType
itk::ProcessObject::Pointer m_ElektaRawFilter
WaterPrecorrectionType::Pointer m_WaterPrecorrectionFilter
itk::ProcessObject::Pointer m_RawDataReader
itk::ProcessObject::Pointer m_ConditionalMedianFilter
virtual void SetWaterPrecorrectionCoefficients(const WaterPrecorrectionVectorType _arg)
ShrinkFactorsType m_ShrinkFactors
itk::SmartPointer< Self > Pointer
OutputImageType::PointType OutputImagePointType
rtk::WaterPrecorrectionImageFilter< TOutputImage, TOutputImage > WaterPrecorrectionType
#define itkSetMacro(name, type)