Skip to content

Conversation

@thangngoc89
Copy link
Contributor

@thangngoc89 thangngoc89 commented Jan 15, 2025

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 loads NifTI and store data in ZYX order. This is the same order that you get from SimpleITK.GetArrayFromImage
  • SimpleITK returns spacing in physical world, meaning XYZ. Reference from nnunet
  • nnUNet preprocessor expect the input data and spacing both in ZYX order.
  • By applying the transpose_backward order, you're turning nnunet's plan spacing to ZYX order.
  • The code still misses the part where you need to give SimpleITK resampler the XYZ spacing order.
  • A good place to add this is in moose function
desired_spacing = desired_spacing[::-1]

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

@vercel
Copy link

vercel bot commented Jan 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
moose ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 15, 2025 6:27pm

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

Successfully merging this pull request may close these issues.

1 participant