Skip to content

Commit

Permalink
Merge pull request RTKConsortium#324 from acoussat/check-geometry
Browse files Browse the repository at this point in the history
ENH: filters check whether their geometry is set
  • Loading branch information
SimonRit authored Apr 11, 2020
2 parents 100bd89 + 40c0565 commit bc6d102
Show file tree
Hide file tree
Showing 54 changed files with 364 additions and 23 deletions.
4 changes: 4 additions & 0 deletions include/rtkADMMTotalVariationConeBeamReconstructionFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ class ADMMTotalVariationConeBeamReconstructionFilter
ADMMTotalVariationConeBeamReconstructionFilter();
~ADMMTotalVariationConeBeamReconstructionFilter() override = default;

/** Checks that inputs are correctly set. */
void
VerifyPreconditions() ITKv5_CONST override;

/** Does the real work. */
void
GenerateData() override;
Expand Down
10 changes: 10 additions & 0 deletions include/rtkADMMTotalVariationConeBeamReconstructionFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ ADMMTotalVariationConeBeamReconstructionFilter<TOutputImage, TGradientOutputImag
inputPtr1->SetRequestedRegion(inputPtr1->GetLargestPossibleRegion());
}

template <class TInputImage, class TOutputImage>
void
ADMMTotalVariationConeBeamReconstructionFilter<TInputImage, TOutputImage>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <typename TOutputImage, typename TGradientOutputImage>
void
ADMMTotalVariationConeBeamReconstructionFilter<TOutputImage, TGradientOutputImage>::GenerateOutputInformation()
Expand Down
4 changes: 4 additions & 0 deletions include/rtkADMMTotalVariationConjugateGradientOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ class ADMMTotalVariationConjugateGradientOperator : public ConjugateGradientOper
ADMMTotalVariationConjugateGradientOperator();
~ADMMTotalVariationConjugateGradientOperator() override = default;

/** Checks that inputs are correctly set. */
void
VerifyPreconditions() ITKv5_CONST override;

/** Does the real work. */
void
GenerateData() override;
Expand Down
10 changes: 10 additions & 0 deletions include/rtkADMMTotalVariationConjugateGradientOperator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ ADMMTotalVariationConjugateGradientOperator<TOutputImage, TGradientOutputImage>:
this->Modified();
}

template <class TInputImage, class TOutputImage>
void
ADMMTotalVariationConjugateGradientOperator<TInputImage, TOutputImage>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <typename TOutputImage, typename TGradientOutputImage>
void
ADMMTotalVariationConjugateGradientOperator<TOutputImage, TGradientOutputImage>::GenerateInputRequestedRegion()
Expand Down
4 changes: 4 additions & 0 deletions include/rtkADMMWaveletsConeBeamReconstructionFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ class ADMMWaveletsConeBeamReconstructionFilter
ADMMWaveletsConeBeamReconstructionFilter();
~ADMMWaveletsConeBeamReconstructionFilter() override = default;

/** Checks that inputs are correctly set. */
void
VerifyPreconditions() ITKv5_CONST override;

/** Does the real work. */
void
GenerateData() override;
Expand Down
10 changes: 10 additions & 0 deletions include/rtkADMMWaveletsConeBeamReconstructionFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ ADMMWaveletsConeBeamReconstructionFilter<TOutputImage>::SetBackProjectionFilter(
}
}

template <class TOutputImage>
void
ADMMWaveletsConeBeamReconstructionFilter<TOutputImage>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <typename TOutputImage>
void
ADMMWaveletsConeBeamReconstructionFilter<TOutputImage>::GenerateInputRequestedRegion()
Expand Down
4 changes: 4 additions & 0 deletions include/rtkBackProjectionImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ class BackProjectionImageFilter : public itk::InPlaceImageFilter<TInputImage, TO
};
~BackProjectionImageFilter() override = default;

/** Checks that inputs are correctly set. */
void
VerifyPreconditions() ITKv5_CONST override;

/** Apply changes to the input image requested region. */
void
GenerateInputRequestedRegion() override;
Expand Down
10 changes: 10 additions & 0 deletions include/rtkBackProjectionImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ BackProjectionImageFilter<TInputImage, TOutputImage>::GenerateInputRequestedRegi
}
}

template <class TInputImage, class TOutputImage>
void
BackProjectionImageFilter<TInputImage, TOutputImage>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <class TInputImage, class TOutputImage>
void
BackProjectionImageFilter<TInputImage, TOutputImage>::BeforeThreadedGenerateData()
Expand Down
4 changes: 4 additions & 0 deletions include/rtkConjugateGradientConeBeamReconstructionFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ class ConjugateGradientConeBeamReconstructionFilter : public IterativeConeBeamRe
ConjugateGradientConeBeamReconstructionFilter();
~ConjugateGradientConeBeamReconstructionFilter() override = default;

