Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4cb8ad2
Initial Commit
sudomakeinstall Oct 27, 2016
7b15718
BUG: Remove ITK prefix to distinguish from native modules.
sudomakeinstall Oct 27, 2016
d7a300c
Add link to Insight Journal submission.
sudomakeinstall Nov 25, 2016
777e893
ENH: Require cmake minimum version to be 3.9.5.
Jan 19, 2018
6daddd2
ENH: Initial ITKv5 conversions.
hjmjohnson Dec 16, 2017
e27c4f1
ENH: ITKv5 override consistency
hjmjohnson Dec 17, 2017
61ebf2f
COMP: Use C++11 override directly
hjmjohnson Dec 17, 2017
efec31e
STYLE: Prefer C++11 type alias over typedef
hjmjohnson Feb 13, 2018
b3fb749
STYLE: Prefer constexpr for const numeric literals
hjmjohnson Feb 13, 2018
629eb43
COMP: Move ITK_DISALLOW_COPY_AND_ASSIGN calls to public section.
Apr 14, 2018
ab42b4e
COMP: Set the minimum required CMake version to 3.10.2.
May 5, 2018
f2027ed
ENH: Add CI.
jhlegarreta Oct 17, 2018
752d4a2
STYLE: Add a newline at the end of files.
jhlegarreta Nov 14, 2018
6a8957f
DOC: Follow repository naming convention.
jhlegarreta Nov 24, 2018
60a2843
BUG: Fix wrapping modules names.
jhlegarreta Nov 24, 2018
28950d6
BUG: Fix wrapping.
jhlegarreta Nov 24, 2018
142718b
ENH: Add .gitattributes to allow running ITK clang-formatting scripts
hjmjohnson Feb 20, 2020
c6886c0
STYLE: Prefer = default to explicitly trivial implementations
hjmjohnson Feb 17, 2020
f09f785
STYLE: Remove redundant void argument lists
hjmjohnson Feb 17, 2020
5202d72
DOC: Update copyright assignment to NumFOCUS
hjmjohnson Feb 19, 2020
721e2fa
STYLE: Add ITK prefix to testing macros
jhlegarreta Jun 15, 2019
0026e12
STYLE: Apply Clang Format
sudomakeinstall May 21, 2020
ada7f09
COMP: Fix Wrapping Errors
sudomakeinstall May 20, 2020
8c2e287
STYLE: Rename ITK_DISALLOW_COPY_AND_ASSIGN to ITK_DISALLOW_COPY_AND_MOVE
mseng10 Oct 16, 2020
5e9ada5
COMP: Remove inclusion of .hxx files as headers
hjmjohnson Dec 17, 2021
14b714f
ENH: Bump ITK and replace http with https using script
tbirdso May 31, 2022
3f4e086
STYLE: Add itkVirtualGetNameOfClassMacro + itkOverrideGetNameOfClassM…
hjmjohnson Jan 26, 2025
865ed89
STYLE: CoordRepType -> CoordinateType code readability
hjmjohnson Jan 26, 2025
6be0f65
COMP: Match scale setting from vector
hjmjohnson Jan 26, 2025
d2993d5
STYLE: Update to match clang-format-19 from ITK
hjmjohnson Jan 27, 2025
dec0a29
ENH: Update to newer minimum cmake versions
hjmjohnson Mar 16, 2025
6a5cc6b
ENH: Update minimum cmake version to 3.16.3
hjmjohnson Mar 16, 2025
5c4678a
ENH: Add EXCLUDE_FROM_DEFAULT to MeshNoise module
blowekamp Feb 3, 2026
9e4b2ae
COMP: Drop standalone-build boilerplate from MeshNoise
hjmjohnson Apr 28, 2026
0aeb200
COMP: Drop missing README.rst read in ingested MeshNoise
hjmjohnson Apr 28, 2026
fbbb93e
BUG: Fix MeshNoise test compile error (issue #5174)
hjmjohnson Apr 28, 2026
ef8f3ab
COMP: Remove MeshNoise.remote.cmake; now in-tree
hjmjohnson Apr 28, 2026
be38f78
ENH: Enable MeshNoise in CI via configure-ci
hjmjohnson Apr 28, 2026
5c37bff
STYLE: Apply gersemi to ingested MeshNoise CMake files
hjmjohnson Apr 28, 2026
dfb04eb
COMP: Normalize exec bit on ingested test/CMakeLists.txt
hjmjohnson Apr 28, 2026
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
1 change: 1 addition & 0 deletions Modules/Filtering/MeshNoise/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
itk_module_impl()
19 changes: 19 additions & 0 deletions Modules/Filtering/MeshNoise/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# MeshNoise

In-tree ITK module providing additive-noise filters for `itk::Mesh`
and `itk::QuadEdgeMesh` point coordinates. The flagship class is
`itk::AdditiveGaussianNoiseMeshFilter`, which perturbs every mesh
point by an independent Gaussian-distributed offset with
configurable mean and standard deviation. Useful for testing
mesh-based registration, surface reconstruction, and shape-analysis
pipelines under controlled perturbation.

## Origin

Ingested from the standalone remote module
[**InsightSoftwareConsortium/ITKMeshNoise**](https://github.com/InsightSoftwareConsortium/ITKMeshNoise)
on 2026-04-28. The upstream repository will be archived read-only
after this PR merges; it remains reachable at the URL above.

This ingest also resolves the long-open compile error reported in
[InsightSoftwareConsortium/ITK#5174](https://github.com/InsightSoftwareConsortium/ITK/issues/5174).
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkAdditiveGaussianNoiseMeshFilter_h
#define itkAdditiveGaussianNoiseMeshFilter_h

#include <itkMeshToMeshFilter.h>

namespace itk
{
/** \class AdditiveGaussianNoiseMeshFilter
* \brief Add Gaussian noise to the points defining an itkMesh.
*
* \author Davis Vigneault
*
* This class adds Gaussian noise with a specified mean and standard
* deviation to the coordinates of the points defining an itkMesh.
* Mesh topology and other data is passed unaltered. This may be
* useful in testing the robustness of an algorithm to small changes
* in the input mesh, augmenting datasets for machine learning, and
* counteracting deleterious effects which highly regular regions
* of a mesh may occassionally have on mesh processing.
*
* \ingroup MeshNoise
*/
template <typename TInput, typename TOutput = TInput>
class AdditiveGaussianNoiseMeshFilter : public MeshToMeshFilter<TInput, TOutput>
{

public:
ITK_DISALLOW_COPY_AND_MOVE(AdditiveGaussianNoiseMeshFilter);

/** Standard class type alias. */
using Self = AdditiveGaussianNoiseMeshFilter;
using Superclass = MeshToMeshFilter<TInput, TOutput>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

using InputMeshType = TInput;
using OutputMeshType = TOutput;
using InputMeshPointer = typename InputMeshType::Pointer;
using OutputMeshPointer = typename OutputMeshType::Pointer;

/** Type for representing coordinates. */
using CoordinateType = typename TInput::CoordinateType;

/** Method for creation through the object factory. */
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkOverrideGetNameOfClassMacro(AdditiveGaussianNoiseMeshFilter);

/** Mean of noise. */
itkGetConstMacro(Mean, CoordinateType);
itkSetMacro(Mean, CoordinateType);

/** Variance of noise. */
itkGetConstMacro(Sigma, CoordinateType);
itkSetMacro(Sigma, CoordinateType);

/** Initialization seed. */
itkGetConstMacro(Seed, int);
itkSetMacro(Seed, int);

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

void
PrintSelf(std::ostream & os, Indent indent) const override;

/** Generate Requested Data */
void
GenerateData() override;

CoordinateType m_Mean;
CoordinateType m_Sigma;
int m_Seed;
};

} // namespace itk

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

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkAdditiveGaussianNoiseMeshFilter_hxx
#define itkAdditiveGaussianNoiseMeshFilter_hxx

#include "itkNormalVariateGenerator.h"

namespace itk
{

template <typename TInputMesh, typename TOutputMesh>
AdditiveGaussianNoiseMeshFilter<TInputMesh, TOutputMesh>::AdditiveGaussianNoiseMeshFilter()
{
this->m_Mean = 0.0;
this->m_Sigma = 1.0;
this->m_Seed = 0;
}

template <typename TInputMesh, typename TOutputMesh>
void
AdditiveGaussianNoiseMeshFilter<TInputMesh, TOutputMesh>::PrintSelf(std::ostream & os, Indent indent) const
{
Superclass::PrintSelf(os, indent);
os << indent << "Mean: " << this->m_Mean << std::endl;
os << indent << "Sigma: " << this->m_Sigma << std::endl;
}

template <typename TInputMesh, typename TOutputMesh>
void
AdditiveGaussianNoiseMeshFilter<TInputMesh, TOutputMesh>::GenerateData()
Comment thread
greptile-apps[bot] marked this conversation as resolved.
{
using InputPointsContainer = typename TInputMesh::PointsContainer;
using OutputPointsContainer = typename TOutputMesh::PointsContainer;

using InputPointsContainerConstPointer = typename TInputMesh::PointsContainerConstPointer;
using OutputPointsContainerPointer = typename TOutputMesh::PointsContainerPointer;

const InputMeshType * inputMesh = this->GetInput();
OutputMeshPointer outputMesh = this->GetOutput();

if (!inputMesh)
{
itkExceptionMacro(<< "Missing Input Mesh");
}

if (!outputMesh)
{
itkExceptionMacro(<< "Missing Output Mesh");
}

outputMesh->SetBufferedRegion(outputMesh->GetRequestedRegion());

InputPointsContainerConstPointer inPoints = inputMesh->GetPoints();
OutputPointsContainerPointer outPoints = outputMesh->GetPoints();

outPoints->Reserve(inputMesh->GetNumberOfPoints());
outPoints->Squeeze();

typename InputPointsContainer::ConstIterator inputPoint = inPoints->Begin();
typename OutputPointsContainer::Iterator outputPoint = outPoints->Begin();

unsigned int maxDimension = TInputMesh::MaxTopologicalDimension;
Comment thread
greptile-apps[bot] marked this conversation as resolved.

using GeneratorType = itk::Statistics::NormalVariateGenerator;
GeneratorType::Pointer generator = GeneratorType::New();
generator->Initialize(this->m_Seed);

while (inputPoint != inPoints->End())
{
for (unsigned int dim = 0; dim < maxDimension; ++dim)
{
outputPoint.Value()[dim] = inputPoint.Value()[dim] + generator->GetVariate() * this->m_Sigma + this->m_Mean;
}
++inputPoint;
++outputPoint;
}

// Create duplicate references to the rest of data on the mesh
this->CopyInputMeshToOutputMeshPointData();
this->CopyInputMeshToOutputMeshCellLinks();
this->CopyInputMeshToOutputMeshCells();
this->CopyInputMeshToOutputMeshCellData();

for (unsigned int dim = 0; dim < maxDimension; ++dim)
{
outputMesh->SetBoundaryAssignments(dim, inputMesh->GetBoundaryAssignments(dim));
}
}

} // namespace itk

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkAdditiveGaussianNoiseQuadEdgeMeshFilter_h
#define itkAdditiveGaussianNoiseQuadEdgeMeshFilter_h

#include "itkQuadEdgeMeshToQuadEdgeMeshFilter.h"

namespace itk
{
/** \class AdditiveGaussianNoiseQuadEdgeMeshFilter
* \brief Add Gaussian noise to the points defining an itkQuadEdgeMesh.
*
* \author Davis Vigneault
*
* This class adds Gaussian noise with a specified mean and standard
* deviation to the coordinates of the points defining an itkMesh.
* Mesh topology and other data is passed unaltered. This may be
* useful in testing the robustness of an algorithm to small changes
* in the input mesh, augmenting datasets for machine learning, and
* counteracting deleterious effects which highly regular regions
* of a mesh may occassionally have on mesh processing.
*
* \ingroup MeshNoise
*/
template <typename TInputMesh, typename TOutputMesh = TInputMesh>
class AdditiveGaussianNoiseQuadEdgeMeshFilter : public QuadEdgeMeshToQuadEdgeMeshFilter<TInputMesh, TOutputMesh>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(AdditiveGaussianNoiseQuadEdgeMeshFilter);

/** Standard class type alias. */
using Self = AdditiveGaussianNoiseQuadEdgeMeshFilter;
using Superclass = QuadEdgeMeshToQuadEdgeMeshFilter<TInputMesh, TOutputMesh>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;

/** Type for representing coordinates. */
using CoordinateType = typename TInputMesh::CoordinateType;

/** Method for creation through the object factory. */
itkNewMacro(Self);

/** Run-time type information (and related methods). */
itkOverrideGetNameOfClassMacro(AdditiveGaussianNoiseQuadEdgeMeshFilter);

/** Mean of noise. */
itkGetConstMacro(Mean, CoordinateType);
itkSetMacro(Mean, CoordinateType);

/** Variance of noise. */
itkGetConstMacro(Sigma, CoordinateType);
itkSetMacro(Sigma, CoordinateType);

/** Initialization seed. */
itkGetConstMacro(Seed, int);
itkSetMacro(Seed, int);

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

void
PrintSelf(std::ostream & os, Indent indent) const override;

/** Generate Requested Data */
void
GenerateData() override;

CoordinateType m_Mean;
CoordinateType m_Sigma;
int m_Seed;
};

} // end namespace itk

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

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkAdditiveGaussianNoiseQuadEdgeMeshFilter_hxx
#define itkAdditiveGaussianNoiseQuadEdgeMeshFilter_hxx

#include "itkNormalVariateGenerator.h"

namespace itk
{

template <typename TInputMesh, typename TOutputMesh>
AdditiveGaussianNoiseQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::AdditiveGaussianNoiseQuadEdgeMeshFilter()
{
this->m_Mean = 0.0;
this->m_Sigma = 1.0;
this->m_Seed = 0;
}

template <typename TInputMesh, typename TOutputMesh>
void
AdditiveGaussianNoiseQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::PrintSelf(std::ostream & os, Indent indent) const
{
Superclass::PrintSelf(os, indent);
os << indent << "Mean: " << this->m_Mean << std::endl;
os << indent << "Sigma: " << this->m_Sigma << std::endl;
}

template <typename TInputMesh, typename TOutputMesh>
void
AdditiveGaussianNoiseQuadEdgeMeshFilter<TInputMesh, TOutputMesh>::GenerateData()
{
typename TInputMesh::ConstPointer inputMesh = this->GetInput();
typename TOutputMesh::Pointer outputMesh = this->GetOutput();

this->CopyInputMeshToOutputMesh();

typename TOutputMesh::PointsContainer::Iterator it = outputMesh->GetPoints()->Begin();

using GeneratorType = itk::Statistics::NormalVariateGenerator;
GeneratorType::Pointer generator = GeneratorType::New();
generator->Initialize(this->m_Seed);

while (it != outputMesh->GetPoints()->End())
{
for (unsigned int d = 0; d < TOutputMesh::MeshTraits::PointDimension; ++d)
{
it.Value()[d] += (generator->GetVariate() * this->m_Sigma + this->m_Mean);
}
++it;
}
}
} // end namespace itk

#endif
Loading
Loading