Hi,
How to get the location of the most posterior coronal slice location of a volume mask (1 in mask, 0 outside) ?
Thanks,
2086
Hi,
How to get the location of the most posterior coronal slice location of a volume mask (1 in mask, 0 outside) ?
Thanks,
2086
When you say “location”, you mean (x, y, z) coordinate?
3dAutobox (which you may or may not want to use with the “-noclust” option) will tell you this information.
If you use the -extent option, you will see text output in terms of xyz coords for each of the FOV bounding box walls. The formatting of that isn’t very clean for scripting, unfortunately (at the moment, there is only the “clean” list of 6 numbers dumped to a file for IJK values), so you might want to do the following:
#!/bin/tcsh
3dAutobox -prefix AAA.nii -input DSET
set ext = `3dinfo -Pextent AAA.nii`
echo "++ The furthest extent in the posterior direction is: $ext"
–pt
Hi Paul,
Thanks for your answer!
Yes, 3dAutobox is what I need!
Best,
2086
That’s a nice idea, I still think 3dAutobox (again, probably with -noclust) would be the fastest. To get around having to create a new dset, you could do:
#!/bin/tcsh
# get the full, formatted string
set aaa = `3dAutobox -noclust -extent -input PIL.nii`
# get just the "P=..." piece of the output (always the 7th, even if dataset is resampled), and the get just the number part (3rd character and after)
set just_coord = `echo ${aaa[7]} | awk '{print substr($0,3)}'`
echo "++ The posterior coord is: ${just_coord}"
–pt
Hi Paul,
Yes, you are right. When I post my answer I did not see your answer. 3dAutobox is much more faster than 3dmaskdump.
Thank you again,
2086
Hi 2086,
It might be more straightforward to do this with 3dClusterize, say, which outputs the cluster extents. You could just take the most posterior extent form the list of clusters (min size = 1 voxel, if possible).
The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.
Freedom of Information Act |
HHS Vulnerability Disclosure
National Institute of Mental
Health | National Institutes of Health | U.S.
Department of Health and Human Services |