Skip to content

Commit c6863ea

Browse files
committed
chore: Update clang-format to match ITK 2025-11-10
1 parent 301e4bd commit c6863ea

39 files changed

Lines changed: 860 additions & 832 deletions

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ StatementMacros:
297297
- ITK_CLANG_PRAGMA_PUSH
298298
- ITK_CLANG_PRAGMA_POP
299299
- ITK_CLANG_SUPPRESS_Wzero_as_null_pointer_constant
300+
- ITK_CLANG_SUPPRESS_Wduplicate_enum
300301
- CLANG_PRAGMA_PUSH
301302
- CLANG_PRAGMA_POP
302303
- CLANG_SUPPRESS_Wfloat_equal

examples/hello-world/hello.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
#include "itkPipeline.h"
44

5-
int main(int argc, char* argv[]) {
5+
int
6+
main(int argc, char * argv[])
7+
{
68
itk::wasm::Pipeline pipeline("hello-world", "Hello world example", argc, argv);
79

810
std::cout << "Hello Wasm world!" << std::endl;

include/itkInputTextStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace wasm
3434
*
3535
* \ingroup WebAssemblyInterface
3636
*/
37-
class InputTextStream: public InputStreamBase
37+
class InputTextStream : public InputStreamBase
3838
{
3939
public:
4040
void

include/itkMeshJSON.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,10 @@ meshToMeshJSON(const TMesh * mesh, const WasmMesh<TMesh> * wasmMesh, bool inMemo
178178
}
179179

180180
template <typename TPixel, unsigned int VDimension>
181-
auto meshToMeshJSON(const QuadEdgeMesh<TPixel, VDimension> * mesh, const WasmMesh<QuadEdgeMesh<TPixel, VDimension>> * wasmMesh, bool inMemory) -> MeshJSON
181+
auto
182+
meshToMeshJSON(const QuadEdgeMesh<TPixel, VDimension> * mesh,
183+
const WasmMesh<QuadEdgeMesh<TPixel, VDimension>> * wasmMesh,
184+
bool inMemory) -> MeshJSON
182185
{
183186
using MeshType = QuadEdgeMesh<TPixel, VDimension>;
184187

@@ -189,13 +192,15 @@ auto meshToMeshJSON(const QuadEdgeMesh<TPixel, VDimension> * mesh, const WasmMes
189192
meshJSON.meshType.pointComponentType = wasm::MapComponentType<typename MeshType::CoordRepType>::JSONFloatTypeEnum;
190193
using PointPixelType = typename MeshType::PixelType;
191194
using ConvertPointPixelTraits = MeshConvertPixelTraits<PointPixelType>;
192-
meshJSON.meshType.pointPixelComponentType = wasm::MapComponentType<typename ConvertPointPixelTraits::ComponentType>::JSONComponentEnum;
195+
meshJSON.meshType.pointPixelComponentType =
196+
wasm::MapComponentType<typename ConvertPointPixelTraits::ComponentType>::JSONComponentEnum;
193197
meshJSON.meshType.pointPixelType = wasm::MapPixelType<PointPixelType>::JSONPixelEnum;
194198
meshJSON.meshType.pointPixelComponents = ConvertPointPixelTraits::GetNumberOfComponents();
195199
meshJSON.meshType.cellComponentType = wasm::MapComponentType<typename MeshType::CellIdentifier>::JSONIntTypeEnum;
196200
using CellPixelType = typename MeshType::CellPixelType;
197201
using ConvertCellPixelTraits = MeshConvertPixelTraits<CellPixelType>;
198-
meshJSON.meshType.cellPixelComponentType = wasm::MapComponentType<typename ConvertPointPixelTraits::ComponentType>::JSONComponentEnum;
202+
meshJSON.meshType.cellPixelComponentType =
203+
wasm::MapComponentType<typename ConvertPointPixelTraits::ComponentType>::JSONComponentEnum;
199204
meshJSON.meshType.cellPixelType = wasm::MapPixelType<CellPixelType>::JSONPixelEnum;
200205
meshJSON.meshType.cellPixelComponents = ConvertCellPixelTraits::GetNumberOfComponents();
201206

@@ -222,15 +227,15 @@ auto meshToMeshJSON(const QuadEdgeMesh<TPixel, VDimension> * mesh, const WasmMes
222227
{
223228
meshJSON.cellBufferSize = wasmMesh->GetCellBuffer()->Size();
224229

225-
const auto pointsAddress = reinterpret_cast< size_t >( &(wasmMesh->GetPointsBuffer().at(0)) );
230+
const auto pointsAddress = reinterpret_cast<size_t>(&(wasmMesh->GetPointsBuffer().at(0)));
226231
std::ostringstream pointsStream;
227232
pointsStream << "data:application/vnd.itk.address,0:";
228233
pointsStream << pointsAddress;
229234
meshJSON.points = pointsStream.str();
230235
size_t cellsAddress = 0;
231236
if (mesh->GetNumberOfCells() > 0)
232237
{
233-
cellsAddress = reinterpret_cast< size_t >( &(wasmMesh->GetCellBuffer()->at(0)) );
238+
cellsAddress = reinterpret_cast<size_t>(&(wasmMesh->GetCellBuffer()->at(0)));
234239
}
235240
std::ostringstream cellsStream;
236241
cellsStream << "data:application/vnd.itk.address,0:";
@@ -240,7 +245,7 @@ auto meshToMeshJSON(const QuadEdgeMesh<TPixel, VDimension> * mesh, const WasmMes
240245
size_t pointDataAddress = 0;
241246
if (mesh->GetPointData() != nullptr && mesh->GetPointData()->Size() > 0)
242247
{
243-
pointDataAddress = reinterpret_cast< size_t >( &(wasmMesh->GetPointDataBuffer().at(0)) );
248+
pointDataAddress = reinterpret_cast<size_t>(&(wasmMesh->GetPointDataBuffer().at(0)));
244249
}
245250
std::ostringstream pointDataStream;
246251
pointDataStream << "data:application/vnd.itk.address,0:";
@@ -250,10 +255,10 @@ auto meshToMeshJSON(const QuadEdgeMesh<TPixel, VDimension> * mesh, const WasmMes
250255
size_t cellDataAddress = 0;
251256
if (mesh->GetCellData() != nullptr && mesh->GetCellData()->Size() > 0)
252257
{
253-
cellDataAddress = reinterpret_cast< size_t >( &(wasmMesh->GetCellDataBuffer().at(0)) );
258+
cellDataAddress = reinterpret_cast<size_t>(&(wasmMesh->GetCellDataBuffer().at(0)));
254259
}
255260
std::ostringstream cellDataStream;
256-
cellDataStream << "data:application/vnd.itk.address,0:";
261+
cellDataStream << "data:application/vnd.itk.address,0:";
257262
cellDataStream << cellDataAddress;
258263
meshJSON.cellData = cellDataStream.str();
259264
}

include/itkMeshToWasmMeshFilter.hxx

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ MeshToWasmMeshFilter<TMesh>::PrintSelf(std::ostream & os, Indent indent) const
137137
}
138138

139139
template <typename TPixel, unsigned int VDimension>
140-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
141-
::MeshToWasmMeshFilter()
140+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::MeshToWasmMeshFilter()
142141
{
143142
this->SetNumberOfRequiredInputs(1);
144143

@@ -149,42 +148,37 @@ MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
149148

150149
template <typename TPixel, unsigned int VDimension>
151150
ProcessObject::DataObjectPointer
152-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
153-
::MakeOutput(ProcessObject::DataObjectPointerArraySizeType)
151+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::MakeOutput(ProcessObject::DataObjectPointerArraySizeType)
154152
{
155153
return WasmMeshType::New().GetPointer();
156154
}
157155

158156
template <typename TPixel, unsigned int VDimension>
159157
ProcessObject::DataObjectPointer
160-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
161-
::MakeOutput(const ProcessObject::DataObjectIdentifierType &)
158+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::MakeOutput(const ProcessObject::DataObjectIdentifierType &)
162159
{
163160
return WasmMeshType::New().GetPointer();
164161
}
165162

166163
template <typename TPixel, unsigned int VDimension>
167164
auto
168-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
169-
::GetOutput() -> WasmMeshType *
165+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::GetOutput() -> WasmMeshType *
170166
{
171167
// we assume that the first output is of the templated type
172168
return itkDynamicCastInDebugMode<WasmMeshType *>(this->GetPrimaryOutput());
173169
}
174170

175171
template <typename TPixel, unsigned int VDimension>
176172
auto
177-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
178-
::GetOutput() const -> const WasmMeshType *
173+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::GetOutput() const -> const WasmMeshType *
179174
{
180175
// we assume that the first output is of the templated type
181176
return itkDynamicCastInDebugMode<const WasmMeshType *>(this->GetPrimaryOutput());
182177
}
183178

184179
template <typename TPixel, unsigned int VDimension>
185180
auto
186-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
187-
::GetOutput(unsigned int idx) -> WasmMeshType *
181+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::GetOutput(unsigned int idx) -> WasmMeshType *
188182
{
189183
auto * out = dynamic_cast<WasmMeshType *>(this->ProcessObject::GetOutput(idx));
190184

@@ -197,52 +191,47 @@ MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
197191

198192
template <typename TPixel, unsigned int VDimension>
199193
void
200-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
201-
::SetInput(const MeshType * input)
194+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::SetInput(const MeshType * input)
202195
{
203196
// Process object is not const-correct so the const_cast is required here
204197
this->ProcessObject::SetNthInput(0, const_cast<MeshType *>(input));
205198
}
206199

207200
template <typename TPixel, unsigned int VDimension>
208201
void
209-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
210-
::SetInput(unsigned int index, const MeshType * mesh)
202+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::SetInput(unsigned int index, const MeshType * mesh)
211203
{
212204
// Process object is not const-correct so the const_cast is required here
213205
this->ProcessObject::SetNthInput(index, const_cast<MeshType *>(mesh));
214206
}
215207

216208
template <typename TPixel, unsigned int VDimension>
217209
const typename MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::MeshType *
218-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
219-
::GetInput()
210+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::GetInput()
220211
{
221212
return itkDynamicCastInDebugMode<const MeshType *>(this->GetPrimaryInput());
222213
}
223214

224215
template <typename TPixel, unsigned int VDimension>
225216
const typename MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::MeshType *
226-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
227-
::GetInput(unsigned int idx)
217+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::GetInput(unsigned int idx)
228218
{
229219
return itkDynamicCastInDebugMode<const MeshType *>(this->ProcessObject::GetInput(idx));
230220
}
231221

232222
template <typename TPixel, unsigned int VDimension>
233223
void
234-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
235-
::GenerateData()
224+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::GenerateData()
236225
{
237226
// Get the input and output pointers
238227
const MeshType * mesh = this->GetInput();
239-
WasmMeshType * wasmMesh = this->GetOutput();
228+
WasmMeshType * wasmMesh = this->GetOutput();
240229

241230
wasmMesh->SetMesh(mesh);
242231
constexpr bool inMemory = true;
243-
const auto meshJSON = meshToMeshJSON<TPixel, VDimension>(mesh, wasmMesh, inMemory);
244-
std::string serialized{};
245-
auto ec = glz::write<glz::opts{ .prettify = true }>(meshJSON, serialized);
232+
const auto meshJSON = meshToMeshJSON<TPixel, VDimension>(mesh, wasmMesh, inMemory);
233+
std::string serialized{};
234+
auto ec = glz::write<glz::opts{ .prettify = true }>(meshJSON, serialized);
246235
if (ec)
247236
{
248237
itkExceptionMacro("Failed to serialize MeshJSON");
@@ -253,8 +242,7 @@ MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
253242

254243
template <typename TPixel, unsigned int VDimension>
255244
void
256-
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>
257-
::PrintSelf(std::ostream & os, Indent indent) const
245+
MeshToWasmMeshFilter<QuadEdgeMesh<TPixel, VDimension>>::PrintSelf(std::ostream & os, Indent indent) const
258246
{
259247
Superclass::PrintSelf(os, indent);
260248
}

include/itkOutputBinaryStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace wasm
3434
*
3535
* \ingroup WebAssemblyInterface
3636
*/
37-
class OutputBinaryStream: public OutputStreamBase
37+
class OutputBinaryStream : public OutputStreamBase
3838
{
3939
public:
4040
void

include/itkOutputMesh.h

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -166,49 +166,56 @@ class OutputMesh<itk::QuadEdgeMesh<TPixel, VDimension>>
166166
public:
167167
using MeshType = itk::QuadEdgeMesh<TPixel, VDimension>;
168168

169-
void Set(const MeshType * mesh) {
169+
void
170+
Set(const MeshType * mesh)
171+
{
170172
this->m_Mesh = mesh;
171173
}
172174

173-
const MeshType * Get() const {
175+
const MeshType *
176+
Get() const
177+
{
174178
return this->m_Mesh.GetPointer();
175179
}
176180

177181
/** FileName or output index. */
178-
void SetIdentifier(const std::string & identifier)
182+
void
183+
SetIdentifier(const std::string & identifier)
179184
{
180185
this->m_Identifier = identifier;
181186
}
182-
const std::string & GetIdentifier() const
187+
const std::string &
188+
GetIdentifier() const
183189
{
184190
return this->m_Identifier;
185191
}
186192

187193
OutputMesh() = default;
188-
~OutputMesh() {
189-
if(wasm::Pipeline::get_use_memory_io())
194+
~OutputMesh()
195+
{
196+
if (wasm::Pipeline::get_use_memory_io())
190197
{
191198
#ifndef ITK_WASM_NO_MEMORY_IO
192-
if (!this->m_Mesh.IsNull() && !this->m_Identifier.empty())
199+
if (!this->m_Mesh.IsNull() && !this->m_Identifier.empty())
193200
{
194201
using MeshToWasmMeshFilterType = MeshToWasmMeshFilter<MeshType>;
195202
auto meshToWasmMeshFilter = MeshToWasmMeshFilterType::New();
196203
meshToWasmMeshFilter->SetInput(this->m_Mesh);
197204
meshToWasmMeshFilter->Update();
198-
auto wasmMesh = meshToWasmMeshFilter->GetOutput();
205+
auto wasmMesh = meshToWasmMeshFilter->GetOutput();
199206
const auto index = std::stoi(this->m_Identifier);
200207
setMemoryStoreOutputDataObject(0, index, wasmMesh);
201208

202209
if (this->m_Mesh->GetNumberOfPoints() > 0)
203210
{
204-
const auto pointsAddress = reinterpret_cast< size_t >( &(wasmMesh->GetPointsBuffer().at(0)) );
211+
const auto pointsAddress = reinterpret_cast<size_t>(&(wasmMesh->GetPointsBuffer().at(0)));
205212
const auto pointsSize = wasmMesh->GetPointsBuffer().size() * sizeof(typename MeshType::PointIdentifier);
206213
setMemoryStoreOutputArray(0, index, 0, pointsAddress, pointsSize);
207214
}
208215

209216
if (this->m_Mesh->GetNumberOfCells() > 0)
210217
{
211-
const auto cellsAddress = reinterpret_cast< size_t >( &(wasmMesh->GetCellBuffer()->at(0)) );
218+
const auto cellsAddress = reinterpret_cast<size_t>(&(wasmMesh->GetCellBuffer()->at(0)));
212219
const auto cellsSize = wasmMesh->GetCellBuffer()->Size() * sizeof(typename MeshType::CellIdentifier);
213220
setMemoryStoreOutputArray(0, index, 1, cellsAddress, cellsSize);
214221
}
@@ -217,42 +224,45 @@ class OutputMesh<itk::QuadEdgeMesh<TPixel, VDimension>>
217224
{
218225
using PointPixelType = typename MeshType::PixelType;
219226
using ConvertPointPixelTraits = MeshConvertPixelTraits<PointPixelType>;
220-
const auto pointDataAddress = reinterpret_cast< size_t >( &(wasmMesh->GetPointDataBuffer().at(0)) );
221-
const auto pointDataSize = wasmMesh->GetPointDataBuffer().size() * sizeof(typename ConvertPointPixelTraits::ComponentType);
227+
const auto pointDataAddress = reinterpret_cast<size_t>(&(wasmMesh->GetPointDataBuffer().at(0)));
228+
const auto pointDataSize =
229+
wasmMesh->GetPointDataBuffer().size() * sizeof(typename ConvertPointPixelTraits::ComponentType);
222230
setMemoryStoreOutputArray(0, index, 2, pointDataAddress, pointDataSize);
223231
}
224232

225233
if (this->m_Mesh->GetCellData() != nullptr && this->m_Mesh->GetCellData()->Size() > 0)
226234
{
227235
using CellPixelType = typename MeshType::CellPixelType;
228236
using ConvertCellPixelTraits = MeshConvertPixelTraits<CellPixelType>;
229-
const auto cellDataAddress = reinterpret_cast< size_t >( &(wasmMesh->GetCellDataBuffer().at(0)) );
230-
const auto cellDataSize = wasmMesh->GetCellDataBuffer().size() * sizeof(typename ConvertCellPixelTraits::ComponentType);
237+
const auto cellDataAddress = reinterpret_cast<size_t>(&(wasmMesh->GetCellDataBuffer().at(0)));
238+
const auto cellDataSize =
239+
wasmMesh->GetCellDataBuffer().size() * sizeof(typename ConvertCellPixelTraits::ComponentType);
231240
setMemoryStoreOutputArray(0, index, 3, cellDataAddress, cellDataSize);
232241
}
233242
}
234243
#else
235-
std::cerr << "Memory IO not supported" << std::endl;
236-
abort();
244+
std::cerr << "Memory IO not supported" << std::endl;
245+
abort();
237246
#endif
238247
}
239248
else
240249
{
241250
#ifndef ITK_WASM_NO_FILESYSTEM_IO
242-
if (!this->m_Mesh.IsNull() && !this->m_Identifier.empty())
251+
if (!this->m_Mesh.IsNull() && !this->m_Identifier.empty())
243252
{
244-
using MeshWriterType = itk::MeshFileWriter<MeshType>;
245-
auto meshWriter = MeshWriterType::New();
246-
meshWriter->SetFileName(this->m_Identifier);
247-
meshWriter->SetInput(this->m_Mesh);
248-
meshWriter->Update();
253+
using MeshWriterType = itk::MeshFileWriter<MeshType>;
254+
auto meshWriter = MeshWriterType::New();
255+
meshWriter->SetFileName(this->m_Identifier);
256+
meshWriter->SetInput(this->m_Mesh);
257+
meshWriter->Update();
249258
}
250259
#else
251-
std::cerr << "Filesystem IO not supported" << std::endl;
252-
abort();
260+
std::cerr << "Filesystem IO not supported" << std::endl;
261+
abort();
253262
#endif
254263
}
255264
}
265+
256266
protected:
257267
typename MeshType::ConstPointer m_Mesh;
258268

include/itkOutputTextStream.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace wasm
3434
*
3535
* \ingroup WebAssemblyInterface
3636
*/
37-
class OutputTextStream: public OutputStreamBase
37+
class OutputTextStream : public OutputStreamBase
3838
{
3939
public:
4040
void

include/itkSupportInputTransformTypes.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ namespace wasm
4040

4141
/** \class SupportInputTransformTypes
4242
*
43-
* \brief Instantiatiate a Pipeline functor over multiple transform parameter types and dimensions and match to the input transform type.
43+
* \brief Instantiatiate a Pipeline functor over multiple transform parameter types and dimensions and match to the
44+
input transform type.
4445
*
4546
* Instantiate the PipelineFunctor (function object) over multiple transform types.
46-
* If the input transform matches these parameter types and dimensions, use the compile-time optimized pipeline for that transform type.
47+
* If the input transform matches these parameter types and dimensions, use the compile-time optimized pipeline for
48+
that transform type.
4749
* Otherwise, exit the pipeline with an error identifying the unsupported transform type.
4850
*
4951
* Example usage:
@@ -120,8 +122,7 @@ class SupportInputTransformTypes
120122
{
121123
using ParameterValueType = TParameterValues;
122124

123-
if (passThrough ||
124-
transformType.parametersValueType == MapComponentType<ParameterValueType>::JSONFloatTypeEnum)
125+
if (passThrough || transformType.parametersValueType == MapComponentType<ParameterValueType>::JSONFloatTypeEnum)
125126
{
126127
using TransformType = Transform<ParameterValueType, VDimension, VDimension>;
127128

0 commit comments

Comments
 (0)