Saving series in any direction

I have a metaData and a direction matrix, and I want to save the 3D data to a series 2d images according to the matrix. I find there is a function itkImageSeriesWriter to save series. But I didn’t find how to change the save direction.
Any suggestions will be appreciate.

Hello @zhangm,

One of these examples is probably what you are looking for, DicomSeriesReadSeriesWrite or ImageReadDicomSeriesWrite.

Note that in ITK the metaData is not separate from the image. The matrix you have is likely describing the image’s direction cosine matrix and possibly the origin. ITK takes that information directly from the image so you may need to set them if they are different from what is already set for your 3D image.

1 Like

If you want your slices to be in particular orientation, you should take a look at OrientImageFilter.

2 Likes

Thank you for the suggestions from @zivy and @dzenanz .
The matrix I have is a matrix4x4 used for vtkImageSlice to get a single slice. As your suggestions, I first used OrientImageFilter to change the direction of the data, and next used ImageSeriesWriter to save series.

1 Like