minor fix to template shape injection #119
Merged
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.
This fixes a minor bug in template shape injection. The nnunet segmentation is split into channels, and those channels are used for registration when doing template injection. The segmentation labels we retain are specified in a config (e.g. to skip the cyst label, 7). The bug is that the code was assuming the channel indices in the split images (i.e.. label_##.nii.gz) were as they are in that config list (ie. 1-6,8) but the splitting process always writes them as 1-N (where N is the number of labels retained). So it ended up looking for label 8 instead of label 7, which is always missing, so the dentate doesn't end up getting used in the registration.
I think this is a pretty minor fix that probably won't change the resulting segmentation that much (since adding one channel to the multi-channel registration isn't going to have a huge effect). The nice thing is we won't see the warning message that label_08 doesn't exist anymore (which was what caught my attention in the first place)..