/** Checks that inputs are correctly set. */
void
VerifyPreconditions() ITKv5_CONST override;

/** Does the real work. */
void
GenerateData() override;
Expand Down
11 changes: 11 additions & 0 deletions include/rtkConjugateGradientConeBeamReconstructionFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ ConjugateGradientConeBeamReconstructionFilter<TOutputImage, TSingleComponentImag
}
}

template <typename TOutputImage, typename TSingleComponentImage, typename TWeightsImage>
void
ConjugateGradientConeBeamReconstructionFilter<TOutputImage, TSingleComponentImage, TWeightsImage>::VerifyPreconditions()
ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <typename TOutputImage, typename TSingleComponentImage, typename TWeightsImage>
void
ConjugateGradientConeBeamReconstructionFilter<TOutputImage, TSingleComponentImage, TWeightsImage>::
Expand Down
4 changes: 4 additions & 0 deletions include/rtkDisplacedDetectorImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ class ITK_EXPORT DisplacedDetectorImageFilter : public itk::InPlaceImageFilter<T
itkGetMacro(InferiorCorner, double);
itkGetMacro(SuperiorCorner, double);

/** Checks that inputs are correctly set. */
void
VerifyPreconditions() ITKv5_CONST override;

void
GenerateInputRequestedRegion() override;

Expand Down
10 changes: 10 additions & 0 deletions include/rtkDisplacedDetectorImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ DisplacedDetectorImageFilter<TInputImage, TOutputImage>::SetOffsets(double minOf
}
}

template <class TInputImage, class TOutputImage>
void
DisplacedDetectorImageFilter<TInputImage, TOutputImage>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

/**
* Account for the padding computed in GenerateOutputInformation to propagate the
* requested region.
Expand Down
4 changes: 4 additions & 0 deletions include/rtkFDKConeBeamReconstructionFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ class ITK_EXPORT FDKConeBeamReconstructionFilter : public itk::InPlaceImageFilte
FDKConeBeamReconstructionFilter();
~FDKConeBeamReconstructionFilter() override = default;

/** Checks that inputs are correctly set. */
void
VerifyPreconditions() ITKv5_CONST override;

void
GenerateInputRequestedRegion() override;

Expand Down
10 changes: 10 additions & 0 deletions include/rtkFDKConeBeamReconstructionFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ FDKConeBeamReconstructionFilter<TInputImage, TOutputImage, TFFTPrecision>::FDKCo
#endif
}

template <class TInputImage, class TOutputImage, class TFFTPrecision>
void
FDKConeBeamReconstructionFilter<TInputImage, TOutputImage, TFFTPrecision>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <class TInputImage, class TOutputImage, class TFFTPrecision>
void
FDKConeBeamReconstructionFilter<TInputImage, TOutputImage, TFFTPrecision>::GenerateInputRequestedRegion()
Expand Down
4 changes: 4 additions & 0 deletions include/rtkFDKWeightProjectionFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ class ITK_EXPORT FDKWeightProjectionFilter : public itk::InPlaceImageFilter<TInp
FDKWeightProjectionFilter() = default;
~FDKWeightProjectionFilter() override = default;

/** Checks that inputs are correctly set. */
void
VerifyPreconditions() ITKv5_CONST override;

void
BeforeThreadedGenerateData() override;

Expand Down
11 changes: 11 additions & 0 deletions include/rtkFDKWeightProjectionFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@

