Skip to content

Commit 0575485

Browse files
committed
ENH: Add InputSpaceName and OutputSpaceName in Transform
Needed to follow NGFF standards.
1 parent b53f1aa commit 0575485

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

Modules/Core/Transform/include/itkTransform.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,20 @@ class ITK_TEMPLATE_EXPORT Transform : public TransformBaseTemplate<TParametersVa
115115
return VOutputDimension;
116116
}
117117

118+
119+
/* For storing the name of InputSpace */
120+
itkSetMacro(InputSpaceName, std::string);
121+
itkGetConstReferenceMacro(InputSpaceName, std::string);
122+
123+
/** For storing the name of InputSpace/OutputSpace.
124+
125+
InputSpaceName, OutputSpaceName provide identifiers for the world spaces
126+
that the transform applied to and the direction of the spatial transformation.
127+
The direction of the transform goes from the input space to output space.
128+
Typical values include the names of an atlas or a dataset. */
129+
itkSetMacro(OutputSpaceName, std::string);
130+
itkGetConstReferenceMacro(OutputSpaceName, std::string);
131+
118132
/** Type of the input parameters. */
119133
using typename Superclass::FixedParametersType;
120134
using typename Superclass::FixedParametersValueType;
@@ -593,6 +607,9 @@ class ITK_TEMPLATE_EXPORT Transform : public TransformBaseTemplate<TParametersVa
593607
const InverseJacobianPositionType &) const;
594608

595609
private:
610+
std::string m_InputSpaceName;
611+
std::string m_OutputSpaceName;
612+
596613
template <typename TType>
597614
static std::string
598615
GetTransformTypeAsString(TType *)

Modules/Core/Transform/test/itkTransformTest.cxx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#include <iostream>
2020
#include <set>
21-
21+
#include "itkTestingMacros.h"
2222
#include "itkTransform.h"
2323

2424
namespace itk
@@ -308,6 +308,15 @@ class TransformTester
308308
transform->Print(std::cout);
309309
std::cout << transform->GetNameOfClass() << std::endl;
310310

311+
transform->SetObjectName("test_transform");
312+
ITK_TEST_EXPECT_EQUAL(std::string("test_transform"), transform->GetObjectName());
313+
314+
transform->SetInputSpaceName("test_inputspace");
315+
ITK_TEST_EXPECT_EQUAL(std::string("test_inputspace"), transform->GetInputSpaceName());
316+
317+
transform->SetOutputSpaceName("test_outputspace");
318+
ITK_TEST_EXPECT_EQUAL(std::string("test_outputspace"), transform->GetOutputSpaceName());
319+
311320
// Test streaming enumeration for TransformBaseTemplateEnums::TransformCategory elements
312321
const std::set<itk::TransformBaseTemplateEnums::TransformCategory> allTransformCategory{
313322
itk::TransformBaseTemplateEnums::TransformCategory::UnknownTransformCategory,

0 commit comments

Comments
 (0)