# Are the vectors defining the Direction of a SimpleITK image normalized?

HI!

I would like to know if the vectors that define the Direction of a SimpleITK image are normalized or not. I am trying to use the method SetDirection but the documentation is not clear about this:

Whereas in NRRD, the space directions tag is not normalized and the vectors of this basis are scaled in such a way that the basis also encodes the spacing. So that’s why I am confused.

Thanks,

Diego

The basis are not normalized, though I would use normalized basis to separate the effect of the spacing parameter from the axis direction. In practice if you provide non-normalized vectors the actual spacing will be a combination of the scale from the basis vectors and the image spacing. See code example below:

``````import SimpleITK as sitk

img = sitk.Image([2,4], sitk.sitkUInt8)

# non-normalized basis matrix columns are (2,0), (0,3)
img.SetDirection([2,0,0,3])
print("direction: "+ str(img.GetDirection()))
print("spacing: " + str(img.GetSpacing()))
print("point coordinates for index [1,1]: " + str(img.TransformIndexToPhysicalPoint([1,1])))

# change spacing to see combination of basis and spacing
img.SetSpacing([0.5,0.5])
print("direction: "+ str(img.GetDirection()))
print("spacing: " + str(img.GetSpacing()))
print("point coordinates for index [1,1]: " + str(img.TransformIndexToPhysicalPoint([1,1])))
``````