Skip to content

ENH: Allow ingestion of alternatively grouped CompositeH5s #233

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

Closed
wants to merge 1 commit into from

Conversation

mgxd
Copy link
Member

@mgxd mgxd commented Dec 20, 2024

ITKCompositeH5 is quite rigid ATM, bypassing the first H5 group entirely. This can be fine in some cases, but I have a transform containing a single displacement field (generated from a composite transform and reference image) which is not being read.

This PR successfully loads the DenseFieldTransform. If this looks good, can work on tests.

@mgxd mgxd requested review from effigies and oesteban December 20, 2024 04:21
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.33%. Comparing base (4d7ae6c) to head (08c3c84).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #233   +/-   ##
=======================================
  Coverage   95.32%   95.33%           
=======================================
  Files          28       28           
  Lines        2954     2960    +6     
=======================================
+ Hits         2816     2822    +6     
  Misses        138      138           
Flag Coverage Δ
unittests 95.08% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@effigies
Copy link
Member

How did you generate the h5? With ants, the first group was just metadata.

Probably good to be flexible anyway, but if we're generating with Python, we might need to be careful to emulate itk.

@mgxd
Copy link
Member Author

mgxd commented Dec 20, 2024

It is with ants (ApplyTransforms)

https://github.com/nipreps/nibabies/blob/86264fee0b56144d0799b29a445f84e20ea733f9/nibabies/interfaces/patches.py#L72-L73

$ antsApplyTransforms --help
     -o, --output warpedOutputFileName
                  [warpedOutputFileName or compositeDisplacementField,<printOutCompositeWarpFile=0>]
                  Linear[genericAffineTransformFile,<calculateInverse=0>]
          One can either output the warped image or, if the boolean is set, one can print 
          out the displacement field based on the composite transform and the reference 
          image. A third option is to compose all affine transforms and (if boolean is 
          set) calculate its inverse which is then written to an ITK file. 

@mgxd
Copy link
Member Author

mgxd commented Jan 6, 2025

After thinking about this more, this was inserted in the wrong location - it likely need a separate class (ITKDisplacementFieldH5?) to handle this logic, as the transform produced by antsApplyTransform is not a composite, but rather just a sole displacement field. Since then, I have moved on with this use-case after nipreps/nibabies#425, so this is no longer needed.

@mgxd mgxd closed this Jan 6, 2025
@mgxd mgxd deleted the enh/itk-displacement-field branch January 7, 2025 17:02
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.

2 participants