converting in only 'x' or 'y' directions?
Opened this issue · 5 comments
Short question: is it possible to choose in which direction to convert apart from z or all?
Long Q w problem:
I have 3D .nii files and I have coordinates (c1,c2,c3) of a centroid of an ROI.
I have sliced these files using med2image --reslice on each coord and then deleting files so I end up with only slice c1 in direction x, c2 in direction y and c3 in direction z. (Bit tedious but saving slices directly with itk does not work properly)
Sometimes a coordinate is bigger than the size of my .nii file in one of the dimensions med2image tries to slice in. Say coords of centroid = (80, 120 ,80) and .nii image size is (90, 140, 120). I want slice 80 in x, slice 120 in y and slice 80 in z. I get an error when --reslice on 120 because med2image also tries in direction x, which is out of bounds and then the slice will not be converted in other directions.
I'm not sure I 100% understand. Let me paraphrase:
- You want to slice in 3 dirs, but instead of having all the slices as result, you only want 3 final specific ones?
Is that correct?
I'm not sure I get your "short" question about which direction to convert? Are you also asking if instead of the default z
dir is it possible to tell med2image
to only do say x
or y
?
Thanks for your reply, yes that is correct! I would like slice 1 in only dir x, slice 2 in only dir y and slice 3 in only dir z. This is useful when visualising an organ or anomaly with coordinates 1,2,3.
You understood the short question correctly! Is only doing x or y something that I can tell med2image to do or if not, maybe as a suggestion for in the future?
OK -- so you essentially would like something like:
med2image .... --reslice -s <sliceInKDir> -i <sliceInIDir> j <sliceInJDir>
So "new" flags might be a -i
and -j
?
Right now, if you do
med2image ... --reslice -s <sliceInKDir>
That will give only a single slice in the k
dir, but will give all the slices in the i
and j
dirs. Is that correct? I can't confirm right now.
What platform are you? Since I guess on a *nix
type system doing the i
and j
dir deleting of all the non-needed slices is rather trivial using CLI and pipes...
Those new flags would be great! I was able to test it today -
med2image ... reslice -s <sliceInKDir>
only gives that single slice in all directions.
I'm on Debian 10 and you're correct about deleting being trivial, it's not a problem and that's how I got ~90% of my data. My remaining problem is I can't get the remaining ~10% of slices. Say that if I need slice 50 in dir j, but dir k or i only go up to slice 40 (because the image is not a square box), med2image throws an error because it'll try 50 from dir k and i first and then slice 50 dir j is never made. I hope this is any clarification and that I'm correct!