namespace rtk
{

template <class TInputImage, class TOutputImage>
void
FDKWeightProjectionFilter<TInputImage, TOutputImage>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <class TInputImage, class TOutputImage>
void
FDKWeightProjectionFilter<TInputImage, TOutputImage>::BeforeThreadedGenerateData()
Expand Down
3 changes: 3 additions & 0 deletions include/rtkFieldOfViewImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ class ITK_EXPORT FieldOfViewImageFilter : public itk::InPlaceImageFilter<TInputI
FieldOfViewImageFilter();
~FieldOfViewImageFilter() override = default;

/** Checks that inputs are correctly set. */
void VerifyPreconditions() ITKv5_CONST override;

void
BeforeThreadedGenerateData() override;

Expand Down
10 changes: 10 additions & 0 deletions include/rtkFieldOfViewImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ FieldOfViewImageFilter<TInputImage, TOutputImage>::ComputeFOVRadius(const FOVRad
return true;
}

template <class TInputImage, class TOutputImage>
void
FieldOfViewImageFilter<TInputImage, TOutputImage>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <class TInputImage, class TOutputImage>
void
FieldOfViewImageFilter<TInputImage, TOutputImage>::BeforeThreadedGenerateData()
Expand Down
3 changes: 3 additions & 0 deletions include/rtkForwardProjectionImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class ForwardProjectionImageFilter : public itk::InPlaceImageFilter<TInputImage,

~ForwardProjectionImageFilter() override = default;

/** Checks that inputs are correctly set. */
void VerifyPreconditions() ITKv5_CONST override;

/** Apply changes to the input image requested region. */
void
GenerateInputRequestedRegion() override;
Expand Down
10 changes: 10 additions & 0 deletions include/rtkForwardProjectionImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@
namespace rtk
{

template <class TInputImage, class TOutputImage>
void
ForwardProjectionImageFilter<TInputImage, TOutputImage>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <class TInputImage, class TOutputImage>
void
ForwardProjectionImageFilter<TInputImage, TOutputImage>::GenerateInputRequestedRegion()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ class ITK_EXPORT FourDConjugateGradientConeBeamReconstructionFilter
FourDConjugateGradientConeBeamReconstructionFilter();
~FourDConjugateGradientConeBeamReconstructionFilter() override = default;

/** Checks that inputs are correctly set. */
void VerifyPreconditions() ITKv5_CONST override;

void
GenerateOutputInformation() override;

Expand Down
11 changes: 11 additions & 0 deletions include/rtkFourDConjugateGradientConeBeamReconstructionFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,17 @@ FourDConjugateGradientConeBeamReconstructionFilter<VolumeSeriesType, ProjectionS
this->Modified();
}

template <class VolumeSeriesType, class ProjectionStackType>
void
FourDConjugateGradientConeBeamReconstructionFilter<VolumeSeriesType, ProjectionStackType>::VerifyPreconditions()
ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <class VolumeSeriesType, class ProjectionStackType>
void
FourDConjugateGradientConeBeamReconstructionFilter<VolumeSeriesType, ProjectionStackType>::GenerateOutputInformation()
Expand Down
3 changes: 3 additions & 0 deletions include/rtkFourDROOSTERConeBeamReconstructionFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@ class FourDROOSTERConeBeamReconstructionFilter
FourDROOSTERConeBeamReconstructionFilter();
~FourDROOSTERConeBeamReconstructionFilter() override = default;

/** Checks that inputs are correctly set. */
void VerifyPreconditions() ITKv5_CONST override;

/** Does the real work. */
void
GenerateData() override;
Expand Down
10 changes: 10 additions & 0 deletions include/rtkFourDROOSTERConeBeamReconstructionFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ FourDROOSTERConeBeamReconstructionFilter<VolumeSeriesType, ProjectionStackType>:
this->Modified();
}

template <typename VolumeSeriesType, typename ProjectionStackType>
void
FourDROOSTERConeBeamReconstructionFilter<VolumeSeriesType, ProjectionStackType>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <typename VolumeSeriesType, typename ProjectionStackType>
void
FourDROOSTERConeBeamReconstructionFilter<VolumeSeriesType, ProjectionStackType>::GenerateInputRequestedRegion()
Expand Down
3 changes: 3 additions & 0 deletions include/rtkFourDReconstructionConjugateGradientOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ class FourDReconstructionConjugateGradientOperator : public ConjugateGradientOpe
FourDReconstructionConjugateGradientOperator();
~FourDReconstructionConjugateGradientOperator() override = default;

/** Checks that inputs are correctly set. */
void VerifyPreconditions() ITKv5_CONST override;

/** Builds the pipeline and computes output information */
void
GenerateOutputInformation() override;
Expand Down
10 changes: 10 additions & 0 deletions include/rtkFourDReconstructionConjugateGradientOperator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ FourDReconstructionConjugateGradientOperator<VolumeSeriesType, ProjectionStackTy
m_ConstantVolumeSeriesSource->ReleaseDataFlagOn();
}

template <typename VolumeSeriesType, typename ProjectionStackType>
void
FourDReconstructionConjugateGradientOperator<VolumeSeriesType, ProjectionStackType>::VerifyPreconditions() ITKv5_CONST
{
this->Superclass::VerifyPreconditions();

if (this->m_Geometry.IsNull())
itkExceptionMacro(<< "Geometry has not been set.");
}

template <typename VolumeSeriesType, typename ProjectionStackType>
void
FourDReconstructionConjugateGradientOperator<VolumeSeriesType, ProjectionStackType>::GenerateOutputInformation()
Expand Down
3 changes: 3 additions & 0 deletions include/rtkFourDSARTConeBeamReconstructionFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ class ITK_EXPORT FourDSARTConeBeamReconstructionFilter
FourDSARTConeBeamReconstructionFilter();
~FourDSARTConeBeamReconstructionFilter() override = default;

/** Checks that inputs are correctly set. */
void VerifyPreconditions() ITKv5_CONST override;

void
GenerateInputRequestedRegion() override;

Expand Down
Loading

0 comments on commit bc6d102

Please sign in to comment.