cookpa
(Philip Cook)
July 5, 2023, 3:06pm
1
Hi all,
Is there support in ITK for random access to image data?
Specifically, I’m trying to figure out if it’s possible to read in a single input volume from a 4D time series, without reading the entire 4D array from disk.
This relates to a feature request for ANTs
opened 06:24PM - 20 Jun 23 UTC
feature request
**Is your feature request related to a problem?**
To apply a concatenated seq… uence of transforms to each volume in a 4D series (for example, head motion + susceptibility warp + coregistration), either the transforms must be the same for each volume or you must split the series and apply the desired transforms.
**Proposed new features**
I suggest adding either a flag or syntax for specifying specific volumes of 4D input. For example using array notation or an `--index` flag:
```
antsApplyTransforms -i raw_bold.nii[0] -r mni.nii -o mni_vol0.nii \
--transform vol0_motion.txt \
--transform susceptibility_warp.h5 \
--transform coreg.txt
```
```
antsApplyTransforms -i raw_bold.nii --index 0 -r mni.nii -o mni_vol0.nii \
--transform vol0_motion.txt \
--transform susceptibility_warp.h5 \
--transform coreg.txt
```
**Alternatives you've considered**
The current approach is to split the series into individual volumes, apply the transformations, and then concatenate the resulting series. It works, but generates 2N volumes for an N time point series.
An ideal approach would be to be able to specify a per-volume transform as one in a sequence of transforms such as
```
antsApplyTransforms -i raw_bold.nii -r mni.nii -o mni_bold.nii \
--transform [vol0_motion.txt, vol1_motion.txt, ...] \
--transform susceptibility_warp.h5 \
--transform coreg.txt
```
However, that seems like a more significant lift. Reading from one volume in a series will at least cut the number of files generated in half, which would be helpful in itself.
**Additional context**
As mentioned above, splitting files before applying transforms creates 2N output files. In the context of a nipype pipeline, add in an additional factor of 5-10 inodes for working directories and their contents. This can become problematic when running a pipeline on many subjects on shared network filesystems.
Thanks
blowekamp
(Bradley Lowekamp)
July 5, 2023, 4:17pm
2
It depends on the file format. In ITK this is called “streaming” and in particular IO streaming. For the NIFTI file format the support is very good.
This can be done by connecting an ExtractImageFilter to the output of an ImageFileReader. Then calling Update
in the extractor. The ITK pipeline should take care for the rest.
1 Like
cookpa
(Philip Cook)
July 5, 2023, 4:53pm
3
blowekamp:
ExtractImageFilter
This looks like exactly what we need, thank you!
1 Like