Skip to content

Commit

Permalink
COMP: Preserve constness of input geometry object in one-step reconst…
Browse files Browse the repository at this point in the history
…ruction
  • Loading branch information
Simon Rit authored and SimonRit committed Sep 30, 2024
1 parent 59c5464 commit 93ac0c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/rtkMechlemOneStepSpectralReconstructionFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class ITK_TEMPLATE_EXPORT MechlemOneStepSpectralReconstructionFilter
#endif

/** Pass the geometry to all filters needing it */
itkSetObjectMacro(Geometry, ThreeDCircularProjectionGeometry);
itkSetConstObjectMacro(Geometry, ThreeDCircularProjectionGeometry);

itkSetMacro(NumberOfIterations, int);
itkGetMacro(NumberOfIterations, int);
Expand Down Expand Up @@ -366,7 +366,7 @@ class ITK_TEMPLATE_EXPORT MechlemOneStepSpectralReconstructionFilter
InstantiateHessiansBackProjectionFilter(int bptype);
#endif

ThreeDCircularProjectionGeometry::Pointer m_Geometry;
ThreeDCircularProjectionGeometry::ConstPointer m_Geometry;

int m_NumberOfIterations;
int m_NumberOfProjectionsPerSubset;
Expand Down
12 changes: 6 additions & 6 deletions include/rtkMechlemOneStepSpectralReconstructionFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ MechlemOneStepSpectralReconstructionFilter<TOutputImage, TPhotonCounts, TSpectru
m_ReorderPhotonCountsFilter->SetInputGeometry(this->m_Geometry);
m_ReorderPhotonCountsFilter->SetPermutation(ReorderProjectionsFilterPhotonCountsType::SHUFFLE);
m_ExtractPhotonCountsFilter->SetInput(m_ReorderPhotonCountsFilter->GetOutput());

m_ForwardProjectionFilter->SetGeometry(m_ReorderPhotonCountsFilter->GetOutputGeometry());
m_SingleComponentForwardProjectionFilter->SetGeometry(m_ReorderPhotonCountsFilter->GetOutputGeometry());
m_GradientsBackProjectionFilter->SetGeometry(m_ReorderPhotonCountsFilter->GetOutputGeometry());
Expand All @@ -349,6 +350,11 @@ MechlemOneStepSpectralReconstructionFilter<TOutputImage, TPhotonCounts, TSpectru
else
{
m_ExtractPhotonCountsFilter->SetInput(this->GetInputPhotonCounts());

m_ForwardProjectionFilter->SetGeometry(this->m_Geometry);
m_SingleComponentForwardProjectionFilter->SetGeometry(this->m_Geometry);
m_GradientsBackProjectionFilter->SetGeometry(this->m_Geometry.GetPointer());
m_HessiansBackProjectionFilter->SetGeometry(this->m_Geometry.GetPointer());
}

m_ForwardProjectionFilter->SetInput(0, m_ProjectionsSource->GetOutput());
Expand Down Expand Up @@ -430,12 +436,6 @@ MechlemOneStepSpectralReconstructionFilter<TOutputImage, TPhotonCounts, TSpectru
m_GradientsSource->SetInformationFromImage(this->GetInputMaterialVolumes());
m_HessiansSource->SetInformationFromImage(this->GetInputMaterialVolumes());

// For the same reason, set geometry now
m_ForwardProjectionFilter->SetGeometry(this->m_Geometry);
m_SingleComponentForwardProjectionFilter->SetGeometry(this->m_Geometry);
m_GradientsBackProjectionFilter->SetGeometry(this->m_Geometry.GetPointer());
m_HessiansBackProjectionFilter->SetGeometry(this->m_Geometry.GetPointer());

// Set regularization parameters
m_SQSRegul->SetRegularizationWeights(m_RegularizationWeights);
m_SQSRegul->SetRadius(m_RegularizationRadius);
Expand Down
7 changes: 4 additions & 3 deletions include/rtkReorderProjectionsImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class ITK_TEMPLATE_EXPORT ReorderProjectionsImageFilter : public itk::ImageToIma
using PermutationType = enum { NONE = 0, SORT = 1, SHUFFLE = 2 };

using GeometryType = ThreeDCircularProjectionGeometry;
using GeometryConstPointer = GeometryType::ConstPointer;
using GeometryPointer = GeometryType::Pointer;

/** Standard New method. */
Expand All @@ -75,7 +76,7 @@ class ITK_TEMPLATE_EXPORT ReorderProjectionsImageFilter : public itk::ImageToIma

/** Get / Set the object pointer to projection geometry */
itkGetModifiableObjectMacro(OutputGeometry, GeometryType);
itkSetObjectMacro(InputGeometry, GeometryType);
itkSetConstObjectMacro(InputGeometry, ThreeDCircularProjectionGeometry);

/** Get / Set the kind of permutation requested */
itkGetMacro(Permutation, PermutationType);
Expand Down Expand Up @@ -104,8 +105,8 @@ class ITK_TEMPLATE_EXPORT ReorderProjectionsImageFilter : public itk::ImageToIma

private:
/** RTK geometry objects */
GeometryPointer m_InputGeometry;
GeometryPointer m_OutputGeometry;
GeometryConstPointer m_InputGeometry;
GeometryPointer m_OutputGeometry;

/** Input and output signal vectors */
std::vector<double> m_InputSignal;
Expand Down

0 comments on commit 93ac0c3

Please sign in to comment.