ITK  5.2.0
Insight Toolkit
itkDisplacementFieldJacobianDeterminantFilter.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 itkDisplacementFieldJacobianDeterminantFilter_h
19 #define itkDisplacementFieldJacobianDeterminantFilter_h
20 
22 #include "itkImageToImageFilter.h"
23 #include "itkVector.h"
24 #include "vnl/vnl_matrix.h"
25 #include "vnl/vnl_det.h"
26 
27 namespace itk
28 {
111 template <typename TInputImage,
112  typename TRealType = float,
113  typename TOutputImage = Image<TRealType, TInputImage::ImageDimension>>
115  : public ImageToImageFilter<TInputImage, TOutputImage>
116 {
117 public:
118  ITK_DISALLOW_COPY_AND_ASSIGN(DisplacementFieldJacobianDeterminantFilter);
119 
125 
127  itkNewMacro(Self);
128 
131 
134  using OutputPixelType = typename TOutputImage::PixelType;
135  using InputPixelType = typename TInputImage::PixelType;
136 
138  using InputImageType = TInputImage;
139  using OutputImageType = TOutputImage;
140  using InputImagePointer = typename InputImageType::Pointer;
141  using OutputImagePointer = typename OutputImageType::Pointer;
142 
144  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
145 
147  static constexpr unsigned int VectorDimension = InputPixelType::Dimension;
148 
150  using RealType = TRealType;
153 
158 
160  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
161 
170  void
171  GenerateInputRequestedRegion() override;
172 
177  void
179  {
180  this->SetUseImageSpacing(true);
181  }
182 
186  void
188  {
189  this->SetUseImageSpacing(false);
190  }
191 
194  void
195  SetUseImageSpacing(bool);
196 
197  itkGetConstMacro(UseImageSpacing, bool);
198 
200 
203  void
204  SetDerivativeWeights(const WeightsType &);
205  itkGetConstReferenceMacro(DerivativeWeights, WeightsType);
207 
208 protected:
210  ~DisplacementFieldJacobianDeterminantFilter() override = default;
211 
215  void
216  BeforeThreadedGenerateData() override;
217 
230  void
231  DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
232 
233 
234  void
235  PrintSelf(std::ostream & os, Indent indent) const override;
236 
237  using ImageBaseType = typename InputImageType::Superclass;
238 
240  itkGetConstObjectMacro(RealValuedInputImage, ImageBaseType);
241 
243  itkGetConstReferenceMacro(NeighborhoodRadius, RadiusType);
244  itkSetMacro(NeighborhoodRadius, RadiusType);
246 
247  virtual TRealType
248  EvaluateAtNeighborhood(const ConstNeighborhoodIteratorType & it) const;
249 
252 
256 
257 private:
259 
261 
262  typename ImageBaseType::ConstPointer m_RealValuedInputImage;
263 
265 };
266 } // end namespace itk
267 
268 #ifndef ITK_MANUAL_INSTANTIATION
269 # include "itkDisplacementFieldJacobianDeterminantFilter.hxx"
270 #endif
271 
272 #endif
itk::DisplacementFieldJacobianDeterminantFilter::InputPixelType
typename TInputImage::PixelType InputPixelType
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:135
itk::DisplacementFieldJacobianDeterminantFilter::SetUseImageSpacingOff
void SetUseImageSpacingOff()
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:187
itk::ConstNeighborhoodIterator::RadiusType
typename Superclass::RadiusType RadiusType
Definition: itkConstNeighborhoodIterator.h:70
itk::ImageSource::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImageSource.h:91
itkNeighborhoodIterator.h
itk::Vector
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::DisplacementFieldJacobianDeterminantFilter::m_DerivativeWeights
WeightsType m_DerivativeWeights
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:251
itk::DisplacementFieldJacobianDeterminantFilter::RealType
TRealType RealType
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:150
itk::ThreadIdType
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
itk::ImageToImageFilter
Base class for filters that take an image as input and produce an image as output.
Definition: itkImageToImageFilter.h:108
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::DisplacementFieldJacobianDeterminantFilter::m_NeighborhoodRadius
RadiusType m_NeighborhoodRadius
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:264
itk::DisplacementFieldJacobianDeterminantFilter::OutputPixelType
typename TOutputImage::PixelType OutputPixelType
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:134
itk::ImageToImageFilter::InputImagePointer
typename InputImageType::Pointer InputImagePointer
Definition: itkImageToImageFilter.h:130
itk::DisplacementFieldJacobianDeterminantFilter::m_RealValuedInputImage
ImageBaseType::ConstPointer m_RealValuedInputImage
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:262
itk::DisplacementFieldJacobianDeterminantFilter::SetUseImageSpacingOn
void SetUseImageSpacingOn()
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:178
itk::ImageToImageFilter::InputImageType
TInputImage InputImageType
Definition: itkImageToImageFilter.h:129
itkImageToImageFilter.h
itk::FixedArray< TRealType, 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
itk::ConstNeighborhoodIterator
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
Definition: itkConstNeighborhoodIterator.h:50
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:138
itkVector.h
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:86
itk::DisplacementFieldJacobianDeterminantFilter
Computes a scalar image from a vector image (e.g., deformation field) input, where each output scalar...
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:114
itk::DisplacementFieldJacobianDeterminantFilter::RadiusType
typename ConstNeighborhoodIteratorType::RadiusType RadiusType
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:157
itk::DisplacementFieldJacobianDeterminantFilter::ImageBaseType
typename InputImageType::Superclass ImageBaseType
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:237
itk::GTest::TypedefsAndConstructors::Dimension2::Dimension
constexpr unsigned int Dimension
Definition: itkGTestTypedefsAndConstructors.h:44
itk::DisplacementFieldJacobianDeterminantFilter::m_RequestedNumberOfThreads
ThreadIdType m_RequestedNumberOfThreads
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:260
itk::DisplacementFieldJacobianDeterminantFilter::m_UseImageSpacing
bool m_UseImageSpacing
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:258
itk::ImageSource::OutputImageType
TOutputImage OutputImageType
Definition: itkImageSource.h:90
itk::DisplacementFieldJacobianDeterminantFilter::m_HalfDerivativeWeights
WeightsType m_HalfDerivativeWeights
Definition: itkDisplacementFieldJacobianDeterminantFilter.h:255