# TileImageFilter and Direction/Orientation

**URL:** https://discourse.itk.org/t/tileimagefilter-and-direction-orientation/2592
**Category:** Beginner Questions
**Created:** [January 8, 2020, 10:10am UTC](https://discourse.itk.org/t/tileimagefilter-and-direction-orientation/2592 "2020-01-08T10:10:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![spinicist](https://discourse.itk.org/user_avatar/discourse.itk.org/spinicist/32/183_2.png) [@spinicist](https://discourse.itk.org/u/spinicist)
#### Post date: [January 8, 2020, 10:10am UTC](https://discourse.itk.org/t/tileimagefilter-and-direction-orientation/2592/1 "2020-01-08T10:10:28Z")

</div>

Hello,

(Apologies, I feel like I asked this question a long time ago and maybe I forgot the answer).

I am combing several 3D volumes into a 4D series with `TileImageFilter`. `TileImageFilter` does not take account of the direction/orientations of the input images, and has an identity matrix for the output direction. There does not appear to be an equivalent to the `SetDirectionCollapseToSubmatrix()` member function of `ExtractImageFilter` e.g. `SetDirectionExpandFromSubmatrix()`.

I have resorted to manually copying the relevant part of the direction matrix from one of the volumes (`tiler` is a `TileImageFilter` instance, `vdir` is the direction matrix of the first volume):

```auto
tiler->Update();
auto const &series = tiler->GetOutput();
Series::DirectionType sdir = series->GetDirection();
for (int ii =0; ii < 3; ii++) {
    for (int jj =0; jj < 3; jj++) {
        sdir[ii][jj] = vdir[ii][jj];
    }
}
series->SetDirection(sdir);

```

In this particular case, I have sagittal volumes that I was combining, so after tiling they had an incorrect orientation.

Is there a better way to do this? Is there a particular reason `TileImageFilter` has no mechanism to preserve the direction as best as possible?

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [January 8, 2020, 1:20pm UTC](https://discourse.itk.org/t/tileimagefilter-and-direction-orientation/2592/2 "2020-01-08T13:20:39Z")

</div>

Have you looked at the [JoinSeriesImageFilter](https://itk.org/Doxygen/html/classitk_1_1JoinSeriesImageFilter.html)? This filter was writing to handle the N-\>N+1 dimension change, and handles the direction cosine matrix appropriately by copying the valid parts, and setting the new parts to the identity.

---

<div class="post-metadata">

### Author: ![spinicist](https://discourse.itk.org/user_avatar/discourse.itk.org/spinicist/32/183_2.png) [@spinicist](https://discourse.itk.org/u/spinicist)
#### Post date: [January 8, 2020, 1:29pm UTC](https://discourse.itk.org/t/tileimagefilter-and-direction-orientation/2592/3 "2020-01-08T13:29:34Z")

</div>

I had completely missed that filter. Thanks!
