diff --git a/Core/Main/GTesting/itkTransformixFilterGTest.cxx b/Core/Main/GTesting/itkTransformixFilterGTest.cxx index c17476058..8febc59d2 100644 --- a/Core/Main/GTesting/itkTransformixFilterGTest.cxx +++ b/Core/Main/GTesting/itkTransformixFilterGTest.cxx @@ -445,6 +445,7 @@ GTEST_TEST(itkTransformixFilter, IsDefaultInitialized) EXPECT_FALSE(transformixFilter.GetLogToConsole()); EXPECT_FALSE(transformixFilter.GetLogToFile()); EXPECT_EQ(transformixFilter.GetOutputMesh(), nullptr); + EXPECT_EQ(transformixFilter.GetNumberOfThreads(), 0); } diff --git a/Core/Main/itkTransformixFilter.h b/Core/Main/itkTransformixFilter.h index 42972df0f..5c190fe08 100644 --- a/Core/Main/itkTransformixFilter.h +++ b/Core/Main/itkTransformixFilter.h @@ -200,6 +200,9 @@ class ITK_TEMPLATE_EXPORT TransformixFilter : public ImageSource m_EnableOutput = false; } + itkSetMacro(NumberOfThreads, int); + itkGetConstMacro(NumberOfThreads, int); + /** Sets an (optional) input mesh. An Update() will transform its points, and store them in the output mesh. */ void SetInputMesh(typename MeshType::ConstPointer mesh) @@ -264,6 +267,8 @@ class ITK_TEMPLATE_EXPORT TransformixFilter : public ImageSource bool m_LogToConsole{ false }; bool m_LogToFile{ false }; + int m_NumberOfThreads{ 0 }; + typename MeshType::ConstPointer m_InputMesh{ nullptr }; typename MeshType::Pointer m_OutputMesh{ nullptr }; }; diff --git a/Core/Main/itkTransformixFilter.hxx b/Core/Main/itkTransformixFilter.hxx index 9d07ceecf..6294c391c 100644 --- a/Core/Main/itkTransformixFilter.hxx +++ b/Core/Main/itkTransformixFilter.hxx @@ -146,6 +146,11 @@ TransformixFilter::GenerateData() } } + if (m_NumberOfThreads > 0) + { + argumentMap.insert(ArgumentMapEntryType("-threads", std::to_string(m_NumberOfThreads))); + } + // Setup xout const auto manager = m_EnableOutput ? std::make_unique(logFileName, m_LogToFile, m_LogToConsole)