Skip to content

Commit

Permalink
STYLE: Fixed style
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrilmory committed Feb 12, 2025
1 parent 46046e2 commit 27dbf24
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ main(int argc, char * argv[])
materialAttenuationsReader->Update();

// Get parameters from the images
const unsigned int MaximumEnergy = incidentSpectrumReaderHighEnergy->GetOutput()->GetLargestPossibleRegion().GetSize(0);
const unsigned int MaximumEnergy =
incidentSpectrumReaderHighEnergy->GetOutput()->GetLargestPossibleRegion().GetSize(0);

// If the detector response is given by the user, use it. Otherwise, assume it is included in the
// incident spectrum, and fill the response with ones
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ main(int argc, char * argv[])
materialAttenuationsReader->Update();

// Get parameters from the images
const unsigned int MaximumEnergy = incidentSpectrumReaderHighEnergy->GetOutput()->GetLargestPossibleRegion().GetSize(0);
const unsigned int MaximumEnergy =
incidentSpectrumReaderHighEnergy->GetOutput()->GetLargestPossibleRegion().GetSize(0);

// If the detector response is given by the user, use it. Otherwise, assume it is included in the
// incident spectrum, and fill the response with ones
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ main(int argc, char * argv[])
const unsigned int NumberOfSpectralBins = spectralProjection->GetVectorLength();
const unsigned int MaximumEnergy = incidentSpectrum->GetLargestPossibleRegion().GetSize()[0];

// Read the thresholds on command line and check their number
// Read the thresholds on command line and check their number
itk::VariableLengthVector<unsigned int> thresholds;
thresholds.SetSize(NumberOfSpectralBins + 1);
if (args_info.thresholds_given == NumberOfSpectralBins)
Expand Down
48 changes: 24 additions & 24 deletions include/rtkMechlemOneStepSpectralReconstructionFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,30 +320,30 @@ class ITK_TEMPLATE_EXPORT MechlemOneStepSpectralReconstructionFilter

#if !defined(ITK_WRAPPING_PARSER)
/** Member pointers to the filters used internally (for convenience)*/
typename CastMaterialVolumesFilterType::Pointer m_CastMaterialVolumesFilter;
typename CastMeasuredProjectionsFilterType::Pointer m_CastMeasuredProjectionsFilter;
typename ExtractMeasuredProjectionsFilterType::Pointer m_ExtractMeasuredProjectionsFilter;
typename AddFilterType::Pointer m_AddGradients;
typename SingleComponentForwardProjectionFilterType::Pointer m_SingleComponentForwardProjectionFilter;
typename MaterialProjectionsSourceType::Pointer m_ProjectionsSource;
typename SingleComponentImageSourceType::Pointer m_SingleComponentProjectionsSource;
typename SingleComponentImageSourceType::Pointer m_SingleComponentVolumeSource;
typename GradientsSourceType::Pointer m_GradientsSource;
typename HessiansSourceType::Pointer m_HessiansSource;
typename WeidingerForwardModelType::Pointer m_WeidingerForward;
typename SQSRegularizationType::Pointer m_SQSRegul;
typename AddMatrixAndDiagonalFilterType::Pointer m_AddHessians;
typename NewtonFilterType::Pointer m_NewtonFilter;
typename NesterovFilterType::Pointer m_NesterovFilter;
typename ForwardProjectionFilterType::Pointer m_ForwardProjectionFilter;
typename GradientsBackProjectionFilterType::Pointer m_GradientsBackProjectionFilter;
typename HessiansBackProjectionFilterType::Pointer m_HessiansBackProjectionFilter;
typename MultiplyFilterType::Pointer m_MultiplySupportFilter;
typename MultiplyGradientFilterType::Pointer m_MultiplyRegulGradientsFilter;
typename MultiplyGradientFilterType::Pointer m_MultiplyRegulHessiansFilter;
typename MultiplyGradientFilterType::Pointer m_MultiplyGradientToBeBackprojectedFilter;
typename ReorderMeasuredProjectionsFilterType::Pointer m_ReorderMeasuredProjectionsFilter;
typename ReorderProjectionsWeightsFilterType::Pointer m_ReorderProjectionsWeightsFilter;
typename CastMaterialVolumesFilterType::Pointer m_CastMaterialVolumesFilter;
typename CastMeasuredProjectionsFilterType::Pointer m_CastMeasuredProjectionsFilter;
typename ExtractMeasuredProjectionsFilterType::Pointer m_ExtractMeasuredProjectionsFilter;
typename AddFilterType::Pointer m_AddGradients;
typename SingleComponentForwardProjectionFilterType::Pointer m_SingleComponentForwardProjectionFilter;
typename MaterialProjectionsSourceType::Pointer m_ProjectionsSource;
typename SingleComponentImageSourceType::Pointer m_SingleComponentProjectionsSource;
typename SingleComponentImageSourceType::Pointer m_SingleComponentVolumeSource;
typename GradientsSourceType::Pointer m_GradientsSource;
typename HessiansSourceType::Pointer m_HessiansSource;
typename WeidingerForwardModelType::Pointer m_WeidingerForward;
typename SQSRegularizationType::Pointer m_SQSRegul;
typename AddMatrixAndDiagonalFilterType::Pointer m_AddHessians;
typename NewtonFilterType::Pointer m_NewtonFilter;
typename NesterovFilterType::Pointer m_NesterovFilter;
typename ForwardProjectionFilterType::Pointer m_ForwardProjectionFilter;
typename GradientsBackProjectionFilterType::Pointer m_GradientsBackProjectionFilter;
typename HessiansBackProjectionFilterType::Pointer m_HessiansBackProjectionFilter;
typename MultiplyFilterType::Pointer m_MultiplySupportFilter;
typename MultiplyGradientFilterType::Pointer m_MultiplyRegulGradientsFilter;
typename MultiplyGradientFilterType::Pointer m_MultiplyRegulHessiansFilter;
typename MultiplyGradientFilterType::Pointer m_MultiplyGradientToBeBackprojectedFilter;
typename ReorderMeasuredProjectionsFilterType::Pointer m_ReorderMeasuredProjectionsFilter;
typename ReorderProjectionsWeightsFilterType::Pointer m_ReorderProjectionsWeightsFilter;
#endif

/** The inputs of this filter have the same type but not the same meaning
Expand Down
8 changes: 4 additions & 4 deletions include/rtkMechlemOneStepSpectralReconstructionFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ MechlemOneStepSpectralReconstructionFilter<TOutputImage, TMeasuredProjections, T

template <class TOutputImage, class TMeasuredProjections, class TIncidentSpectrum>
void
MechlemOneStepSpectralReconstructionFilter<TOutputImage, TMeasuredProjections, TIncidentSpectrum>::SetInputMaterialVolumes(
const VectorImageType * variableLengthVectorMaterialVolumes)
MechlemOneStepSpectralReconstructionFilter<TOutputImage, TMeasuredProjections, TIncidentSpectrum>::
SetInputMaterialVolumes(const VectorImageType * variableLengthVectorMaterialVolumes)
{
m_CastMaterialVolumesFilter->SetInput(variableLengthVectorMaterialVolumes);
this->SetNthInput(0, const_cast<TOutputImage *>(m_CastMaterialVolumesFilter->GetOutput()));
Expand All @@ -104,8 +104,8 @@ MechlemOneStepSpectralReconstructionFilter<TOutputImage, TMeasuredProjections, T

template <class TOutputImage, class TMeasuredProjections, class TIncidentSpectrum>
void
MechlemOneStepSpectralReconstructionFilter<TOutputImage, TMeasuredProjections, TIncidentSpectrum>::SetInputMeasuredProjections(
const VectorImageType * variableLengthVectorMeasuredProjections)
MechlemOneStepSpectralReconstructionFilter<TOutputImage, TMeasuredProjections, TIncidentSpectrum>::
SetInputMeasuredProjections(const VectorImageType * variableLengthVectorMeasuredProjections)
{
m_CastMeasuredProjectionsFilter->SetInput(variableLengthVectorMeasuredProjections);
this->SetNthInput(1, const_cast<TMeasuredProjections *>(m_CastMeasuredProjectionsFilter->GetOutput()));
Expand Down
22 changes: 12 additions & 10 deletions include/rtkSimplexSpectralProjectionsDecompositionImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,12 @@ template <typename DecomposedProjectionsType,
typename DetectorResponseImageType,
typename MaterialAttenuationsImageType>
void
SimplexSpectralProjectionsDecompositionImageFilter<DecomposedProjectionsType,
MeasuredProjectionsType,
IncidentSpectrumImageType,
DetectorResponseImageType,
MaterialAttenuationsImageType>::
SetInputSecondIncidentSpectrum(const VectorSpectrumImageType * SecondIncidentSpectrum)
SimplexSpectralProjectionsDecompositionImageFilter<
DecomposedProjectionsType,
MeasuredProjectionsType,
IncidentSpectrumImageType,
DetectorResponseImageType,
MaterialAttenuationsImageType>::SetInputSecondIncidentSpectrum(const VectorSpectrumImageType * SecondIncidentSpectrum)
{
this->m_FlattenSecondFilter->SetInput(SecondIncidentSpectrum);
this->m_PermuteSecondFilter->SetInput(this->m_FlattenSecondFilter->GetOutput());
Expand Down Expand Up @@ -410,8 +410,8 @@ SimplexSpectralProjectionsDecompositionImageFilter<DecomposedProjectionsType,
typename IncidentSpectrumImageType::SizeType sizeRequested = requested.GetSize();
for (unsigned int i = 0; i < IncidentSpectrumImageType::GetImageDimension() - 1; i++)
{
indexRequested[i+1] = this->GetOutput()->GetRequestedRegion().GetIndex()[i];
sizeRequested[i+1] = this->GetOutput()->GetRequestedRegion().GetSize()[i];
indexRequested[i + 1] = this->GetOutput()->GetRequestedRegion().GetIndex()[i];
sizeRequested[i + 1] = this->GetOutput()->GetRequestedRegion().GetSize()[i];
}

inputPtr2->SetRequestedRegion(requested);
Expand Down Expand Up @@ -560,7 +560,8 @@ SimplexSpectralProjectionsDecompositionImageFilter<DecomposedProjectionsType,
if (this->GetInputSecondIncidentSpectrum()) // Dual energy CT
{
spectra.set_size(2, m_NumberOfEnergies);
for (int e = 0; e < m_NumberOfEnergies; e++) {
for (int e = 0; e < m_NumberOfEnergies; e++)
{
spectra.put(0, e, spectrumIt.Get());
spectra.put(1, e, secondSpectrumIt.Get());
++spectrumIt;
Expand All @@ -570,7 +571,8 @@ SimplexSpectralProjectionsDecompositionImageFilter<DecomposedProjectionsType,
else
{
spectra.set_size(1, m_NumberOfEnergies);
for (int e = 0; e < m_NumberOfEnergies; e++) {
for (int e = 0; e < m_NumberOfEnergies; e++)
{
spectra.put(0, e, spectrumIt.Get());
++spectrumIt;
}
Expand Down
34 changes: 18 additions & 16 deletions include/rtkSpectralForwardModelImageFilter.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ template <typename DecomposedProjectionsType,
typename DetectorResponseImageType,
typename MaterialAttenuationsImageType>
void
SpectralForwardModelImageFilter<
DecomposedProjectionsType,
MeasuredProjectionsType,
IncidentSpectrumImageType,
DetectorResponseImageType,
MaterialAttenuationsImageType>::SetInputIncidentSpectrum(const VectorSpectrumImageType * IncidentSpectrum)
SpectralForwardModelImageFilter<DecomposedProjectionsType,
MeasuredProjectionsType,
IncidentSpectrumImageType,
DetectorResponseImageType,
MaterialAttenuationsImageType>::SetInputIncidentSpectrum(const VectorSpectrumImageType *
IncidentSpectrum)
{
this->m_FlattenFilter->SetInput(IncidentSpectrum);
this->m_PermuteFilter->SetInput(this->m_FlattenFilter->GetOutput());
Expand All @@ -141,12 +141,12 @@ template <typename DecomposedProjectionsType,
typename DetectorResponseImageType,
typename MaterialAttenuationsImageType>
void
SpectralForwardModelImageFilter<DecomposedProjectionsType,
MeasuredProjectionsType,
IncidentSpectrumImageType,
DetectorResponseImageType,
MaterialAttenuationsImageType>::
SetInputSecondIncidentSpectrum(const VectorSpectrumImageType * SecondIncidentSpectrum)
SpectralForwardModelImageFilter<
DecomposedProjectionsType,
MeasuredProjectionsType,
IncidentSpectrumImageType,
DetectorResponseImageType,
MaterialAttenuationsImageType>::SetInputSecondIncidentSpectrum(const VectorSpectrumImageType * SecondIncidentSpectrum)
{
this->m_FlattenSecondFilter->SetInput(SecondIncidentSpectrum);
this->m_PermuteSecondFilter->SetInput(this->m_FlattenSecondFilter->GetOutput());
Expand Down Expand Up @@ -401,8 +401,8 @@ SpectralForwardModelImageFilter<DecomposedProjectionsType,
typename IncidentSpectrumImageType::SizeType sizeRequested = requested.GetSize();
for (unsigned int i = 0; i < IncidentSpectrumImageType::GetImageDimension() - 1; i++)
{
indexRequested[i+1] = this->GetOutput()->GetRequestedRegion().GetIndex()[i];
sizeRequested[i+1] = this->GetOutput()->GetRequestedRegion().GetSize()[i];
indexRequested[i + 1] = this->GetOutput()->GetRequestedRegion().GetIndex()[i];
sizeRequested[i + 1] = this->GetOutput()->GetRequestedRegion().GetSize()[i];
}

requested.SetIndex(indexRequested);
Expand Down Expand Up @@ -539,7 +539,8 @@ SpectralForwardModelImageFilter<DecomposedProjectionsType,
// Fill in the spectra matrix
if (this->GetInputSecondIncidentSpectrum()) // Dual energy CT
{
for (int e = 0; e < m_NumberOfEnergies; e++) {
for (int e = 0; e < m_NumberOfEnergies; e++)
{
spectra.put(0, e, spectrumIt.Get());
spectra.put(1, e, secondSpectrumIt.Get());
++spectrumIt;
Expand All @@ -548,7 +549,8 @@ SpectralForwardModelImageFilter<DecomposedProjectionsType,
}
else
{
for (int e = 0; e < m_NumberOfEnergies; e++) {
for (int e = 0; e < m_NumberOfEnergies; e++)
{
spectra.put(0, e, spectrumIt.Get());
++spectrumIt;
}
Expand Down
13 changes: 9 additions & 4 deletions test/rtkspectralonesteptest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ main(int argc, char * argv[])

// Convert the itk::VectorImage<> returned by "forward" into
// an itk::Image<itk::Vector<>>
typename CastMeasuredProjectionsFilterType::Pointer castMeasuredProjections = CastMeasuredProjectionsFilterType::New();
typename CastMeasuredProjectionsFilterType::Pointer castMeasuredProjections =
CastMeasuredProjectionsFilterType::New();
castMeasuredProjections->SetInput(forward->GetOutput());

// Read the material attenuations image as a matrix
Expand Down Expand Up @@ -331,11 +332,15 @@ main(int argc, char * argv[])
#endif

#ifdef RTK_USE_CUDA
std::cout << "\n\n****** Case 5: CUDA voxel-based Backprojector, 4 subsets, with regularization, itkVectorImage inputs ******" << std::endl;
std::cout
<< "\n\n****** Case 5: CUDA voxel-based Backprojector, 4 subsets, with regularization, itkVectorImage inputs ******"
<< std::endl;
#else
std::cout << "\n\n****** Case 4: Voxel-based Backprojector, 4 subsets, with regularization, itkVectorImage inputs ******" << std::endl;
std::cout
<< "\n\n****** Case 4: Voxel-based Backprojector, 4 subsets, with regularization, itkVectorImage inputs ******"
<< std::endl;
#endif
//Add a cast to itkVectorImage, to test the overloaded SetInputMaterialVolumes method
// Add a cast to itkVectorImage, to test the overloaded SetInputMaterialVolumes method
typename CastMaterialVolumesFilterType::Pointer castMaterials = CastMaterialVolumesFilterType::New();
castMaterials->SetInput(materialVolumeSource->GetOutput());
mechlemOneStep->SetInputMaterialVolumes(castMaterials->GetOutput());
Expand Down

0 comments on commit 27dbf24

Please sign in to comment.