# MHA File Format Question about Transform Matrix

**URL:** <https://discourse.itk.org/t/mha-file-format-question-about-transform-matrix/6481>\
**Category:** Algorithms\
**Created:** [February 29, 2024, 4:34pm UTC](https://discourse.itk.org/t/mha-file-format-question-about-transform-matrix/6481 "2024-02-29T16:34:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![imikejackson](https://discourse.itk.org/user_avatar/discourse.itk.org/imikejackson/32/35_2.png) [@imikejackson](https://discourse.itk.org/u/imikejackson)\
**Post date:** [February 29, 2024, 4:34pm UTC](https://discourse.itk.org/t/mha-file-format-question-about-transform-matrix/6481/1 "2024-02-29T16:34:21Z")

</div>

Looking at the header for the .MHA file format there is a Transform Matrix encoded in there. We use the ITK Image reader classes to get at this information.

```auto
    metaImageIO->SetFileName(filePath);
    metaImageIO->ReadImageInformation();
    MetaImage* metaImagePtr = metaImageIO->GetMetaImagePointer();
    double row_1_col_0 = metaImagePtr->TransformMatrix(1, 0);

```

The argument signature to the TransformMatrix are (i, j) which I assume is row and col or is that col row, i.e., is ROW=i or COL=i ?

Just need that sanity check. I’m dealing with .mha files and wanting to sanity check the image we are producing from the data. Is there a place that has both an input .mha image and the output image after transform for like a unit test possibly?

Thanks  
Mike Jackson

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [February 29, 2024, 4:59pm UTC](https://discourse.itk.org/t/mha-file-format-question-about-transform-matrix/6481/2 "2024-02-29T16:59:36Z")

</div>

[PR 2249](https://github.com/InsightSoftwareConsortium/ITK/pull/2249) might be of interest to you, especially the unit test there.
