ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkScalarImageToRunLengthMatrixFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software 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 #ifndef itkScalarImageToRunLengthMatrixFilter_h
19 #define itkScalarImageToRunLengthMatrixFilter_h
20 
21 #include "itkImage.h"
22 #include "itkHistogram.h"
23 #include "itkNumericTraits.h"
24 #include "itkVectorContainer.h"
25 #include "itkProcessObject.h"
26 
27 namespace itk
28 {
29 namespace Statistics
30 {
31 
105 template<typename TImageType, typename THistogramFrequencyContainer =
106  DenseFrequencyContainer2>
107 class ITK_TEMPLATE_EXPORT ScalarImageToRunLengthMatrixFilter : public ProcessObject
108 {
109 public:
115 
118 
120  itkNewMacro( Self );
121 
122  typedef TImageType ImageType;
123  typedef typename ImageType::Pointer ImagePointer;
124  typedef typename ImageType::ConstPointer ImageConstPointer;
125  typedef typename ImageType::PixelType PixelType;
126  typedef typename ImageType::IndexType IndexType;
127  typedef typename ImageType::RegionType RegionType;
128  typedef typename ImageType::SizeType RadiusType;
129  typedef typename ImageType::OffsetType OffsetType;
132  typedef typename ImageType::PointType PointType;
133 
136 
142 
144  itkStaticConstMacro( ImageDimension, unsigned int,
145  TImageType::ImageDimension );
146 
148  itkStaticConstMacro( DefaultBinsPerAxis, unsigned int, 256 );
149 
159  itkSetObjectMacro( Offsets, OffsetVector );
160 
170  void SetOffset( const OffsetType offset );
171 
175  itkGetModifiableObjectMacro(Offsets, OffsetVector );
176 
178  itkSetMacro( NumberOfBinsPerAxis, unsigned int );
179 
181  itkGetConstMacro( NumberOfBinsPerAxis, unsigned int );
182 
187  void SetPixelValueMinMax( PixelType min, PixelType max );
188 
190  itkGetConstMacro( Min, PixelType );
191 
193  itkGetConstMacro( Max, PixelType );
194 
199  void SetDistanceValueMinMax( RealType min, RealType max );
200 
204  itkGetConstMacro( MinDistance, RealType );
205 
209  itkGetConstMacro( MaxDistance, RealType );
210 
212  using Superclass::SetInput;
213  void SetInput( const ImageType *image );
214 
216  const ImageType * GetInput() const;
217 
219  void SetMaskImage( const ImageType *image );
220 
222  const ImageType * GetMaskImage() const;
223 
225  const HistogramType * GetOutput() const;
226 
231  itkSetMacro( InsidePixelValue, PixelType );
232  itkGetConstMacro( InsidePixelValue, PixelType );
234 
235 protected:
237  virtual ~ScalarImageToRunLengthMatrixFilter() ITK_OVERRIDE {};
238  virtual void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE;
239 
242 
244  using Superclass::MakeOutput;
245  virtual DataObjectPointer MakeOutput( DataObjectPointerArraySizeType idx ) ITK_OVERRIDE;
246 
248  virtual void GenerateData() ITK_OVERRIDE;
249 
257  void NormalizeOffsetDirection(OffsetType &offset);
258 
259 private:
260 
261  unsigned int m_NumberOfBinsPerAxis;
262  PixelType m_Min;
263  PixelType m_Max;
264  RealType m_MinDistance;
265  RealType m_MaxDistance;
266  PixelType m_InsidePixelValue;
267 
268  MeasurementVectorType m_LowerBound;
269  MeasurementVectorType m_UpperBound;
271 
272 };
273 } // end of namespace Statistics
274 } // end of namespace itk
275 
276 #ifndef ITK_MANUAL_INSTANTIATION
277 #include "itkScalarImageToRunLengthMatrixFilter.hxx"
278 #endif
279 
280 #endif
Light weight base class for most itk classes.
This class stores measurement vectors in the context of n-dimensional histogram.
Definition: itkHistogram.h:77
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType
This class computes a run length matrix (histogram) from a given image and a mask image if provided...
DataObjectPointerArray::size_type DataObjectPointerArraySizeType
Superclass::MeasurementVectorType MeasurementVectorType
Definition: itkHistogram.h:101
Histogram< MeasurementType, THistogramFrequencyContainer > HistogramType
Define a front-end to the STL &quot;vector&quot; container that conforms to the IndexedContainerInterface.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Define additional traits for native types such as int or float.