Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding strategy: torso, back, arms #12

Open
mathieuboudreau opened this issue Oct 25, 2024 · 1 comment
Open

Padding strategy: torso, back, arms #12

mathieuboudreau opened this issue Oct 25, 2024 · 1 comment

Comments

@mathieuboudreau
Copy link
Member

All our subjects have torso's cut off at the boundary, such that edge padding should be used over zero padding to avoid introducing a non-existent air-torso interface,

Screenshot 2024-10-25 at 9 21 53 AM

Also, several subjects have their backs slightly (or a lot) touching the boundary, and here zero (or air-chi) padding would be best imo. You can clearly see the effect that edge padding has on the field simulation for this case in the example below,

Screenshot 2024-10-25 at 9 22 53 AM

Lasly, all our subjects have their arms and part of their torso cropped latterally,

Screenshot 2024-10-25 at 9 24 03 AM

I'm not sure what would be the best strategy here - I guess it would depend on the padding distance. If we're only going to pad up to 10 cm each boundary, then edge padding would make a bit more sense (but even then, not ideal because it extends the lung cavity), but further away than that we would need to introduce air I think.

tl;dr instead of edge padding all boundaries, we should probably edge pad all the sides besides the back, and air-pad the back. So, a 2-step padding procedure, which numpy can do I believe by selecting which boundaries you want to pad. And then, maybe set a limit for the padding distance where, beyond that, we would start zero padding the sides of the torso (and maybe even, the legs at some point if you really want to pad far away)

@mathieuboudreau
Copy link
Member Author

Writing a note here for documentation purposes:

In a discussion yesterday, Eva reminded me that after padding, the pairity of the dimensions must be preserved, i.e. if x dim was odd before it must be odd after padding, same for y and z. If they were even, it also needs to be preserved.

With my suggested padding, this condition is met (since the padding is symmetrical on both sides of each axis, eg a 129 voxel +50 padding on one side then +50 on the other results in 229, for 128 it would result in 128.

Note however that the old implementation done by Charles's initial code (and I think, possibly inherited from the MATLAB version of the code) does not meet this condition. Before, padding was done as a multiplicative factor, with default 2, so 129 with x2 padding would have been 258, changing the parity.

See:

https://github.com/shimming-toolbox/susceptibility-to-fieldmap-fft/blob/9a60de9e478b724576d390c63070b48951df5e23/functions/compute_fieldmap.py#L63

# creating the k-space grid with the buffer
new_dimensions = buffer*np.array(dimensions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant