I’m trying to implement the ComputeIndexToPhysicalPointMatrices functionality.
I have initialized scale variable as below in python. (scale is a DirectionType variable in c++ code)
scale = itk.Matrix.D33()
And the try to access its location by using indexing as below, but unfortunately I have to the ‘itkMatrixD33’ object does not support indexing.
for i in range(VImageDimension):
scale[i][i] = m_Spacing[i]
m_IndexToPhysicalPoint = m_Direction * scale
m_PhysicalPointToIndex = m_IndexToPhysicalPoint.GetInverse()
The Error Message
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
5 # account.
6 for i in range(VImageDimension):
----> 7 scale[i][i] = m_Spacing[i]
8 m_IndexToPhysicalPoint = m_Direction * scale
9 m_PhysicalPointToIndex = m_IndexToPhysicalPoint.GetInverse()
TypeError: 'itkMatrixD33' object does not support indexing