AffineGeometryFrame class is removed as part of migration from v4 to v5

I need that transform on its own. How can i make use of AffineGeometryFrame class functionalities in new ITK version (v5).

I have debugged below things.

typedef itk::TubeSpatialObject< Dimension > TubeType;
typename TubeType::Pointer curTube = dynamic_cast<TubeType*>(tubeList->begin()->GetPointer());

When we debug the code curTube->GetIndexToWorldTransform()->TransformPoint , m_Matrix is coming as {[1,0,0][0,1,0],[0,0,1]} and m_Offset=0 , due to this startPoint and a targetPoint are same.

New ITK library AffineGeometryFrame class removed. SetMatrix and SetOffset API’s were removed as part of migration from v4 to v5.20

Code Snippet:

ITK old Code: C:\W\S-dbg\S-bld\ITKv4\Modules\Core\SpatialObjects\include\itkSpatialObject.hxx

template< unsigned int TDimension >
void
SpatialObject< TDimension >
::ComputeObjectToWorldTransform()
{
  // The ObjectToParentTransform is the combination of the
  //    ObjectToNodeTransform and the NodeToParentNodeTransform
  m_ObjectToParentTransform->SetIdentity();
  m_ObjectToParentTransform->SetCenter(
    m_AffineGeometryFrame->GetObjectToNodeTransform()->GetCenter() );
  m_ObjectToParentTransform->Compose(
    m_AffineGeometryFrame->GetObjectToNodeTransform(), false);
  m_ObjectToParentTransform->Compose(
    static_cast< TreeNodeType * >(
      m_TreeNode.GetPointer() )->GetNodeToParentNodeTransform(), false);

  m_ObjectToWorldTransform->SetCenter(
    m_AffineGeometryFrame->GetObjectToNodeTransform()->GetCenter() );
  m_ObjectToWorldTransform->SetMatrix(
    m_AffineGeometryFrame->GetObjectToNodeTransform()->GetMatrix() );
  m_ObjectToWorldTransform->SetOffset(
    m_AffineGeometryFrame->GetObjectToNodeTransform()->GetOffset() );

  m_IndexToWorldTransform->SetCenter(
    m_AffineGeometryFrame->GetIndexToObjectTransform()->GetCenter() );
  m_IndexToWorldTransform->SetMatrix(
    m_AffineGeometryFrame->GetIndexToObjectTransform()->GetMatrix() );
  m_IndexToWorldTransform->SetOffset(
    m_AffineGeometryFrame->GetIndexToObjectTransform()->GetOffset() );

  static_cast< TreeNodeType * >( m_TreeNode.GetPointer() )
  ->ComputeNodeToWorldTransform();
  m_ObjectToWorldTransform->Compose(
    static_cast< TreeNodeType * >(
      m_TreeNode.GetPointer() )->GetNodeToWorldTransform(), false);

  m_IndexToWorldTransform->Compose(this->GetObjectToWorldTransform(), false);

  // Propagate the changes to the children
  typedef typename TreeNodeType::ChildrenListType TreeChildrenListType;
  TreeChildrenListType *children = m_TreeNode->GetChildren();
  typename TreeChildrenListType::const_iterator it = children->begin();
  typename TreeChildrenListType::const_iterator itEnd = children->end();

  while ( it != itEnd )
    {
    ( *it )->Get()->ComputeObjectToWorldTransform();
    it++;
    }
  // handle internal inverse
  if(!this->GetIndexToWorldTransform()->GetInverse( const_cast< TransformType *>( this->GetInternalInverseTransform() ) ))
    {
    this->m_InternalInverseTransform = ITK_NULLPTR;
    }
  delete children;
}

ITK new code: C:\W\S-dbg\S-bld\ITK\Modules\Core\SpatialObjects\include\itkSpatialObject.hxx

/** Compute the Global Transform */
template <unsigned int TDimension>
void
SpatialObject<TDimension>::ProtectedComputeObjectToWorldTransform()
{
  m_ObjectToWorldTransform->SetFixedParameters(this->GetObjectToParentTransform()->GetFixedParameters());
  m_ObjectToWorldTransform->SetParameters(this->GetObjectToParentTransform()->GetParameters());

  if (this->HasParent())
  {
    m_ObjectToWorldTransform->Compose(this->GetParent()->GetObjectToWorldTransform(), false);
  }

  if (!m_ObjectToWorldTransform->GetInverse(m_ObjectToWorldTransformInverse))
  {
    itkExceptionMacro(<< "Transform must be invertible.");
  }

  // Propagate the changes to the children
  auto it = m_ChildrenList.begin();
  while (it != m_ChildrenList.end())
  {
    (*it)->Update();
    it++;
  }

  this->Modified();
}

Why? What are you trying to accomplish? Did you take a look at the spatial object refactoring section in the migration guide?

Because target point is taking same value of start point value for branches.

I am trying to accomplish the below.

• There is a Start Point and a Target(End) Point. The centerline is computed so as to pass through the center of the part from one point to the other.
• Along with the centerline, the Centerline.tre tube file is also created. This works fine for us.
• But when it comes to the Branch Vessels, there is a Start Point but there is no Target Point (though optionally there can be additional guide points specified along the center of the vessel). Instead of the Target(End) Point, the Branch Vessel minimal path code use the Centerline.tre tube as a Target(End) that the centerline should intersect. So the centerline is computed and grows towards the part but stops once it intersects the tube. I believe this is how old ITK code was working.
• Parent transfer(Its in itkSpatialObject.hxx class) works fine with the part. But When same thing is doing with branch vessels. Its generating the target(End) point same as start point. I think Its needs local transfer (which is there in itkAffineGeometryFrame.hxx class).
• Since itkAffineGeometryFrame.hxx is deprecated in new ITK (v5). Which leads to probelm it seems. So branchcenterline.tre tube file is not generating properly. Please correct me if anything is wrong.

Yes I have gone through the spatial object refactoring section in the migration guide.

@Stephen_Aylward do you have some suggestions?