Skip to content

Commit

Permalink
Merge pull request #4 from InsightSoftwareConsortium/update
Browse files Browse the repository at this point in the history
  • Loading branch information
dzenanz authored Mar 19, 2024
2 parents d429858 + 4ee8811 commit f524fcf
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 282 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html for details of each option
##
## The clang-format binaries can be downloaded as part of the clang binary distributions
## from http://releases.llvm.org/download.html
## from https://releases.llvm.org/download.html
##
## Use the script Utilities/Maintenance/clang-format.bash to faciliate
## maintaining a consistent code style.
Expand All @@ -21,7 +21,7 @@ AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
# clang 9.0 AllowAllArgumentsOnNextLine: true
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# http://EditorConfig.org
# https://EditorConfig.org

# top-most EditorConfig file
root = true
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/build-test-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Build, test, package

on: [push,pull_request]

jobs:
cxx-build-workflow:
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected]

python-build-workflow:
uses: InsightSoftwareConsortium/ITKRemoteModuleBuildTestPackageAction/.github/workflows/[email protected]
secrets:
pypi_password: ${{ secrets.pypi_password }}
3 changes: 2 additions & 1 deletion .github/workflows/clang-format-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ jobs:

steps:
- uses: actions/checkout@v1

with:
fetch-depth: 1
- uses: InsightSoftwareConsortium/ITKClangFormatLinterAction@master
124 changes: 63 additions & 61 deletions include/itkFastBilateralImageFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
* https://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -28,57 +28,56 @@
namespace itk
{
/**
* \class FastBilateralImageFilter
* \brief A fast approximation to the bilateral filter
* \ingroup FastBilateral
*
* This filter is a fast approximation to the bilateral filter.
* Blurring is performed on an image based on the distance of pixels in
* both space and intensity.
*
* The algorithm used was originally proposed by Paris and
* Durand [1].
*
* Instead of calculating a kernel for every pixel in
* an image, this filter places the values of each pixel into a higher
* dimensional image determined by the position and intensity of a pixel.
* How many bins are used is determined by the sigma values provided
* to the filter. Larger sigmas will result in more aggresive downsampling
* and less running time overall. After the data of an image
* has been organized into bins, a DiscreteGaussianImageFilter is applied.
* Finally, the output image is constructed by interpolating the
* values of the output pixels from the blurred higher
* dimensional image.
*
* [1] Sylvain Paris and Frédo Durand,
* A Fast Approximation of the Bilateral Filter using a Signal Processing
* Approach,
* European Conference on Computer Vision (ECCV'06)
*
* \sa BilateralImageFilter
* \sa GaussianOperator
* \sa AnisotropicDiffusionImageFilter
* \sa Image
* \sa Neighborhood
* \sa NeighborhoodOperator
*
* \ingroup ImageEnhancement
* \ingroup ImageFeatureExtraction
*
* \todo Support for color images
* \todo Support for vector images
*/

template <class TInputImage, class TOutputImage >
class ITK_EXPORT FastBilateralImageFilter :
public ImageToImageFilter< TInputImage, TOutputImage >
* \class FastBilateralImageFilter
* \brief A fast approximation to the bilateral filter
* \ingroup FastBilateral
*
* This filter is a fast approximation to the bilateral filter.
* Blurring is performed on an image based on the distance of pixels in
* both space and intensity.
*
* The algorithm used was originally proposed by Paris and
* Durand [1].
*
* Instead of calculating a kernel for every pixel in
* an image, this filter places the values of each pixel into a higher
* dimensional image determined by the position and intensity of a pixel.
* How many bins are used is determined by the sigma values provided
* to the filter. Larger sigmas will result in more aggresive downsampling
* and less running time overall. After the data of an image
* has been organized into bins, a DiscreteGaussianImageFilter is applied.
* Finally, the output image is constructed by interpolating the
* values of the output pixels from the blurred higher
* dimensional image.
*
* [1] Sylvain Paris and Frédo Durand,
* A Fast Approximation of the Bilateral Filter using a Signal Processing
* Approach,
* European Conference on Computer Vision (ECCV'06)
*
* \sa BilateralImageFilter
* \sa GaussianOperator
* \sa AnisotropicDiffusionImageFilter
* \sa Image
* \sa Neighborhood
* \sa NeighborhoodOperator
*
* \ingroup ImageEnhancement
* \ingroup ImageFeatureExtraction
*
* \todo Support for color images
* \todo Support for vector images
*/

template <class TInputImage, class TOutputImage>
class ITK_EXPORT FastBilateralImageFilter : public ImageToImageFilter<TInputImage, TOutputImage>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(FastBilateralImageFilter);

/** Standard class typedefs. */
using Self = FastBilateralImageFilter;
using Superclass = ImageToImageFilter< TInputImage, TOutputImage >;
using Superclass = ImageToImageFilter<TInputImage, TOutputImage>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

Expand Down Expand Up @@ -128,21 +127,21 @@ class ITK_EXPORT FastBilateralImageFilter :

/** Convenience set method for setting all domain standard deviations to the
* same value. */
void SetDomainSigma(const double v)
{
void
SetDomainSigma(const double v)
{
m_DomainSigma.Fill(v);
}
}

protected:

/** Default Constructor. Default value for DomainSigma is 4. Default
* value for RangeSigma is 50. These values were chosen match those of the
* BilateralImageFilter */
FastBilateralImageFilter()
{
{
m_DomainSigma.Fill(4.0);
m_RangeSigma = 50.0;
}
}

virtual ~FastBilateralImageFilter() {}

Expand All @@ -152,44 +151,47 @@ class ITK_EXPORT FastBilateralImageFilter :
* the BilateralImageFilter, the FastBilateralImageFilter needs
* an amount of padding in each dimension based on the domain sigma.
*/
virtual void GenerateInputRequestedRegion();
void
GenerateInputRequestedRegion() override;

/** Standard pipline method */
void GenerateData();
void
GenerateData() override;

/** Method to print member variables to an output stream */
void PrintSelf(std::ostream& os, Indent indent) const;
void
PrintSelf(std::ostream & os, Indent indent) const override;

/** The type of image to use as the higher dimensional grid.
* The blurring is performed on this image type. */
using GridType = typename itk::Image<float, itkGetStaticConstMacro(ImageDimension)+1>;
using GridType = typename itk::Image<float, itkGetStaticConstMacro(ImageDimension) + 1>;

/** Grid types */
using GridPixelType = typename GridType::PixelType;
using GridIndexType = typename GridType::IndexType;
using GridSizeType = typename GridType::SizeType;
using GridSizeValueType = typename Size<itkGetStaticConstMacro(ImageDimension)+1>::SizeValueType;
using GridSizeValueType = typename Size<itkGetStaticConstMacro(ImageDimension) + 1>::SizeValueType;
using GridRegionType = typename GridType::RegionType;

/** Grid image iterator type. */
using GridImageIteratorType = ImageRegionIterator<GridType>;
using GridImageConstIteratorType = ImageRegionConstIterator<GridType>;

/** The type of blurring to use on the grid. */
using BlurType = DiscreteGaussianImageFilter< GridType, GridType >;
using BlurType = DiscreteGaussianImageFilter<GridType, GridType>;

/** The type of interpolation done to calculate output pixels. */
using InterpolatorType = LinearInterpolateImageFunction<GridType, float>;
using InterpolatedIndexType = typename InterpolatorType::ContinuousIndexType;

double m_RangeSigma;
DomainSigmaArrayType m_DomainSigma;
double m_RangeSigma;
DomainSigmaArrayType m_DomainSigma;
};

} // namespace itk

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

#endif // itkFastBilateralImageFilter
Loading

0 comments on commit f524fcf

Please sign in to comment.