fix: apply transpose for voxel_spacing #170
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Edit:
This is a more complex problem then I initially thought so I converted this into a draft.
Summary of what I have learned so far:
SimpleITK.GetArrayFromImage
transpose_backward
order, you're turning nnunet's plan spacing to ZYX order.I feels like the problem has become too complex and I'm testing interaction between multilevel of transforming.
Transposed axes in nnUNet experiments place the largest spacing first. Voxel spacing in plans.json is stored in transposed order, so a backward transpose is needed to restore the original ZYX order when using SimpleITK.
Reference for nnUNet experiment planner:
https://github.com/MIC-DKFZ/nnUNet/blob/3df680c6d28ea88735fca1c1921df380471c1af6/nnunetv2/experiment_planning/experiment_planners/default_experiment_planner.py#L215-L226