Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <rtkThreeDCircularProjectionGeometryXMLFile.h>

#include "pctProtonPairsToBackProjection.h"
#include "SmallHoleFiller.h"
#include "pctHoleFillingImageFilter.h"

#include <itkImageFileReader.h>
#include <itkImageFileWriter.h>
Expand Down Expand Up @@ -124,17 +124,16 @@ main(int argc, char * argv[])

TRY_AND_EXIT_ON_ITK_EXCEPTION(projection->Update());

SmallHoleFiller<OutputImageType> filler;
auto holeFilter = pct::HoleFillingImageFilter<OutputImageType>::New();
if (args_info.fill_flag)
{
filler.SetImage(projection->GetOutput());
filler.SetHolePixel(0.);
filler.Fill();
holeFilter->SetInput(projection->GetOutput());
TRY_AND_EXIT_ON_ITK_EXCEPTION(holeFilter->Update());
}

auto cii = itk::ChangeInformationImageFilter<OutputImageType>::New();
if (args_info.fill_flag)
cii->SetInput(filler.GetOutput());
cii->SetInput(holeFilter->GetOutput());
else
cii->SetInput(projection->GetOutput());
cii->ChangeOriginOn();
Expand Down
11 changes: 5 additions & 6 deletions applications/pctbinning/pctbinning.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <rtkConstantImageSource.h>

#include "pctProtonPairsToDistanceDrivenProjection.h"
#include "SmallHoleFiller.h"
#include "pctHoleFillingImageFilter.h"

#include <itkImageFileWriter.h>
#include <itkRegularExpressionSeriesFileNames.h>
Expand Down Expand Up @@ -87,17 +87,16 @@ main(int argc, char * argv[])

TRY_AND_EXIT_ON_ITK_EXCEPTION(projection->Update());

SmallHoleFiller<OutputImageType> filler;
auto holeFilter = pct::HoleFillingImageFilter<OutputImageType>::New();
if (args_info.fill_flag)
{
filler.SetImage(projection->GetOutput());
filler.SetHolePixel(0.);
filler.Fill();
holeFilter->SetInput(projection->GetOutput());
TRY_AND_EXIT_ON_ITK_EXCEPTION(holeFilter->Update());
}

auto cii = itk::ChangeInformationImageFilter<OutputImageType>::New();
if (args_info.fill_flag)
cii->SetInput(filler.GetOutput());
cii->SetInput(holeFilter->GetOutput());
else
cii->SetInput(projection->GetOutput());
cii->ChangeOriginOn();
Expand Down
54 changes: 0 additions & 54 deletions include/SmallHoleFiller.h

This file was deleted.

172 changes: 0 additions & 172 deletions include/SmallHoleFiller.hxx

This file was deleted.

63 changes: 63 additions & 0 deletions include/pctHoleFillingImageFilter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef __pctHoleFillingImageFilter_h
#define __pctHoleFillingImageFilter_h

#include <itkImageToImageFilter.h>
#include <itkSmartPointer.h>
#include <itkNumericTraits.h>

namespace pct
{
/**
*
* A simple iterative hole filling filter. A pixel equal to the HolePixel is
* considered a hole. On each iteration, every hole pixel is replaced by the
* average of its non-hole neighbors in a radius=1 neighborhood (center
* excluded). Iterations repeat until no hole pixels remain or MaxIterations
* is reached or an iteration makes no progress.
*
* This filter reproduces the behavior of the project's SmallHoleFiller
* helper. For the original reference see:
* https://www.insight-journal.org/browse/publication/835/
*/

template <typename TInputImage, typename TOutputImage = TInputImage>
class HoleFillingImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
{
public:
using Self = HoleFillingImageFilter;
using Superclass = itk::ImageToImageFilter<TInputImage, TOutputImage>;
using Pointer = itk::SmartPointer<Self>;
using ConstPointer = itk::SmartPointer<const Self>;

itkNewMacro(Self);
itkTypeMacro(HoleFillingImageFilter, ImageToImageFilter);

using InputImageType = TInputImage;
using OutputImageType = TOutputImage;
using PixelType = typename OutputImageType::PixelType;

itkSetMacro(HolePixelValue, PixelType);
itkGetConstMacro(HolePixelValue, PixelType);
itkSetMacro(MaximumNumberOfIterations, unsigned int);
itkGetConstMacro(MaximumNumberOfIterations, unsigned int);

protected:
HoleFillingImageFilter() = default;
~HoleFillingImageFilter() override = default;

void
GenerateData() override;

private:
ITK_DISALLOW_COPY_AND_MOVE(HoleFillingImageFilter);
PixelType m_HolePixelValue = itk::NumericTraits<PixelType>::Zero;
unsigned int m_MaximumNumberOfIterations = 20;
};

} // namespace pct

#ifndef ITK_MANUAL_INSTANTIATION
# include "pctHoleFillingImageFilter.hxx"
#endif

#endif
Loading
Loading