# 'itkMatrixD33' object does not support indexing

**URL:** https://discourse.itk.org/t/itkmatrixd33-object-does-not-support-indexing/3479
**Category:** Beginner Questions
**Created:** [September 22, 2020, 10:32am UTC](https://discourse.itk.org/t/itkmatrixd33-object-does-not-support-indexing/3479 "2020-09-22T10:32:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![isuruwi](https://discourse.itk.org/letter_avatar_proxy/v4/letter/i/c0e974/32.png) [@isuruwi](https://discourse.itk.org/u/isuruwi)
#### Post date: [September 22, 2020, 10:32am UTC](https://discourse.itk.org/t/itkmatrixd33-object-does-not-support-indexing/3479/1 "2020-09-22T10:32:36Z")

</div>

I’m trying to implement the [ComputeIndexToPhysicalPointMatrices](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Core/Common/include/itkImageBase.hxx#L169) 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
```
